Changeset View
Changeset View
Standalone View
Standalone View
kcms/notifications/package/contents/ui/ApplicationConfiguration.qml
Show All 36 Lines | 33 | ColumnLayout { | |||
---|---|---|---|---|---|
37 | 37 | | |||
38 | readonly property string otherAppsId: "@other" | 38 | readonly property string otherAppsId: "@other" | ||
39 | 39 | | |||
40 | readonly property string appDisplayName: rootIndex ? kcm.sourcesModel.data(rootIndex, Qt.DisplayRole) || "" : "" | 40 | readonly property string appDisplayName: rootIndex ? kcm.sourcesModel.data(rootIndex, Qt.DisplayRole) || "" : "" | ||
41 | readonly property string appIconName: rootIndex ? kcm.sourcesModel.data(rootIndex, Qt.DecorationRole) || "" : "" | 41 | readonly property string appIconName: rootIndex ? kcm.sourcesModel.data(rootIndex, Qt.DecorationRole) || "" : "" | ||
42 | readonly property string desktopEntry: rootIndex ? kcm.sourcesModel.data(rootIndex, Private.SourcesModel.DesktopEntryRole) || "" : "" | 42 | readonly property string desktopEntry: rootIndex ? kcm.sourcesModel.data(rootIndex, Private.SourcesModel.DesktopEntryRole) || "" : "" | ||
43 | readonly property string notifyRcName: rootIndex ? kcm.sourcesModel.data(rootIndex, Private.SourcesModel.NotifyRcNameRole) || "" : "" | 43 | readonly property string notifyRcName: rootIndex ? kcm.sourcesModel.data(rootIndex, Private.SourcesModel.NotifyRcNameRole) || "" : "" | ||
44 | 44 | | |||
45 | function behavior() { | 45 | onAppDisplayNameChanged: { | ||
46 | if (configColumn.desktopEntry) { | 46 | if (desktopEntry !== "") { | ||
47 | return kcm.settings.applicationBehavior(configColumn.desktopEntry); | 47 | kcm.setBehaviorSettingsToLoad(desktopEntry) | ||
broulik: I've seen duplicate apps in this list, e.g. snap vs properly installed, so I don't think you… | |||||
I guess I could use rootIndex instead, and it will solve the issue you mention below as well. crossi: I guess I could use `rootIndex` instead, and it will solve the issue you mention below as well. | |||||
While we generally do RDN for desktop entries these days I belive there can be cases where there's no telling if it's a desktop entry or notfiyrc? So we would need to pass that in broulik: While we generally do RDN for desktop entries these days I belive there can be cases where… | |||||
48 | } else if (configColumn.notifyRcName) { | | |||
49 | return kcm.settings.serviceBehavior(configColumn.notifyRcName); | | |||
50 | } | | |||
51 | return -1; | | |||
52 | } | | |||
53 | | ||||
54 | function setBehavior(flag, enable) { | | |||
55 | var newBehavior = behavior(); | | |||
56 | if (enable) { | | |||
57 | newBehavior |= flag; | | |||
58 | } else { | 48 | } else { | ||
59 | newBehavior &= ~flag; | 49 | kcm.setBehaviorSettingsToLoad(notifyRcName) | ||
60 | } | | |||
61 | | ||||
62 | if (configColumn.desktopEntry) { | | |||
63 | return kcm.settings.setApplicationBehavior(configColumn.desktopEntry, newBehavior); | | |||
64 | } else if (configColumn.notifyRcName) { | | |||
65 | return kcm.settings.setServiceBehavior(configColumn.notifyRcName, newBehavior); | | |||
66 | } | 50 | } | ||
67 | } | 51 | } | ||
broulik: Can we swap that around to be "isOtherApp" | |||||
68 | 52 | | |||
69 | function configureEvents(eventId) { | 53 | function configureEvents(eventId) { | ||
70 | kcm.configureEvents(configColumn.notifyRcName, eventId, this) | 54 | kcm.configureEvents(configColumn.notifyRcName, eventId, this) | ||
71 | } | 55 | } | ||
72 | 56 | | |||
73 | spacing: Kirigami.Units.smallSpacing | 57 | spacing: Kirigami.Units.smallSpacing | ||
74 | 58 | | |||
75 | Kirigami.FormLayout { | 59 | Kirigami.FormLayout { | ||
Show All 15 Lines | 72 | Kirigami.Heading { | |||
91 | elide: Text.ElideRight | 75 | elide: Text.ElideRight | ||
92 | textFormat: Text.PlainText | 76 | textFormat: Text.PlainText | ||
93 | } | 77 | } | ||
94 | } | 78 | } | ||
95 | 79 | | |||
96 | QtControls.CheckBox { | 80 | QtControls.CheckBox { | ||
97 | id: showPopupsCheck | 81 | id: showPopupsCheck | ||
98 | text: i18n("Show popups") | 82 | text: i18n("Show popups") | ||
99 | checked: configColumn.behavior() & NotificationManager.Settings.ShowPopups | 83 | enabled: !kcm.behaviorSettings.isImmutable("ShowPopups") | ||
100 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowPopups, checked) | 84 | checked: kcm.behaviorSettings.showPopups | ||
85 | onClicked: kcm.behaviorSettings.showPopups = checked | ||||
101 | } | 86 | } | ||
102 | 87 | | |||
103 | RowLayout { // just for indentation | 88 | RowLayout { // just for indentation | ||
104 | QtControls.CheckBox { | 89 | QtControls.CheckBox { | ||
105 | Layout.leftMargin: mirrored ? 0 : indicator.width | 90 | Layout.leftMargin: mirrored ? 0 : indicator.width | ||
106 | Layout.rightMargin: mirrored ? indicator.width : 0 | 91 | Layout.rightMargin: mirrored ? indicator.width : 0 | ||
107 | text: i18n("Show in do not disturb mode") | 92 | text: i18n("Show in do not disturb mode") | ||
108 | enabled: showPopupsCheck.checked | 93 | enabled: showPopupsCheck.checked && !kcm.behaviorSettings.isImmutable("ShowPopupsInDndMode") | ||
109 | checked: configColumn.behavior() & NotificationManager.Settings.ShowPopupsInDoNotDisturbMode | 94 | checked: kcm.behaviorSettings.showPopupsInDndMode | ||
110 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowPopupsInDoNotDisturbMode, checked) | 95 | onClicked: kcm.behaviorSettings.showPopupsInDndMode = checked | ||
111 | } | 96 | } | ||
112 | } | 97 | } | ||
113 | 98 | | |||
114 | QtControls.CheckBox { | 99 | QtControls.CheckBox { | ||
115 | text: i18n("Show in history") | 100 | text: i18n("Show in history") | ||
116 | checked: configColumn.behavior() & NotificationManager.Settings.ShowInHistory | 101 | enabled: !kcm.behaviorSettings.isImmutable("ShowInHistory") | ||
117 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowInHistory, checked) | 102 | checked: kcm.behaviorSettings.showInHistory | ||
103 | onClicked: kcm.behaviorSettings.showInHistory = checked | ||||
118 | } | 104 | } | ||
119 | 105 | | |||
120 | QtControls.CheckBox { | 106 | QtControls.CheckBox { | ||
121 | text: i18n("Show notification badges") | 107 | text: i18n("Show notification badges") | ||
122 | enabled: !!configColumn.desktopEntry && configColumn.desktopEntry !== configColumn.otherAppsId | 108 | enabled: !!configColumn.desktopEntry && configColumn.desktopEntry !== configColumn.otherAppsId && !kcm.behaviorSettings.isImmutable("ShowBadges") | ||
123 | checked: configColumn.behavior() & NotificationManager.Settings.ShowBadges | 109 | checked: kcm.behaviorSettings.showBadges | ||
124 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowBadges, checked) | 110 | onClicked: kcm.behaviorSettings.showBadges = checked | ||
125 | } | 111 | } | ||
126 | 112 | | |||
127 | Kirigami.Separator { | 113 | Kirigami.Separator { | ||
128 | Kirigami.FormData.isSection: true | 114 | Kirigami.FormData.isSection: true | ||
129 | visible: configureEventsButton.visible || noEventsLabel.visible | 115 | visible: configureEventsButton.visible || noEventsLabel.visible | ||
130 | } | 116 | } | ||
131 | 117 | | |||
132 | QtControls.Button { | 118 | QtControls.Button { | ||
Show All 22 Lines |
I've seen duplicate apps in this list, e.g. snap vs properly installed, so I don't think you can rely on this.