kcm/kwinrules: Keep sheet open when adding properties via button

Keep properties sheet open when clicking on the button to add
a new property. This allows to add several properties in a row.
Clicking on the full row will keep the previous behavior for the
simple case, closing the sheet so the new property can be edited
right away

Also make the button on each delegate always visible (not only
on hover) to be more consistent with current status everywhere else.

Previously the sheet would remain open only after detecting some
window properties, which was a very hidden and confusing pattern.

BUG: 431228
FIXED-IN: 5.26
This commit is contained in:
Ismael Asensio 2022-01-28 21:05:23 +01:00
parent 405469aa19
commit 6bf53c8797

View file

@ -218,8 +218,7 @@ ScrollViewKCM {
}
QQC2.ToolButton {
icon.name: (model.enabled) ? "dialog-ok-apply" : "list-add"
opacity: propertyDelegate.hovered ? 1 : 0
onClicked: propertyDelegate.clicked()
onClicked: addProperty();
Layout.preferredWidth: implicitWidth
Layout.leftMargin: -Kirigami.Units.smallSpacing
Layout.rightMargin: -Kirigami.Units.smallSpacing
@ -228,14 +227,16 @@ ScrollViewKCM {
}
onClicked: {
addProperty();
propertySheet.close();
}
function addProperty() {
model.enabled = true;
if (model.suggested != null) {
model.value = model.suggested;
model.suggested = null;
}
if (!overlayModel.onlySuggestions) {
propertySheet.close();
}
}
}
}