[utilities/kdebugsettings] src/quickapps: Remove duplicate code

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 2bfdf5e68d2b3aa2e625c8f8c7e4eb2c1fda3847 by Laurent Montel.
Committed on 22/07/2026 at 05:41.
Pushed by mlaurent into branch 'master'.

Remove duplicate code

M  +1    -0    src/quickapps/CMakeLists.txt
A  +15   -0    src/quickapps/qml/CategoryComboBox.qml     [License: LGPL(v2.0+)]
M  +1    -8    src/quickapps/qml/EditCustomRuleDialog.qml
M  +2    -9    src/quickapps/qml/KDEApplicationRulesPage.qml

https://invent.kde.org/utilities/kdebugsettings/-/commit/2bfdf5e68d2b3aa2e625c8f8c7e4eb2c1fda3847

diff --git a/src/quickapps/CMakeLists.txt b/src/quickapps/CMakeLists.txt
index 0526f173..28e374d1 100644
--- a/src/quickapps/CMakeLists.txt
+++ b/src/quickapps/CMakeLists.txt
@@ -18,6 +18,7 @@ ecm_target_qml_sources(kdebugsettingsquick SOURCES
     qml/KDEApplicationRulesPage.qml
     qml/MainPage.qml
     qml/Main.qml
+    qml/CategoryComboBox.qml
 )
 
 ecm_finalize_qml_module(kdebugsettingsquick)
diff --git a/src/quickapps/qml/CategoryComboBox.qml b/src/quickapps/qml/CategoryComboBox.qml
new file mode 100644
index 00000000..c9406287
--- /dev/null
+++ b/src/quickapps/qml/CategoryComboBox.qml
@@ -0,0 +1,15 @@
+// SPDX-FileCopyrightText: 2026 Laurent Montel <[email protected]>
+// SPDX-License-Identifier: LGPL-2.0-or-later
+
+import QtQuick.Controls as QQC2
+import org.kde.kdebugsettings
+
+QQC2.ComboBox {
+    id: categoryType
+    model: CategoryTypeProxyModel {
+        sourceModel: LoggingManager.categoryTypeModel
+        showOffType: true
+    }
+    textRole: "display"
+    valueRole: "categoryType"
+}
\ No newline at end of file
diff --git a/src/quickapps/qml/EditCustomRuleDialog.qml b/src/quickapps/qml/EditCustomRuleDialog.qml
index 268d062a..790476ab 100644
--- a/src/quickapps/qml/EditCustomRuleDialog.qml
+++ b/src/quickapps/qml/EditCustomRuleDialog.qml
@@ -32,16 +32,9 @@ Kirigami.Dialog {
             verticalAlignment: Text.AlignVCenter
             text: i18n("Type:")
         }
-        QQC2.ComboBox {
+        CategoryComboBox {
             id: categoryType
             Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
-
-            model: CategoryTypeProxyModel {
-                sourceModel: LoggingManager.categoryTypeModel
-                showOffType: true
-            }
-            textRole: "display"
-            valueRole: "categoryType"
         }
         QQC2.CheckBox {
             id: categoryEnabled
diff --git a/src/quickapps/qml/KDEApplicationRulesPage.qml b/src/quickapps/qml/KDEApplicationRulesPage.qml
index 2c4b3ef4..aa70b9c0 100644
--- a/src/quickapps/qml/KDEApplicationRulesPage.qml
+++ b/src/quickapps/qml/KDEApplicationRulesPage.qml
@@ -48,18 +48,11 @@ Kirigami.ScrollablePage {
                 Item {
                     Layout.fillWidth: true
                 }
-                QQC2.ComboBox {
+                CategoryComboBox {
+                    id: categoryType
                     Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
-                    // Keep the delegate row index distinct from ComboBox activation index.
                     property int rowIndex: index
 
-                    model: CategoryTypeProxyModel {
-                        sourceModel: LoggingManager.categoryTypeModel
-                        showOffType: true
-                    }
-                    textRole: "display"
-                    valueRole: "categoryType"
-
                     // Re-evaluate once the ComboBox model is populated on startup.
                     currentIndex: count > 0 ? indexOfValue(loggingType) : -1
                     onActivated: () => {
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.