Commit 4280515e authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Notifications] For non-configurable applications use fake "@other" category

Allows to control the behavior of those applications rather than flat-out ignoring them.
Adjust default configuration to blacklist them, though.

Differential Revision: https://phabricator.kde.org/D26160
parent 9eb9a97c
......@@ -137,21 +137,22 @@ bool NotificationFilterProxyModel::filterAcceptsRow(int source_row, const QModel
return false;
}
// If the application isn't configurable in any way, it doesn't deserve to be in the history
// since there's no way for the user to get rid of it there.
if (expired && !sourceIdx.data(Notifications::ConfigurableRole).toBool()
// jobs are never configurable so this only applies to notifications
&& sourceIdx.data(Notifications::TypeRole).toInt() == Notifications::NotificationType) {
if (!m_showDismissed && sourceIdx.data(Notifications::DismissedRole).toBool()) {
return false;
}
if (!m_showDismissed && sourceIdx.data(Notifications::DismissedRole).toBool()) {
return false;
QString desktopEntry = sourceIdx.data(Notifications::DesktopEntryRole).toString();
if (desktopEntry.isEmpty()) {
// For non-configurable notifications use the fake "@other" category.
if (!sourceIdx.data(Notifications::ConfigurableRole).toBool()
// jobs are never configurable so this only applies to notifications
&& sourceIdx.data(Notifications::TypeRole).toInt() == Notifications::NotificationType) {
desktopEntry = QStringLiteral("@other");
}
}
// Blacklist takes precedence over whitelist, i.e. when in doubt don't show
if (!m_blacklistedDesktopEntries.isEmpty()) {
const QString desktopEntry = sourceIdx.data(Notifications::DesktopEntryRole).toString();
if (!desktopEntry.isEmpty() && m_blacklistedDesktopEntries.contains(desktopEntry)) {
return false;
}
......@@ -165,7 +166,6 @@ bool NotificationFilterProxyModel::filterAcceptsRow(int source_row, const QModel
}
if (!m_whitelistedDesktopEntries.isEmpty()) {
const QString desktopEntry = sourceIdx.data(Notifications::DesktopEntryRole).toString();
if (!desktopEntry.isEmpty() && m_whitelistedDesktopEntries.contains(desktopEntry)) {
return true;
}
......
......@@ -9,3 +9,8 @@ ShowInHistory=false
# Klipper notifications might contain sensitive information
[Applications][org.kde.klipper]
ShowInHistory=false
# Non-configurable applications don't deserve to be in history by default
[Applications][@other]
ShowInHistory=false
ShowBadges=false # wouldn't work anyway
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