[utilities/kdebugsettings] src/quickapps/qml: Allow to edit custom rule when we double click

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 47cd886bd5af9f2dc3c811c9235be82e086ea720 by Laurent Montel.
Committed on 23/07/2026 at 06:50.
Pushed by mlaurent into branch 'master'.

Allow to edit custom rule when we double click

M  +18   -9    src/quickapps/qml/CustomRulesPage.qml

https://invent.kde.org/utilities/kdebugsettings/-/commit/47cd886bd5af9f2dc3c811c9235be82e086ea720

diff --git a/src/quickapps/qml/CustomRulesPage.qml b/src/quickapps/qml/CustomRulesPage.qml
index 44c5beb1..725147d0 100644
--- a/src/quickapps/qml/CustomRulesPage.qml
+++ b/src/quickapps/qml/CustomRulesPage.qml
@@ -24,6 +24,20 @@ Kirigami.ScrollablePage {
         id: editCustomRuleDialog
     }
 
+    function editCustomRule(item, currentIndex) {
+        if (item) {
+            const categoryName = item.categoryName;
+            const categoryEnabled = item.enabled;
+            const categoryLoggingType = item.loggingType;
+            editCustomRuleDialog.editMode = true;
+            editCustomRuleDialog.editRowIndex = currentIndex;
+            editCustomRuleDialog.categoryName = categoryName;
+            editCustomRuleDialog.categoryEnabled = categoryEnabled;
+            editCustomRuleDialog.categoryType = categoryLoggingType;
+            editCustomRuleDialog.open();
+        }
+    }
+
     ListView {
         id: listviewRules
         reuseItems: true
@@ -40,6 +54,9 @@ Kirigami.ScrollablePage {
             text: displayRule
             highlighted: ListView.isCurrentItem
             onClicked: listviewRules.currentIndex = index
+            onDoubleClicked: {
+                editCustomRule(listviewRules.currentItem, listviewRules.currentIndex)
+            }
         }
         TapHandler {
             acceptedButtons: Qt.RightButton
@@ -63,15 +80,7 @@ Kirigami.ScrollablePage {
                 icon.name: "document-edit"
                 text: i18nc("@action edit custom rule", "Edit Rule…")
                 onTriggered: {
-                    const categoryName = listviewRules.currentItem ? listviewRules.currentItem.categoryName : "";
-                    const categoryEnabled = listviewRules.currentItem ? listviewRules.currentItem.enabled : false;
-                    const categoryLoggingType = listviewRules.currentItem ? listviewRules.currentItem.loggingType : LoggingCategory.LoggingType.Debug;
-                    editCustomRuleDialog.editMode = true;
-                    editCustomRuleDialog.editRowIndex = listviewRules.currentIndex;
-                    editCustomRuleDialog.categoryName = categoryName;
-                    editCustomRuleDialog.categoryEnabled = categoryEnabled;
-                    editCustomRuleDialog.categoryType = categoryLoggingType;
-                    editCustomRuleDialog.open();
+                    editCustomRule(listviewRules.currentItem, listviewRules.currentIndex)
                 }
             }
             QQC2.MenuSeparator {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.