plugins/runcommand: make config dialog HIG-compliant
The HIG recommend that buttons with an action label that require further user input end in an ellipsis, and that dialog buttons should clearly indicate what they do. Button labels typically do not match the given exceptions that license sentence case. Currently, the main "Add command" button in the configuration button does not end in an ellipsis even though it opens a dialog, is sentence case, and the dialog has a "Save" rather than the customary "Add" that is used for these kinds of actions, in particular in kcms. The dialog title is also not translatable. This change adds the ellipsis, converts the button to title case, makes the dialog title translatable, and adds an "Add" button as an action to the dialog.
This commit is contained in:
parent
26c9f77b2b
commit
9f34092aa9
1 changed files with 19 additions and 5 deletions
|
@ -22,7 +22,7 @@ ListView {
|
|||
|
||||
property var action: Kirigami.Action {
|
||||
icon.name: "list-add"
|
||||
text: i18n("Add command")
|
||||
text: i18n("Add Command…")
|
||||
onTriggered: addDialog.open()
|
||||
}
|
||||
|
||||
|
@ -58,11 +58,27 @@ ListView {
|
|||
|
||||
Kirigami.Dialog {
|
||||
id: addDialog
|
||||
title: "Add command"
|
||||
title: i18nc("@title:window", "Add Command")
|
||||
|
||||
standardButtons: QQC2.Dialog.Save | QQC2.Dialog.Cancel
|
||||
padding: Kirigami.Units.largeSpacing
|
||||
|
||||
property Kirigami.Action addCommandAction: Kirigami.Action {
|
||||
text: i18nc("@action:button", "Add")
|
||||
icon.name: "list-add"
|
||||
enabled: commandField.length > 0
|
||||
onTriggered: {
|
||||
commandModel.addCommand(nameField.text, commandField.text)
|
||||
addDialog.close();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
// TODO: can be set directly once Qt 6.8 is required
|
||||
Accessible.Name = i18nc("@action:button accessible", "Add command")
|
||||
}
|
||||
}
|
||||
|
||||
standardButtons: Kirigami.Dialog.Cancel
|
||||
customFooterActions: [addCommandAction]
|
||||
|
||||
Kirigami.FormLayout {
|
||||
QQC2.TextField {
|
||||
id: nameField
|
||||
|
@ -115,7 +131,5 @@ ListView {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
onAccepted: commandModel.addCommand(nameField.text, commandField.text)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue