Warning, /plasma/discover/kcm/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 import QtQuick 2.1 0008 import QtQuick.Layouts 1.1 0009 import QtQuick.Controls 2.3 as QQC2 0010 import org.kde.kirigami 2.14 as Kirigami 0011 import org.kde.kcmutils 0012 0013 SimpleKCM { 0014 id: root 0015 0016 ConfigModule.buttons: ConfigModule.Default | ConfigModule.Apply 0017 0018 QQC2.ButtonGroup { 0019 id: autoUpdatesGroup 0020 onCheckedButtonChanged: { 0021 kcm.updatesSettings.useUnattendedUpdates = automaticallyRadio.checked 0022 } 0023 } 0024 0025 QQC2.ButtonGroup { 0026 id: offlineUpdatesGroup 0027 onCheckedButtonChanged: { 0028 kcm.discoverSettings.useOfflineUpdates = offlineUpdatesOption.checked 0029 } 0030 } 0031 0032 implicitWidth: Kirigami.Units.gridUnit * 38 0033 implicitHeight: Kirigami.Units.gridUnit * 35 0034 0035 0036 Kirigami.FormLayout { 0037 width: parent.width 0038 0039 QQC2.RadioButton { 0040 Kirigami.FormData.label: i18n("Update software:") 0041 text: i18n("Manually") 0042 0043 QQC2.ButtonGroup.group: autoUpdatesGroup 0044 checked: !kcm.updatesSettings.useUnattendedUpdates 0045 } 0046 RowLayout { 0047 spacing: Kirigami.Units.smallSpacing 0048 0049 QQC2.RadioButton { 0050 id: automaticallyRadio 0051 text: i18n("Automatically") 0052 0053 QQC2.ButtonGroup.group: autoUpdatesGroup 0054 checked: kcm.updatesSettings.useUnattendedUpdates 0055 } 0056 0057 ContextualHelpButton { 0058 toolTipText: xi18nc("@info", "Software updates will be downloaded automatically when they become available. Updates for applications will be installed immediately, while system updates will be installed the next time the computer is restarted.") 0059 } 0060 } 0061 0062 SettingStateBinding { 0063 configObject: kcm.updatesSettings 0064 settingName: "useUnattendedUpdates" 0065 target: automaticallyRadio 0066 } 0067 0068 QQC2.ComboBox { 0069 Kirigami.FormData.label: kcm.updatesSettings.useUnattendedUpdates ? i18nc("@title:group", "Update frequency:") : i18nc("@title:group", "Notification frequency:") 0070 0071 readonly property var updatesFrequencyModel: [ 0072 i18nc("@item:inlistbox", "Daily"), 0073 i18nc("@item:inlistbox", "Weekly"), 0074 i18nc("@item:inlistbox", "Monthly"), 0075 i18nc("@item:inlistbox", "Never") 0076 ] 0077 0078 // Same as updatesFrequencyModel but without "Never" 0079 readonly property var unattendedUpdatesFrequencyModel: [ 0080 updatesFrequencyModel[0], 0081 updatesFrequencyModel[1], 0082 updatesFrequencyModel[2], 0083 ] 0084 0085 model: kcm.updatesSettings.useUnattendedUpdates ? unattendedUpdatesFrequencyModel : updatesFrequencyModel 0086 0087 readonly property var options: [ 0088 60 * 60 * 24, 0089 60 * 60 * 24 * 7, 0090 60 * 60 * 24 * 30, 0091 -1 0092 ] 0093 0094 currentIndex: { 0095 let index = -1 0096 for (const i in options) { 0097 if (options[i] === kcm.updatesSettings.requiredNotificationInterval) { 0098 index = i 0099 } 0100 } 0101 return index 0102 } 0103 onActivated: index => { 0104 kcm.updatesSettings.requiredNotificationInterval = options[index] 0105 } 0106 SettingStateProxy { 0107 id: settingState 0108 configObject: kcm.updatesSettings 0109 settingName: "requiredNotificationInterval" 0110 } 0111 } 0112 0113 Item { 0114 implicitHeight: Kirigami.Units.largeSpacing 0115 } 0116 0117 ColumnLayout { 0118 spacing: 0 0119 Kirigami.FormData.label: i18n("Apply system updates:") 0120 Kirigami.FormData.buddyFor: offlineUpdatesOption 0121 visible: !kcm.isRpmOstree 0122 enabled: !kcm.discoverSettings.isUseOfflineUpdatesImmutable 0123 0124 QQC2.RadioButton { 0125 id: offlineUpdatesOption 0126 text: i18nc("@option:radio part of the logical sentence 'Apply system updates after rebooting'", "After rebooting") 0127 0128 QQC2.ButtonGroup.group: offlineUpdatesGroup 0129 checked: kcm.discoverSettings.useOfflineUpdates 0130 } 0131 0132 QQC2.Label { 0133 text: i18nc("@label The thing being recommended is to use the 'apply updates when rebooting' setting", "Recommended to maximize system stability") 0134 leftPadding: offlineUpdatesOption.indicator.width 0135 font: Kirigami.Theme.smallFont 0136 } 0137 } 0138 0139 QQC2.RadioButton { 0140 text: i18nc("@option:radio part of the logical sentence 'Apply system updates immediately'", "Immediately") 0141 0142 QQC2.ButtonGroup.group: offlineUpdatesGroup 0143 enabled: !kcm.discoverSettings.isUseOfflineUpdatesImmutable 0144 checked: !kcm.discoverSettings.useOfflineUpdates 0145 } 0146 0147 SettingStateBinding { 0148 configObject: kcm.discoverSettings 0149 settingName: "useOfflineUpdates" 0150 target: offlineUpdatesOption 0151 } 0152 } 0153 }