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}
This commit is contained in:
Nicolas Fella
2024-07-06 18:10:34 +00:00
committed by Tobias Fella
parent 8725600368
commit 443c0f34d7

View File

@@ -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);