Commit 41e27fa5 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Notifications KCM] Add "Other Applications" category

Settings in there will influence all non-identifyable applications.

Differential Revision: https://phabricator.kde.org/D26161
parent ae8732ed
...@@ -35,6 +35,8 @@ ColumnLayout { ...@@ -35,6 +35,8 @@ ColumnLayout {
property var rootIndex property var rootIndex
readonly property string otherAppsId: "@other"
readonly property string appDisplayName: kcm.sourcesModel.data(rootIndex, Qt.DisplayRole) || "" readonly property string appDisplayName: kcm.sourcesModel.data(rootIndex, Qt.DisplayRole) || ""
readonly property string appIconName: kcm.sourcesModel.data(rootIndex, Qt.DecorationRole) || "" readonly property string appIconName: kcm.sourcesModel.data(rootIndex, Qt.DecorationRole) || ""
readonly property string desktopEntry: kcm.sourcesModel.data(rootIndex, Private.SourcesModel.DesktopEntryRole) || "" readonly property string desktopEntry: kcm.sourcesModel.data(rootIndex, Private.SourcesModel.DesktopEntryRole) || ""
...@@ -117,13 +119,14 @@ ColumnLayout { ...@@ -117,13 +119,14 @@ ColumnLayout {
QtControls.CheckBox { QtControls.CheckBox {
text: i18n("Show notification badges") text: i18n("Show notification badges")
enabled: !!configColumn.desktopEntry enabled: !!configColumn.desktopEntry && configColumn.desktopEntry !== configColumn.otherAppsId
checked: configColumn.behavior & NotificationManager.Settings.ShowBadges checked: configColumn.behavior & NotificationManager.Settings.ShowBadges
onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowBadges, checked) onClicked: configColumn.setBehavior(NotificationManager.Settings.ShowBadges, checked)
} }
Kirigami.Separator { Kirigami.Separator {
Kirigami.FormData.isSection: true Kirigami.FormData.isSection: true
visible: configureEventsButton.visible || noEventsLabel.visible
} }
QtControls.Button { QtControls.Button {
...@@ -136,11 +139,12 @@ ColumnLayout { ...@@ -136,11 +139,12 @@ ColumnLayout {
} }
QtControls.Label { QtControls.Label {
id: noEventsLabel
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: form.implicitWidth Layout.preferredWidth: form.implicitWidth
text: i18n("This application does not support configuring notifications on a per-event basis."); text: i18n("This application does not support configuring notifications on a per-event basis.");
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: !configColumn.notifyRcName visible: !configColumn.notifyRcName && configColumn.desktopEntry !== configColumn.otherAppsId
} }
// compact layout // compact layout
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <KConfig> #include <KConfig>
#include <KConfigGroup> #include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig> #include <KSharedConfig>
#include <KService> #include <KService>
#include <KServiceTypeTrader> #include <KServiceTypeTrader>
...@@ -346,6 +347,17 @@ void SourcesModel::load() ...@@ -346,6 +347,17 @@ void SourcesModel::load()
}; };
std::sort(appsData.begin(), appsData.end(), sortData); std::sort(appsData.begin(), appsData.end(), sortData);
// Fake entry for configuring non-identifyable applications
appsData << SourceData{
i18n("Other Applications"),
{},
QStringLiteral("applications-other"),
QString(),
QStringLiteral("@other"),
{}
};
std::sort(servicesData.begin(), servicesData.end(), sortData); std::sort(servicesData.begin(), servicesData.end(), sortData);
m_data << appsData << servicesData; m_data << appsData << servicesData;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment