File indexing completed on 2024-04-28 16:54:35

0001 /*
0002     SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@privat.broulik.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QSortFilterProxyModel>
0010 #include <QStringList>
0011 
0012 #include "notifications.h"
0013 
0014 namespace NotificationManager
0015 {
0016 class NotificationFilterProxyModel : public QSortFilterProxyModel
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit NotificationFilterProxyModel(QObject *parent = nullptr);
0022     ~NotificationFilterProxyModel() override;
0023 
0024     Notifications::Urgencies urgencies() const;
0025     void setUrgencies(Notifications::Urgencies urgencies);
0026 
0027     bool showExpired() const;
0028     void setShowExpired(bool show);
0029 
0030     bool showDismissed() const;
0031     void setShowDismissed(bool show);
0032 
0033     QStringList blacklistedDesktopEntries() const;
0034     void setBlackListedDesktopEntries(const QStringList &blacklist);
0035 
0036     QStringList blacklistedNotifyRcNames() const;
0037     void setBlacklistedNotifyRcNames(const QStringList &blacklist);
0038 
0039     QStringList whitelistedDesktopEntries() const;
0040     void setWhiteListedDesktopEntries(const QStringList &whitelist);
0041 
0042     QStringList whitelistedNotifyRcNames() const;
0043     void setWhitelistedNotifyRcNames(const QStringList &whitelist);
0044 
0045 Q_SIGNALS:
0046     void urgenciesChanged();
0047     void showExpiredChanged();
0048     void showDismissedChanged();
0049     void blacklistedDesktopEntriesChanged();
0050     void blacklistedNotifyRcNamesChanged();
0051     void whitelistedDesktopEntriesChanged();
0052     void whitelistedNotifyRcNamesChanged();
0053 
0054 protected:
0055     bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
0056 
0057 private:
0058     Notifications::Urgencies m_urgencies = Notifications::LowUrgency | Notifications::NormalUrgency | Notifications::CriticalUrgency;
0059     bool m_showDismissed = false;
0060     bool m_showExpired = false;
0061 
0062     QStringList m_blacklistedDesktopEntries;
0063     QStringList m_blacklistedNotifyRcNames;
0064 
0065     QStringList m_whitelistedDesktopEntries;
0066     QStringList m_whitelistedNotifyRcNames;
0067 };
0068 
0069 } // namespace NotificationManager