From 301bc234e907c5e4fff67c58ef8546c4e103e5ad Mon Sep 17 00:00:00 2001 From: Ismael Asensio Date: Sun, 21 Jul 2024 14:18:59 +0200 Subject: [PATCH] feat: add a placeholder for properties filter The list to add properties can be empty because no entry matches the filter text or if all the properties have been already added. Show a placeholder instead of leaving the view just empty --- kcms/rules/ui/RulesEditor.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kcms/rules/ui/RulesEditor.qml b/kcms/rules/ui/RulesEditor.qml index dbd1c3e22..51fc2e1f7 100644 --- a/kcms/rules/ui/RulesEditor.qml +++ b/kcms/rules/ui/RulesEditor.qml @@ -257,6 +257,18 @@ KCM.ScrollViewKCM { } } } + + Kirigami.PlaceholderMessage { + anchors.centerIn: parent + width: parent.width - (Kirigami.Units.largeSpacing * 4) + visible: overlayModel.count === 0 + text: { + if (searchField.text.length === 0) { + return i18nc("@info:placeholder", "No properties left to add"); + } + return i18nc("@info:placeholder %1 is a filter text introduced by the user", "No properties match \"%1\"", searchField.text); + } + } } onVisibleChanged: {