Changeset View
Changeset View
Standalone View
Standalone View
kcms/notifications/package/contents/ui/ApplicationConfiguration.qml
Show All 29 Lines | |||||
30 | 30 | | |||
31 | import org.kde.private.kcms.notifications 1.0 as Private | 31 | import org.kde.private.kcms.notifications 1.0 as Private | ||
32 | 32 | | |||
33 | ColumnLayout { | 33 | ColumnLayout { | ||
34 | id: configColumn | 34 | id: configColumn | ||
35 | 35 | | |||
36 | property var rootIndex | 36 | property var rootIndex | ||
37 | 37 | | |||
38 | readonly property string otherAppsId: "@other" | ||||
39 | | ||||
38 | readonly property string appDisplayName: kcm.sourcesModel.data(rootIndex, Qt.DisplayRole) || "" | 40 | readonly property string appDisplayName: kcm.sourcesModel.data(rootIndex, Qt.DisplayRole) || "" | ||
39 | readonly property string appIconName: kcm.sourcesModel.data(rootIndex, Qt.DecorationRole) || "" | 41 | readonly property string appIconName: kcm.sourcesModel.data(rootIndex, Qt.DecorationRole) || "" | ||
40 | readonly property string desktopEntry: kcm.sourcesModel.data(rootIndex, Private.SourcesModel.DesktopEntryRole) || "" | 42 | readonly property string desktopEntry: kcm.sourcesModel.data(rootIndex, Private.SourcesModel.DesktopEntryRole) || "" | ||
41 | readonly property string notifyRcName: kcm.sourcesModel.data(rootIndex, Private.SourcesModel.NotifyRcNameRole) || "" | 43 | readonly property string notifyRcName: kcm.sourcesModel.data(rootIndex, Private.SourcesModel.NotifyRcNameRole) || "" | ||
42 | 44 | | |||
43 | property int behavior: { | 45 | property int behavior: { | ||
44 | if (configColumn.desktopEntry) { | 46 | if (configColumn.desktopEntry) { | ||
45 | return kcm.settings.applicationBehavior(configColumn.desktopEntry); | 47 | return kcm.settings.applicationBehavior(configColumn.desktopEntry); | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 75 | Kirigami.FormLayout { | |||
112 | QtControls.CheckBox { | 114 | QtControls.CheckBox { | ||
113 | text: i18n("Show in history") | 115 | text: i18n("Show in history") | ||
114 | checked: configColumn.behavior & NotificationManager.Settings.ShowInHistory | 116 | checked: configColumn.behavior & NotificationManager.Settings.ShowInHistory | ||
115 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowInHistory, checked) | 117 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowInHistory, checked) | ||
116 | } | 118 | } | ||
117 | 119 | | |||
118 | QtControls.CheckBox { | 120 | QtControls.CheckBox { | ||
119 | text: i18n("Show notification badges") | 121 | text: i18n("Show notification badges") | ||
120 | enabled: !!configColumn.desktopEntry | 122 | enabled: !!configColumn.desktopEntry && configColumn.desktopEntry !== configColumn.otherAppsId | ||
121 | checked: configColumn.behavior & NotificationManager.Settings.ShowBadges | 123 | checked: configColumn.behavior & NotificationManager.Settings.ShowBadges | ||
122 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowBadges, checked) | 124 | onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowBadges, checked) | ||
123 | } | 125 | } | ||
124 | 126 | | |||
125 | Kirigami.Separator { | 127 | Kirigami.Separator { | ||
126 | Kirigami.FormData.isSection: true | 128 | Kirigami.FormData.isSection: true | ||
129 | visible: configureEventsButton.visible || noEventsLabel.visible | ||||
127 | } | 130 | } | ||
128 | 131 | | |||
129 | QtControls.Button { | 132 | QtControls.Button { | ||
130 | id: configureEventsButton | 133 | id: configureEventsButton | ||
131 | text: i18n("Configure Events...") | 134 | text: i18n("Configure Events...") | ||
132 | icon.name: "preferences-desktop-notification" | 135 | icon.name: "preferences-desktop-notification" | ||
133 | visible: !!configColumn.notifyRcName | 136 | visible: !!configColumn.notifyRcName | ||
134 | onClicked: configColumn.configureEvents() | 137 | onClicked: configColumn.configureEvents() | ||
135 | } | 138 | } | ||
136 | } | 139 | } | ||
137 | 140 | | |||
138 | QtControls.Label { | 141 | QtControls.Label { | ||
142 | id: noEventsLabel | ||||
139 | Layout.alignment: Qt.AlignHCenter | 143 | Layout.alignment: Qt.AlignHCenter | ||
140 | Layout.preferredWidth: form.implicitWidth | 144 | Layout.preferredWidth: form.implicitWidth | ||
141 | text: i18n("This application does not support configuring notifications on a per-event basis."); | 145 | text: i18n("This application does not support configuring notifications on a per-event basis."); | ||
142 | wrapMode: Text.WordWrap | 146 | wrapMode: Text.WordWrap | ||
143 | visible: !configColumn.notifyRcName | 147 | visible: !configColumn.notifyRcName && configColumn.desktopEntry !== configColumn.otherAppsId | ||
144 | } | 148 | } | ||
145 | 149 | | |||
146 | // compact layout | 150 | // compact layout | ||
147 | Item { | 151 | Item { | ||
148 | Layout.fillHeight: true | 152 | Layout.fillHeight: true | ||
149 | } | 153 | } | ||
150 | } | 154 | } |