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:
{width=405 height=247}
After:
{width=404 height=234}
This commit is contained in:
committed by
Tobias Fella
parent
8725600368
commit
443c0f34d7
@@ -105,10 +105,12 @@ QQC2.ComboBox {
|
|||||||
Kirigami.Dialog {
|
Kirigami.Dialog {
|
||||||
id: addServerSheet
|
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")
|
title: i18nc("@title:window", "Add server")
|
||||||
|
|
||||||
|
horizontalPadding: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
onOpened: if (!serverUrlField.isValidServer && !addServerSheet.opened) {
|
onOpened: if (!serverUrlField.isValidServer && !addServerSheet.opened) {
|
||||||
root.currentIndex = 0;
|
root.currentIndex = 0;
|
||||||
root.server = root.currentValue;
|
root.server = root.currentValue;
|
||||||
@@ -121,15 +123,44 @@ QQC2.ComboBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
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
|
id: serverUrlField
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
placeholderText: "kde.org"
|
||||||
|
|
||||||
property bool isValidServer: false
|
property bool isValidServer: false
|
||||||
|
|
||||||
label: i18n("Server URL")
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (acceptableInput) {
|
if (acceptableInput) {
|
||||||
serverListModel.checkServer(text);
|
serverListModel.checkServer(text);
|
||||||
|
|||||||
Reference in New Issue
Block a user