[kcm/kwinrules] Add properties to a rule one-by-one
Change the labels to singular `Property` and close the property sheet after clicking on one item. The behaviour of the sheet is now more similar to a menu, and not so much as a dialog which needs to be dismissed to go on. The idea is to simplify the rule editor workflow and make it more evident to the users. By making the `Add property` close after each selection, the user can see immediately that the property has been added to the rule list so they can edit it. Also use ListView transitions to add visual hints when adding or removing properties, and try to position the new added item into the visible view.
This commit is contained in:
parent
f247e35c6d
commit
23788ad9b9
1 changed files with 22 additions and 4 deletions
|
@ -25,12 +25,27 @@ ScrollViewKCM {
|
|||
clip: true
|
||||
|
||||
model: enabledRulesModel
|
||||
delegate: RuleItemDelegate {}
|
||||
delegate: RuleItemDelegate {
|
||||
ListView.onAdd: {
|
||||
// Try to position the new added item into the visible view
|
||||
// FIXME: It only works when moving towards the end of the list
|
||||
ListView.view.currentIndex = index
|
||||
}
|
||||
}
|
||||
section {
|
||||
property: "section"
|
||||
delegate: Kirigami.ListSectionHeader { label: section }
|
||||
}
|
||||
|
||||
highlightRangeMode: ListView.ApplyRange
|
||||
|
||||
add: Transition {
|
||||
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration * 3 }
|
||||
}
|
||||
removeDisplaced: Transition {
|
||||
NumberAnimation { property: "y"; duration: Kirigami.Units.longDuration }
|
||||
}
|
||||
|
||||
Kirigami.PlaceholderMessage {
|
||||
id: hintArea
|
||||
visible: rulesView.count <= 4
|
||||
|
@ -45,7 +60,7 @@ ScrollViewKCM {
|
|||
}
|
||||
width: parent.width - (units.largeSpacing * 4)
|
||||
helpfulAction: QQC2.Action {
|
||||
text: i18n("Add Properties...")
|
||||
text: i18n("Add Property...")
|
||||
icon.name: "list-add-symbolic"
|
||||
onTriggered: {
|
||||
propertySheet.open();
|
||||
|
@ -63,7 +78,7 @@ ScrollViewKCM {
|
|||
|
||||
footer: RowLayout {
|
||||
QQC2.Button {
|
||||
text: checked ? i18n("Close") : i18n("Add Properties...")
|
||||
text: checked ? i18n("Close") : i18n("Add Property...")
|
||||
icon.name: checked ? "dialog-close" : "list-add-symbolic"
|
||||
checkable: true
|
||||
checked: propertySheet.sheetOpen
|
||||
|
@ -109,7 +124,7 @@ ScrollViewKCM {
|
|||
parent: view
|
||||
|
||||
header: Kirigami.Heading {
|
||||
text: i18n("Select properties")
|
||||
text: i18n("Add property to the rule")
|
||||
}
|
||||
footer: Kirigami.SearchField {
|
||||
id: searchField
|
||||
|
@ -180,6 +195,9 @@ ScrollViewKCM {
|
|||
model.value = model.suggested;
|
||||
model.suggested = null;
|
||||
}
|
||||
if (!overlayModel.onlySuggestions) {
|
||||
propertySheet.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue