From 443c0f34d7fb69fd92f3be1c50db79f0c3d1d4aa Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sat, 6 Jul 2024 18:10:34 +0000 Subject: [PATCH] Rework Add Server dialog Use plain items instead of FormCard delegate items, this isn't a FormCard Set placeholder text for textfield Remove redundant subtitle Use inlinemessage for errors Before: ![image.png](/uploads/375d3c668271f6bce699cc9462f6deb9/image.png){width=405 height=247} After: ![image.png](/uploads/b8d79a4fdb0914d1f82ecec0760ad80f/image.png){width=404 height=234} --- src/qml/ServerComboBox.qml | 41 +++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/src/qml/ServerComboBox.qml b/src/qml/ServerComboBox.qml index 8207e6ab3..7be943720 100644 --- a/src/qml/ServerComboBox.qml +++ b/src/qml/ServerComboBox.qml @@ -105,10 +105,12 @@ QQC2.ComboBox { Kirigami.Dialog { id: addServerSheet - width: Math.min(Kirigami.Units.gridUnit * 24, QQC2.ApplicationWindow.window.width) + width: Math.min(Kirigami.Units.gridUnit * 15, QQC2.ApplicationWindow.window.width) title: i18nc("@title:window", "Add server") + horizontalPadding: Kirigami.Units.largeSpacing + onOpened: if (!serverUrlField.isValidServer && !addServerSheet.opened) { root.currentIndex = 0; root.server = root.currentValue; @@ -121,15 +123,44 @@ QQC2.ComboBox { } contentItem: ColumnLayout { - FormCard.FormTextDelegate { - text: serverUrlField.length > 0 ? (serverUrlField.acceptableInput ? (serverUrlField.isValidServer ? i18n("Valid server entered") : i18n("This server cannot be resolved or has already been added")) : i18n("The entered text is not a valid url")) : i18n("Enter server url e.g. kde.org") + + spacing: Kirigami.Units.smallSpacing + + Kirigami.InlineMessage { + Layout.fillWidth: true + + visible: text != "" + + text: { + if (serverUrlField.length > 0) { + if (!serverUrlField.acceptableInput) { + return i18n("The entered text is not a valid url"); + } + + if (!serverUrlField.isValidServer) { + return i18n("This server cannot be resolved or has already been added"); + } + } + + return ""; + } } - FormCard.FormTextFieldDelegate { + + QQC2.Label { + Layout.fillWidth: true + + text: i18n("Server URL:") + } + + QQC2.TextField { id: serverUrlField + Layout.fillWidth: true + + placeholderText: "kde.org" + property bool isValidServer: false - label: i18n("Server URL") onTextChanged: { if (acceptableInput) { serverListModel.checkServer(text);