[plasma/discover/Plasma/6.7] kcm/ui: kcm/updates: Fix incorrect text when changing update type
Nate Graham <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 57f898f74c8acb09e5a9e34ccdc44326ce008f19 by Nate Graham. Committed on 04/08/2026 at 18:08. Pushed by ngraham into branch 'Plasma/6.7'. kcm/updates: Fix incorrect text when changing update type When a non-default value is selected for `Notification frequency`, changing the `Update software` setting causes `Notification frequency` to incorrectly display `Daily`. Additionally, if `Notification frequency` is set to `Never`, changing `Update software` to `Automatically` fails to set `Update frequency` to a valid value. As a result, reloading the KCM leaves the combobox empty. (cherry picked from commit cd698edf5f99f4643ec79cf26542907c7979a83f) Co-authored-by: Tobias Ozór <[email protected]> M +17 -19 kcm/ui/main.qml https://invent.kde.org/plasma/discover/-/commit/57f898f74c8acb09e5a9e34ccdc44326ce008f19 diff --git a/kcm/ui/main.qml b/kcm/ui/main.qml index 2460878ec..9c1b95a1c 100644 --- a/kcm/ui/main.qml +++ b/kcm/ui/main.qml @@ -66,13 +66,16 @@ SimpleKCM { } QQC2.ComboBox { + id: frequencyComboBox Kirigami.FormData.label: kcm.updatesSettings.useUnattendedUpdates ? i18nc("@title:group", "Update frequency:") : i18nc("@title:group", "Notification frequency:") + textRole: "text" + valueRole: "value" readonly property var updatesFrequencyModel: [ - i18nc("@item:inlistbox", "Daily"), - i18nc("@item:inlistbox", "Weekly"), - i18nc("@item:inlistbox", "Monthly"), - i18nc("@item:inlistbox", "Never") + { text: i18nc("@item:inlistbox", "Daily"), value: 60 * 60 * 24 }, + { text: i18nc("@item:inlistbox", "Weekly"), value: 60 * 60 * 24 * 7 }, + { text: i18nc("@item:inlistbox", "Monthly"), value: 60 * 60 * 24 * 30 }, + { text: i18nc("@item:inlistbox", "Never"), value: -1 }, ] // Same as updatesFrequencyModel but without "Never" @@ -84,25 +87,20 @@ SimpleKCM { model: kcm.updatesSettings.useUnattendedUpdates ? unattendedUpdatesFrequencyModel : updatesFrequencyModel - readonly property var options: [ - 60 * 60 * 24, - 60 * 60 * 24 * 7, - 60 * 60 * 24 * 30, - -1 - ] + currentValue: kcm.updatesSettings.requiredNotificationInterval + onActivated: kcm.updatesSettings.requiredNotificationInterval = currentValue + + Connections { + target: kcm.updatesSettings - currentIndex: { - let index = -1 - for (const i in options) { - if (options[i] === kcm.updatesSettings.requiredNotificationInterval) { - index = i + function onUseUnattendedUpdatesChanged() { + if (kcm.updatesSettings.useUnattendedUpdates && + kcm.updatesSettings.requiredNotificationInterval === frequencyComboBox.updatesFrequencyModel[3].value) { + kcm.updatesSettings.requiredNotificationInterval = frequencyComboBox.updatesFrequencyModel[0].value } } - return index - } - onActivated: index => { - kcm.updatesSettings.requiredNotificationInterval = options[index] } + SettingStateProxy { id: settingState configObject: kcm.updatesSettings