Commit b623a4af authored by Nate Graham's avatar Nate Graham
Browse files

Fix the Add Source dialog

Fix a variety of bugs and usability issues with the {nav Add Source} dialog:
- Make the close button actually close the dialog
- Give the text field focus so you can immediately start typing
- Make the return key push the Add button
- Remove needless close symbol in top-right corner
- Give the buttons icons
- Re-word the title and make it larger

BUG: 390148

Test Plan:


Tested with Flatpak backend:
- Invalid URLs are rejected
- Valid URLs that nonetheless don't point to a Flatpak repo trigger an error message
- The close button now closes the dialog
- The escape key still closes the dialog
- The return and enter keys press the {nav Add} button

Reviewers: #discover_software_store, apol

Reviewed By: #discover_software_store, apol

Subscribers: acrouthamel, plasma-devel

Tags: #plasma

Differential Revision:
parent da6be2af
......@@ -27,6 +27,7 @@ Popup
id: newSourceDialog
parent: applicationWindow().overlay
modal: true
focus: true
x: (parent.width - width)/2
y: (parent.height - height)/2
......@@ -41,22 +42,10 @@ Popup
right: parent.right
Kirigami.Icon {
Layout.alignment: Qt.AlignRight
visible: !Kirigami.Settings.isMobile
width: Kirigami.Units.iconSizes.smallMedium
height: width
source: "dialog-close"
MouseArea {
anchors.fill: parent
onClicked: newSourceDialog.close();
Kirigami.Heading {
level: 4
level: 3
Layout.fillWidth: true
text: i18n("Specify the new source for %1", displayName)
text: i18n("Add a new %1 repository", displayName)
Label {
id: description
......@@ -70,19 +59,32 @@ Popup
TextField {
id: repository
Layout.fillWidth: true
Keys.onEnterPressed: newSourceDialog.accept()
onAccepted: okButton.clicked()
focus: true
onTextChanged: color = Kirigami.Theme.textColor
DialogButtonBox {
Layout.fillWidth: true
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Close
onAccepted: if (source.addSource(repository.text)) {
newSourceDialog.visible = false
} else {
repository.color = Kirigami.Theme.negativeTextColor
Button {
id: okButton
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
text: i18n("Add") "list-add"
onClicked: if (source.addSource(repository.text)) {
} else {
repository.color = Kirigami.Theme.negativeTextColor
Button {
id: cancelButton
DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole
text: i18n("Cancel") "dialog-cancel"
onClicked: newSourceDialog.close()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment