[kcmkwin/kwinrules] Add explanatory text to placeholder messages

This commit is contained in:
Nate Graham 2021-03-18 21:57:00 -06:00
parent ca23bca813
commit 37445d9c29
2 changed files with 15 additions and 16 deletions

View file

@ -44,25 +44,24 @@ ScrollViewKCM {
NumberAnimation { property: "y"; duration: Kirigami.Units.longDuration } NumberAnimation { property: "y"; duration: Kirigami.Units.longDuration }
} }
Kirigami.PlaceholderMessage { // We need to center on the free space below contentItem, not the full
id: hintArea // ListView. This invisible item helps make that positioning work no
visible: rulesView.count <= 4 // matter the window height
Item {
anchors { anchors {
// We need to center on the free space below contentItem, not the full ListView. left: parent.left
// Setting both top and bottom anchors (or using anchors.fill) stretches the component right: parent.right
// and distorts the spacing between its internal items.
// This is fine as long as we have a single item here.
horizontalCenter: parent.horizontalCenter
top: parent.contentItem.bottom top: parent.contentItem.bottom
bottom: parent.bottom bottom: parent.bottom
} }
width: parent.width - (units.largeSpacing * 4) visible: rulesView.count <= 4
helpfulAction: QQC2.Action {
text: i18n("Add Property...") Kirigami.PlaceholderMessage {
icon.name: "list-add-symbolic" id: hintArea
onTriggered: { anchors.centerIn: parent
propertySheet.open(); width: parent.width - (units.largeSpacing * 4)
} text: i18n("No window properties changed")
explanation: xi18nc("@info", "Click the <interface>Add Property...</interface> button below to add some window properties that will be affected by the rule")
} }
} }
} }
@ -87,7 +86,6 @@ ScrollViewKCM {
icon.name: checked ? "dialog-close" : "list-add-symbolic" icon.name: checked ? "dialog-close" : "list-add-symbolic"
checkable: true checkable: true
checked: propertySheet.sheetOpen checked: propertySheet.sheetOpen
visible: !hintArea.visible || checked
onToggled: { onToggled: {
propertySheet.sheetOpen = checked; propertySheet.sheetOpen = checked;
} }

View file

@ -59,6 +59,7 @@ ScrollViewKCM {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width - (units.largeSpacing * 4) width: parent.width - (units.largeSpacing * 4)
text: i18n("No rules for specific windows are currently set"); text: i18n("No rules for specific windows are currently set");
explanation: xi18nc("@info", "Click the <interface>Add New...</interface> button below to add some")
} }
} }