Plasma-workspace
notifications.cpp
169 connect(filterModel, &NotificationFilterProxyModel::urgenciesChanged, q, &Notifications::urgenciesChanged);
170 connect(filterModel, &NotificationFilterProxyModel::showExpiredChanged, q, &Notifications::showExpiredChanged);
171 connect(filterModel, &NotificationFilterProxyModel::showDismissedChanged, q, &Notifications::showDismissedChanged);
172 connect(filterModel, &NotificationFilterProxyModel::showAddedDuringInhibitionChanged, q, &Notifications::showAddedDuringInhibitionChanged);
173 connect(filterModel, &NotificationFilterProxyModel::blacklistedDesktopEntriesChanged, q, &Notifications::blacklistedDesktopEntriesChanged);
174 connect(filterModel, &NotificationFilterProxyModel::blacklistedNotifyRcNamesChanged, q, &Notifications::blacklistedNotifyRcNamesChanged);
184 connect(filterModel, &QAbstractItemModel::dataChanged, q, [this](const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList<int> &roles) {
187 if (roles.isEmpty() || roles.contains(Notifications::UpdatedRole) || roles.contains(Notifications::ExpiredRole)
188 || roles.contains(Notifications::JobStateRole) || roles.contains(Notifications::PercentageRole) || roles.contains(Notifications::ReadRole)) {
196 connect(sortModel, &NotificationSortProxyModel::sortModeChanged, q, &Notifications::sortModeChanged);
197 connect(sortModel, &NotificationSortProxyModel::sortOrderChanged, q, &Notifications::sortOrderChanged);
202 connect(limiterModel, &LimitedRowCountProxyModel::limitChanged, q, &Notifications::limitChanged);
252 if (idx.data(Notifications::ExpiredRole).toBool() || idx.data(Notifications::WasAddedDuringInhibitionRole).toBool()) {
460 qCWarning(NOTIFICATIONMANAGER) << "Setting window before initialising the model" << this << window;
743void Notifications::invokeAction(const QModelIndex &idx, const QString &actionId, InvokeBehavior behavior)
834 if (!idx.data(Notifications::ReadRole).toBool() && idx.data(Notifications::WasAddedDuringInhibitionRole).toBool()) {
845 i18nc("@info", "%1 notifications were received while Do Not Disturb was active.", QString::number(inhibited)),
866bool Notifications::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
static KNotification * event(const QString &eventId, const QString &text=QString(), const QPixmap &pixmap=QPixmap(), const NotificationFlags &flags=CloseOnTimeout, const QString &componentName=QString())
CloseOnTimeout
Q_INVOKABLE void expire(const QModelIndex &idx)
Expire a notification.
Definition notifications.cpp:669
QStringList whitelistedDesktopEntries
A list of desktop entries for which notifications should be shown.
Definition notifications.h:99
Q_INVOKABLE void invokeAction(const QModelIndex &idx, const QString &actionId, InvokeBehavior=None)
Invoke a notification action.
Definition notifications.cpp:743
QStringList blacklistedNotifyRcNames
A list of notifyrc names for which no notifications should be shown.
Definition notifications.h:87
int unreadNotificationsCount
The number of notifications added since lastRead.
Definition notifications.h:205
bool expandUnread
Whether to automatically show notifications that are unread.
Definition notifications.h:176
Q_INVOKABLE void configure(const QModelIndex &idx)
Configure a notification.
Definition notifications.cpp:718
Q_INVOKABLE void invokeDefaultAction(const QModelIndex &idx, InvokeBehavior behavior=None)
Invoke the default notification action.
Definition notifications.cpp:736
Q_INVOKABLE void stopTimeout(const QModelIndex &idx)
Stop the automatic timeout of notifications.
Definition notifications.cpp:769
Q_INVOKABLE QPersistentModelIndex makePersistentModelIndex(const QModelIndex &idx) const
Convert the given QModelIndex into a QPersistentModelIndex.
Definition notifications.cpp:664
Urgencies urgencies
The notification urgency types the model should contain.
Definition notifications.h:132
Q_INVOKABLE void showInhibitionSummary()
Shows a notification to report the number of unread inhibited notifications.
Definition notifications.cpp:829
QStringList whitelistedNotifyRcNames
A list of notifyrc names for which notifications should be shown.
Definition notifications.h:111
bool showAddedDuringInhibition
Whether to show notifications added during inhibition.
Definition notifications.h:71
@ JobStateStopped
The job is stopped. It has either finished (error is 0) or failed (error is not 0)
Definition notifications.h:342
QML_ELEMENTint limit
The number of notifications the model should at most contain.
Definition notifications.h:40
Q_INVOKABLE void reply(const QModelIndex &idx, const QString &text, InvokeBehavior behavior)
Reply to a notification.
Definition notifications.cpp:750
@ UpdatedRole
When the notification was last updated, invalid when it hasn't been updated.
Definition notifications.h:242
@ NotifyRcNameRole
The notifyrc name (e.g. spectaclerc) of the application that sent the notification.
Definition notifications.h:249
@ JobStateRole
The state of the job, either JobStateJopped, JobStateSuspended, or JobStateRunning.
Definition notifications.h:257
@ IdRole
A notification identifier. This can be uint notification ID or string application job source.
Definition notifications.h:230
@ DesktopEntryRole
The desktop entry (without .desktop suffix, e.g. org.kde.spectacle) of the application that sent the ...
Definition notifications.h:248
@ WasAddedDuringInhibitionRole
Whether the notification was added while inhibition was active.
Definition notifications.h:298
@ ExpiredRole
The notification timed out and closed. Actions on it cannot be invoked anymore.
Definition notifications.h:280
@ ClosableRole
Whether the item can be closed. Notifications are always closable, jobs are only when in JobStateStop...
Definition notifications.h:278
@ TypeRole
The type of model entry, either NotificationType or JobType.
Definition notifications.h:240
@ PercentageRole
The percentage of the job. Use jobsPercentage to get a global percentage for all jobs.
Definition notifications.h:258
QDateTime lastRead
The time when the user last could read the notifications.
Definition notifications.h:198
Q_INVOKABLE void startTimeout(const QModelIndex &idx)
Start automatic timeout of notifications.
Definition notifications.cpp:757
QStringList blacklistedDesktopEntries
A list of desktop entries for which no notifications should be shown.
Definition notifications.h:79
Q_INVOKABLE QModelIndex groupIndex(const QModelIndex &idx) const
Returns a model index pointing to the group of a notification.
Definition notifications.cpp:807
QString i18nc(const char *context, const char *text, const TYPE &arg...)
const FMH::MODEL filterModel(const MODEL &model, const QVector< MODEL_KEY > &keys)
QVariant read(const QByteArray &data, int versionOverride=0)
QAbstractItemModel(QObject *parent)
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles)
virtual QModelIndex parent(const QModelIndex &index) const const=0
void rowsInserted(const QModelIndex &parent, int first, int last)
void rowsRemoved(const QModelIndex &parent, int first, int last)
QDateTime currentDateTimeUtc()
bool isValid() const const
bool contains(const AT &value) const const
bool isEmpty() const const
bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret)
QVariant data(int role) const const
bool isValid() const const
const QAbstractItemModel * model() const const
QModelIndex parent() const const
QObject(QObject *parent)
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
T qobject_cast(QObject *object)
QSortFilterProxyModel(QObject *parent)
virtual QVariant data(const QModelIndex &index, int role) const const override
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const const
virtual Qt::ItemFlags flags(const QModelIndex &index) const const override
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const const
virtual int rowCount(const QModelIndex &parent) const const override
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override
QString number(double n, char format, int precision)
QueuedConnection
SortOrder
bool toBool() const const
QDateTime toDateTime() const const
int toInt(bool *ok) const const
QString toString() const const
uint toUInt(bool *ok) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:57:53 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:57:53 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.