[utilities/kdebugsettings] src/quickapps/qml: Fix assign combobox value
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit e955e3a99d38346c80d583e2c12b4b6cba41fb14 by Laurent Montel.
Committed on 24/07/2026 at 12:01.
Pushed by mlaurent into branch 'master'.
Fix assign combobox value
M +9 -1 src/quickapps/qml/CategoryComboBox.qml
M +4 -3 src/quickapps/qml/EditCustomRuleDialog.qml
M +11 -7 src/quickapps/qml/KDEApplicationRulesPage.qml
https://invent.kde.org/utilities/kdebugsettings/-/commit/e955e3a99d38346c80d583e2c12b4b6cba41fb14
diff --git a/src/quickapps/qml/CategoryComboBox.qml b/src/quickapps/qml/CategoryComboBox.qml
index e7c5f8a4..4cc445f4 100644
--- a/src/quickapps/qml/CategoryComboBox.qml
+++ b/src/quickapps/qml/CategoryComboBox.qml
@@ -9,13 +9,21 @@ QQC2.ComboBox {
property int loggingType: -1
property bool showOffTypeValue: true
+ property bool syncLoggingTypeFromSelection: true
onLoggingTypeChanged: {
currentIndex = count > 0 ? indexOfValue(loggingType) : -1
}
+ onCountChanged: {
+ // Resolve initial selection once the proxy model is populated.
+ if (count > 0 && currentIndex < 0) {
+ currentIndex = indexOfValue(loggingType)
+ }
+ }
+
onCurrentIndexChanged: {
- if (currentIndex >= 0 && currentValue !== undefined) {
+ if (syncLoggingTypeFromSelection && currentIndex >= 0 && currentValue !== undefined) {
loggingType = currentValue
}
}
diff --git a/src/quickapps/qml/EditCustomRuleDialog.qml b/src/quickapps/qml/EditCustomRuleDialog.qml
index 74d11c73..6d906310 100644
--- a/src/quickapps/qml/EditCustomRuleDialog.qml
+++ b/src/quickapps/qml/EditCustomRuleDialog.qml
@@ -20,7 +20,7 @@ Kirigami.Dialog {
footer: QQC2.DialogButtonBox {
standardButtons: saveButton | QQC2.DialogButtonBox.Cancel
onAccepted: {
- editUserModal.saveUser();
+ dialog.accept();
}
QQC2.Button {
id: saveButton
@@ -53,6 +53,7 @@ Kirigami.Dialog {
CategoryComboBox {
id: categoryType
showOffTypeValue: false
+ syncLoggingTypeFromSelection: true
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
QQC2.CheckBox {
@@ -63,9 +64,9 @@ Kirigami.Dialog {
}
onAccepted: {
if (editMode) {
- LoggingManager.customCategoryModel.updateCategory(editRowIndex, categoryNameField.text, categoryEnabled.checked, categoryType.currentValue);
+ LoggingManager.customCategoryModel.updateCategory(editRowIndex, categoryNameField.text, categoryEnabled.checked, categoryType.loggingType);
} else {
- LoggingManager.customCategoryModel.addCategory(categoryNameField.text, categoryEnabled.checked, categoryType.currentValue);
+ LoggingManager.customCategoryModel.addCategory(categoryNameField.text, categoryEnabled.checked, categoryType.loggingType);
}
}
}
diff --git a/src/quickapps/qml/KDEApplicationRulesPage.qml b/src/quickapps/qml/KDEApplicationRulesPage.qml
index aa70b9c0..0e1d5ab9 100644
--- a/src/quickapps/qml/KDEApplicationRulesPage.qml
+++ b/src/quickapps/qml/KDEApplicationRulesPage.qml
@@ -30,6 +30,12 @@ Kirigami.ScrollablePage {
clip: true
model: LoggingManager.kdeApplicationLoggingCategoryProxyModel
delegate: Delegates.RoundedItemDelegate {
+ id: ruleDelegate
+ required property int index
+ required property string description
+ required property string generatedToolTip
+ required property int loggingType
+
highlighted: ListView.isCurrentItem
onClicked: listviewRules.currentIndex = index
@@ -38,12 +44,12 @@ Kirigami.ScrollablePage {
QQC2.Label {
Layout.leftMargin: 4
- text: model.description
+ text: ruleDelegate.description
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
verticalAlignment: Text.AlignVCenter
QQC2.ToolTip.visible: hovered
- QQC2.ToolTip.text: model.generatedToolTip
+ QQC2.ToolTip.text: ruleDelegate.generatedToolTip
}
Item {
Layout.fillWidth: true
@@ -51,12 +57,10 @@ Kirigami.ScrollablePage {
CategoryComboBox {
id: categoryType
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
- property int rowIndex: index
-
- // Re-evaluate once the ComboBox model is populated on startup.
- currentIndex: count > 0 ? indexOfValue(loggingType) : -1
+ syncLoggingTypeFromSelection: false
+ loggingType: ruleDelegate.loggingType
onActivated: () => {
- listviewRules.model.setCategoryType(rowIndex, currentValue);
+ listviewRules.model.setCategoryType(index, currentValue);
}
}
}