7#include "notificationfilterproxymodel_p.h"
9using namespace NotificationManager;
11NotificationFilterProxyModel::NotificationFilterProxyModel(
QObject *parent)
14 setRecursiveFilteringEnabled(
true);
17NotificationFilterProxyModel::~NotificationFilterProxyModel() =
default;
19Notifications::Urgencies NotificationFilterProxyModel::urgencies()
const
24void NotificationFilterProxyModel::setUrgencies(Notifications::Urgencies urgencies)
26 if (m_urgencies != urgencies) {
27 m_urgencies = urgencies;
29 Q_EMIT urgenciesChanged();
33bool NotificationFilterProxyModel::showExpired()
const
38void NotificationFilterProxyModel::setShowExpired(
bool show)
40 if (m_showExpired != show) {
43 Q_EMIT showExpiredChanged();
47bool NotificationFilterProxyModel::showDismissed()
const
49 return m_showDismissed;
52void NotificationFilterProxyModel::setShowDismissed(
bool show)
54 if (m_showDismissed != show) {
55 m_showDismissed = show;
57 Q_EMIT showDismissedChanged();
61bool NotificationFilterProxyModel::showAddedDuringInhibition()
const
63 return m_showDismissed;
66void NotificationFilterProxyModel::setShowAddedDuringInhibition(
bool show)
68 if (m_showAddedDuringInhibition != show) {
69 m_showAddedDuringInhibition = show;
71 Q_EMIT showAddedDuringInhibitionChanged();
75QStringList NotificationFilterProxyModel::blacklistedDesktopEntries()
const
77 return m_blacklistedDesktopEntries;
80void NotificationFilterProxyModel::setBlackListedDesktopEntries(
const QStringList &blacklist)
82 if (m_blacklistedDesktopEntries != blacklist) {
83 m_blacklistedDesktopEntries = blacklist;
85 Q_EMIT blacklistedDesktopEntriesChanged();
89QStringList NotificationFilterProxyModel::blacklistedNotifyRcNames()
const
91 return m_blacklistedNotifyRcNames;
94void NotificationFilterProxyModel::setBlacklistedNotifyRcNames(
const QStringList &blacklist)
96 if (m_blacklistedNotifyRcNames != blacklist) {
97 m_blacklistedNotifyRcNames = blacklist;
99 Q_EMIT blacklistedNotifyRcNamesChanged();
103QStringList NotificationFilterProxyModel::whitelistedDesktopEntries()
const
105 return m_whitelistedDesktopEntries;
108void NotificationFilterProxyModel::setWhiteListedDesktopEntries(
const QStringList &whitelist)
110 if (m_whitelistedDesktopEntries != whitelist) {
111 m_whitelistedDesktopEntries = whitelist;
113 Q_EMIT whitelistedDesktopEntriesChanged();
117QStringList NotificationFilterProxyModel::whitelistedNotifyRcNames()
const
119 return m_whitelistedNotifyRcNames;
122void NotificationFilterProxyModel::setWhitelistedNotifyRcNames(
const QStringList &whitelist)
124 if (m_whitelistedNotifyRcNames != whitelist) {
125 m_whitelistedNotifyRcNames = whitelist;
127 Q_EMIT whitelistedNotifyRcNamesChanged();
131bool NotificationFilterProxyModel::filterAcceptsRow(
int source_row,
const QModelIndex &source_parent)
const
133 const QModelIndex sourceIdx = sourceModel()->index(source_row, 0, source_parent);
136 if (!m_showExpired && expired) {
150 desktopEntry = QStringLiteral(
"@other");
155 if (!m_blacklistedDesktopEntries.isEmpty()) {
156 if (!desktopEntry.
isEmpty() && m_blacklistedDesktopEntries.contains(desktopEntry)) {
161 if (!m_blacklistedNotifyRcNames.isEmpty()) {
163 if (!notifyRcName.
isEmpty() && m_blacklistedNotifyRcNames.contains(notifyRcName)) {
168 if (!m_whitelistedDesktopEntries.isEmpty()) {
169 if (!desktopEntry.
isEmpty() && m_whitelistedDesktopEntries.contains(desktopEntry)) {
174 if (!m_whitelistedNotifyRcNames.isEmpty()) {
176 if (!notifyRcName.
isEmpty() && m_whitelistedNotifyRcNames.contains(notifyRcName)) {
182 if (userActionFeedback) {
189 if (!m_urgencies.testFlag(urgency)) {
201#include "moc_notificationfilterproxymodel_p.cpp"
@ NotificationType
This item represents a notification.
Urgency
The notification urgency.
@ ConfigurableRole
Whether the notification can be configured because a desktopEntry or notifyRcName is known,...
@ NotifyRcNameRole
The notifyrc name (e.g. spectaclerc) of the application that sent the notification.
@ DismissedRole
The notification got temporarily hidden by the user but could still be interacted with.
@ DesktopEntryRole
The desktop entry (without .desktop suffix, e.g. org.kde.spectacle) of the application that sent the ...
@ WasAddedDuringInhibitionRole
Whether the notification was added while inhibition was active.
@ ExpiredRole
The notification timed out and closed. Actions on it cannot be invoked anymore.
@ UserActionFeedbackRole
Whether this notification is a response/confirmation to an explicit user action.
@ UrgencyRole
The notification urgency, either LowUrgency, NormalUrgency, or CriticalUrgency. Jobs do not have an u...
@ TypeRole
The type of model entry, either NotificationType or JobType.
QVariant data(int role) const const
bool isEmpty() const const
bool toBool() const const
int toInt(bool *ok) const const
QString toString() const const