NotificationManager::Notifications

Search for usage in LXR

NotificationManager::Notifications Class Reference

#include <notifications.h>

Inheritance diagram for NotificationManager::Notifications:

Public Types

enum  ClearFlag { ClearExpired = 1 << 1 }
 
typedef QFlags< ClearFlagClearFlags
 
enum  GroupMode { GroupDisabled = 0, GroupApplicationsFlat }
 
enum  InvokeBehavior { None = 0, Close = 1 }
 
typedef QFlags< InvokeBehavior > InvokeBehaviors
 
enum  JobState { JobStateStopped, JobStateRunning, JobStateSuspended }
 
enum  Roles {
  IdRole = Qt::UserRole + 1, SummaryRole = Qt::DisplayRole, ImageRole = Qt::DecorationRole, IsGroupRole = Qt::UserRole + 2,
  GroupChildrenCountRole, ExpandedGroupChildrenCountRole, IsGroupExpandedRole, IsInGroupRole,
  TypeRole, CreatedRole, UpdatedRole, BodyRole,
  IconNameRole, DesktopEntryRole, NotifyRcNameRole, ApplicationNameRole,
  ApplicationIconNameRole, OriginNameRole, JobStateRole, PercentageRole,
  JobErrorRole, SuspendableRole, KillableRole, JobDetailsRole,
  ActionNamesRole, ActionLabelsRole, HasDefaultActionRole, DefaultActionLabelRole,
  UrlsRole, UrgencyRole, TimeoutRole, ConfigurableRole,
  ConfigureActionLabelRole, ClosableRole, ExpiredRole, DismissedRole,
  ReadRole, UserActionFeedbackRole, HasReplyActionRole, ReplyActionLabelRole,
  ReplyPlaceholderTextRole, ReplySubmitButtonTextRole, ReplySubmitButtonIconNameRole, CategoryRole,
  ResidentRole, TransientRole
}
 
enum  SortMode { SortByDate = 0, SortByTypeAndUrgency }
 
enum  Type { NoType, NotificationType, JobType }
 
typedef QFlags< UrgencyUrgencies
 
enum  Urgency { LowUrgency = 1 << 0, NormalUrgency = 1 << 1, CriticalUrgency = 1 << 2 }
 
- Public Types inherited from QAbstractItemModel
enum  CheckIndexOption
 
enum  LayoutChangeHint
 

Properties

int activeJobsCount
 
int activeNotificationsCount
 
QStringList blacklistedDesktopEntries
 
QStringList blacklistedNotifyRcNames
 
int count
 
bool expandUnread
 
int expiredNotificationsCount
 
int groupLimit
 
GroupMode groupMode
 
int jobsPercentage
 
QDateTime lastRead
 
int limit
 
bool showDismissed
 
bool showExpired
 
bool showJobs
 
bool showNotifications
 
SortMode sortMode
 
Qt::SortOrder sortOrder
 
int unreadNotificationsCount
 
Urgencies urgencies
 
QStringList whitelistedDesktopEntries
 
QStringList whitelistedNotifyRcNames
 
- Properties inherited from QSortFilterProxyModel
 dynamicSortFilter
 
 filterCaseSensitivity
 
 filterKeyColumn
 
 filterRegExp
 
 filterRegularExpression
 
 filterRole
 
 isSortLocaleAware
 
 recursiveFilteringEnabled
 
 sortCaseSensitivity
 
 sortRole
 
- Properties inherited from QAbstractProxyModel
 sourceModel
 
- Properties inherited from QObject
 objectName
 

Signals

void activeJobsCountChanged ()
 
void activeNotificationsCountChanged ()
 
void blacklistedDesktopEntriesChanged ()
 
void blacklistedNotifyRcNamesChanged ()
 
void countChanged ()
 
void expandUnreadChanged ()
 
void expiredNotificationsCountChanged ()
 
void groupLimitChanged ()
 
void groupModeChanged ()
 
void jobsPercentageChanged ()
 
void lastReadChanged ()
 
void limitChanged ()
 
void showDismissedChanged ()
 
void showExpiredChanged ()
 
void showJobsChanged ()
 
void showNotificationsChanged ()
 
void sortModeChanged ()
 
void sortOrderChanged ()
 
void unreadNotificationsCountChanged ()
 
void urgenciesChanged ()
 
void whitelistedDesktopEntriesChanged ()
 
void whitelistedNotifyRcNamesChanged ()
 

Public Member Functions

 Notifications (QObject *parent=nullptr)
 
int activeJobsCount () const
 
int activeNotificationsCount () const
 
QStringList blacklistedDesktopEntries () const
 
QStringList blacklistedNotifyRcNames () const
 
Q_INVOKABLE void clear (ClearFlags flags)
 
Q_INVOKABLE void close (const QModelIndex &idx)
 
Q_INVOKABLE void collapseAllGroups ()
 
Q_INVOKABLE void configure (const QModelIndex &idx)
 
int count () const
 
QVariant data (const QModelIndex &index, int role) const override
 
bool expandUnread () const
 
Q_INVOKABLE void expire (const QModelIndex &idx)
 
int expiredNotificationsCount () const
 
bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override
 
Q_INVOKABLE QModelIndex groupIndex (const QModelIndex &idx) const
 
int groupLimit () const
 
GroupMode groupMode () const
 
Q_INVOKABLE void invokeAction (const QModelIndex &idx, const QString &actionId, InvokeBehavior=None)
 
Q_INVOKABLE void invokeDefaultAction (const QModelIndex &idx, InvokeBehavior behavior=None)
 
int jobsPercentage () const
 
Q_INVOKABLE void killJob (const QModelIndex &idx)
 
QDateTime lastRead () const
 
bool lessThan (const QModelIndex &source_left, const QModelIndex &source_right) const override
 
int limit () const
 
Q_INVOKABLE QPersistentModelIndex makePersistentModelIndex (const QModelIndex &idx) const
 
Q_INVOKABLE void reply (const QModelIndex &idx, const QString &text, InvokeBehavior behavior)
 
void resetLastRead ()
 
Q_INVOKABLE void resumeJob (const QModelIndex &idx)
 
QHash< int, QByteArrayroleNames () const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void setBlacklistedDesktopEntries (const QStringList &blacklist)
 
void setBlacklistedNotifyRcNames (const QStringList &blacklist)
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 
void setExpandUnread (bool expand)
 
void setGroupLimit (int limit)
 
void setGroupMode (GroupMode groupMode)
 
void setLastRead (const QDateTime &lastRead)
 
void setLimit (int limit)
 
void setShowDismissed (bool show)
 
void setShowExpired (bool show)
 
void setShowJobs (bool showJobs)
 
void setShowNotifications (bool showNotifications)
 
void setSortMode (SortMode sortMode)
 
void setSortOrder (Qt::SortOrder sortOrder)
 
void setUrgencies (Urgencies urgencies)
 
void setWhitelistedDesktopEntries (const QStringList &whitelist)
 
void setWhitelistedNotifyRcNames (const QStringList &whitelist)
 
bool showDismissed () const
 
bool showExpired () const
 
bool showJobs () const
 
bool showNotifications () const
 
SortMode sortMode () const
 
Qt::SortOrder sortOrder () const
 
Q_INVOKABLE void startTimeout (const QModelIndex &idx)
 
Q_INVOKABLE void startTimeout (uint notificationId)
 
Q_INVOKABLE void stopTimeout (const QModelIndex &idx)
 
Q_INVOKABLE void suspendJob (const QModelIndex &idx)
 
int unreadNotificationsCount () const
 
Urgencies urgencies () const
 
QStringList whitelistedDesktopEntries () const
 
QStringList whitelistedNotifyRcNames () const
 
- Public Member Functions inherited from QSortFilterProxyModel
 QSortFilterProxyModel (QObject *parent)
 
virtual QModelIndex buddy (const QModelIndex &index) const const override
 
virtual bool canFetchMore (const QModelIndex &parent) const const override
 
void clear ()
 
virtual int columnCount (const QModelIndex &parent) const const override
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 
bool dynamicSortFilter () const const
 
virtual void fetchMore (const QModelIndex &parent) override
 
Qt::CaseSensitivity filterCaseSensitivity () const const
 
void filterCaseSensitivityChanged (Qt::CaseSensitivity filterCaseSensitivity)
 
int filterKeyColumn () const const
 
QRegExp filterRegExp () const const
 
QRegularExpression filterRegularExpression () const const
 
int filterRole () const const
 
void filterRoleChanged (int filterRole)
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const const override
 
virtual bool hasChildren (const QModelIndex &parent) const const override
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role) const const override
 
virtual QModelIndex index (int row, int column, const QModelIndex &parent) const const override
 
virtual bool insertColumns (int column, int count, const QModelIndex &parent) override
 
virtual bool insertRows (int row, int count, const QModelIndex &parent) override
 
void invalidate ()
 
bool isRecursiveFilteringEnabled () const const
 
bool isSortLocaleAware () const const
 
virtual QModelIndex mapFromSource (const QModelIndex &sourceIndex) const const override
 
virtual QItemSelection mapSelectionFromSource (const QItemSelection &sourceSelection) const const override
 
virtual QItemSelection mapSelectionToSource (const QItemSelection &proxySelection) const const override
 
virtual QModelIndex mapToSource (const QModelIndex &proxyIndex) const const override
 
virtual QModelIndexList match (const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const const override
 
virtual QMimeDatamimeData (const QModelIndexList &indexes) const const override
 
virtual QStringList mimeTypes () const const override
 
virtual QModelIndex parent (const QModelIndex &child) const const override
 
void recursiveFilteringEnabledChanged (bool recursiveFilteringEnabled)
 
virtual bool removeColumns (int column, int count, const QModelIndex &parent) override
 
virtual bool removeRows (int row, int count, const QModelIndex &parent) override
 
void setDynamicSortFilter (bool enable)
 
void setFilterCaseSensitivity (Qt::CaseSensitivity cs)
 
void setFilterFixedString (const QString &pattern)
 
void setFilterKeyColumn (int column)
 
void setFilterRegExp (const QRegExp &regExp)
 
void setFilterRegExp (const QString &pattern)
 
void setFilterRegularExpression (const QRegularExpression &regularExpression)
 
void setFilterRegularExpression (const QString &pattern)
 
void setFilterRole (int role)
 
void setFilterWildcard (const QString &pattern)
 
virtual bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role) override
 
void setRecursiveFilteringEnabled (bool recursive)
 
void setSortCaseSensitivity (Qt::CaseSensitivity cs)
 
void setSortLocaleAware (bool on)
 
void setSortRole (int role)
 
virtual void setSourceModel (QAbstractItemModel *sourceModel) override
 
virtual QModelIndex sibling (int row, int column, const QModelIndex &idx) const const override
 
virtual void sort (int column, Qt::SortOrder order) override
 
Qt::CaseSensitivity sortCaseSensitivity () const const
 
void sortCaseSensitivityChanged (Qt::CaseSensitivity sortCaseSensitivity)
 
int sortColumn () const const
 
void sortLocaleAwareChanged (bool sortLocaleAware)
 
Qt::SortOrder sortOrder () const const
 
int sortRole () const const
 
void sortRoleChanged (int sortRole)
 
virtual QSize span (const QModelIndex &index) const const override
 
virtual Qt::DropActions supportedDropActions () const const override
 
- Public Member Functions inherited from QAbstractProxyModel
 QAbstractProxyModel (QObject *parent)
 
virtual bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const const override
 
virtual QMap< int, QVariantitemData (const QModelIndex &proxyIndex) const const override
 
virtual void revert () override
 
virtual bool setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles) override
 
QAbstractItemModelsourceModel () const const
 
void sourceModelChanged ()
 
virtual bool submit () override
 
virtual Qt::DropActions supportedDragActions () const const override
 
- Public Member Functions inherited from QAbstractItemModel
 QAbstractItemModel (QObject *parent)
 
bool checkIndex (const QModelIndex &index, QAbstractItemModel::CheckIndexOptions options) const const
 
void columnsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 
void columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void columnsInserted (const QModelIndex &parent, int first, int last)
 
void columnsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)
 
void columnsRemoved (const QModelIndex &parent, int first, int last)
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
 
bool hasIndex (int row, int column, const QModelIndex &parent) const const
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 
bool insertColumn (int column, const QModelIndex &parent)
 
bool insertRow (int row, const QModelIndex &parent)
 
void layoutAboutToBeChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
 
void layoutChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
 
void modelAboutToBeReset ()
 
void modelReset ()
 
bool moveColumn (const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild)
 
virtual bool moveColumns (const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild)
 
bool moveRow (const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild)
 
virtual bool moveRows (const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
 
bool removeColumn (int column, const QModelIndex &parent)
 
bool removeRow (int row, const QModelIndex &parent)
 
void rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void rowsInserted (const QModelIndex &parent, int first, int last)
 
void rowsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
 
void rowsRemoved (const QModelIndex &parent, int first, int last)
 
void setSupportedDragActions (Qt::DropActions actions)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

void classBegin () override
 
void componentComplete () override
 
- Protected Member Functions inherited from QSortFilterProxyModel
virtual bool filterAcceptsColumn (int source_column, const QModelIndex &source_parent) const const
 
void filterChanged ()
 
void invalidateFilter ()
 
- Protected Member Functions inherited from QAbstractProxyModel
void resetInternalData ()
 
- Protected Member Functions inherited from QAbstractItemModel
void beginInsertColumns (const QModelIndex &parent, int first, int last)
 
void beginInsertRows (const QModelIndex &parent, int first, int last)
 
bool beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
bool beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
void beginRemoveColumns (const QModelIndex &parent, int first, int last)
 
void beginRemoveRows (const QModelIndex &parent, int first, int last)
 
void beginResetModel ()
 
void changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
 
void changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
 
QModelIndex createIndex (int row, int column, quintptr id) const const
 
QModelIndex createIndex (int row, int column, void *ptr) const const
 
void endInsertColumns ()
 
void endInsertRows ()
 
void endMoveColumns ()
 
void endMoveRows ()
 
void endRemoveColumns ()
 
void endRemoveRows ()
 
void endResetModel ()
 
QModelIndexList persistentIndexList () const const
 
void reset ()
 
void resetInternalData ()
 
void setRoleNames (const QHash< int, QByteArray > &roleNames)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QAbstractItemModel
typedef CheckIndexOptions
 
 DoNotUseParent
 
 HorizontalSortHint
 
 IndexIsValid
 
 NoLayoutChangeHint
 
 NoOption
 
 ParentIsInvalid
 
 VerticalSortHint
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

A model with notifications and jobs.

This model contains application notifications as well as jobs and lets you apply fine-grained filter, sorting, and grouping rules.

Author
Kai Uwe Broulik [email protected][email protected]riva[email protected]t.bro[email protected]ulik[email protected].de

Definition at line 26 of file notifications.h.

Member Enumeration Documentation

◆ ClearFlag

Which items should be cleared in a call to clear.

Definition at line 309 of file notifications.h.

◆ GroupMode

The group mode for the model.

Definition at line 340 of file notifications.h.

◆ JobState

The state an application job is in.

Enumerator
JobStateStopped 

The job is stopped. It has either finished (error is 0) or failed (error is not 0)

JobStateRunning 

The job is currently running.

JobStateSuspended 

The job is currentl paused.

Definition at line 320 of file notifications.h.

◆ Roles

Enumerator
IdRole 

A notification identifier. This can be uint notification ID or string application job source.

SummaryRole 

The notification summary.

ImageRole 

The notification main image, which is not the application icon. Only valid for pixmap icons.

IsGroupRole 

Whether the item is a group.

GroupChildrenCountRole 

The number of children in a group.

ExpandedGroupChildrenCountRole 

The number of children in a group that are expanded.

IsGroupExpandedRole 

Whether the group is expanded, this role is writable.

IsInGroupRole 

Whether the notification is currently inside a group.

TypeRole 

The type of model entry, either NotificationType or JobType.

CreatedRole 

When the notification was first created.

UpdatedRole 

When the notification was last updated, invalid when it hasn't been updated.

BodyRole 

The notification body text.

IconNameRole 

The notification main icon name, which is not the application icon.

Only valid for icon names, if a URL supplied, it is loaded and exposed as ImageRole instead.

DesktopEntryRole 

The desktop entry (without .desktop suffix, e.g. org.kde.spectacle) of the application that sent the notification.

NotifyRcNameRole 

The notifyrc name (e.g. spectaclerc) of the application that sent the notification.

ApplicationNameRole 

The user-visible name of the application (e.g. Spectacle)

ApplicationIconNameRole 

The icon name of the application.

OriginNameRole 

The name of the device or account the notification originally came from, e.g.

"My Phone" (in case of device sync) or "[email protected]" (in case of an email notification)

JobStateRole 

The state of the job, either JobStateJopped, JobStateSuspended, or JobStateRunning.

PercentageRole 

The percentage of the job. Use jobsPercentage to get a global percentage for all jobs.

JobErrorRole 

The error id of the job, zero in case of no error.

SuspendableRole 

Whether the job can be suspended.

See also
suspendJob
KillableRole 

Whether the job can be killed/canceled.

See also
killJob
JobDetailsRole 

A pointer to a Job item itself containing more detailed information about the job.

ActionNamesRole 

The IDs of the actions, excluding the default and settings action, e.g. [action1, action2].

ActionLabelsRole 

The user-visible labels of the actions, excluding the default and settings action, e.g. ["Accept", "Reject"].

HasDefaultActionRole 

Whether the notification has a default action, which is one that is invoked when the popup itself is clicked.

DefaultActionLabelRole 

The user-visible label of the default action, typically not shown as the popup itself becomes clickable.

UrlsRole 

A list of URLs associated with the notification, e.g. a path to a screenshot that was just taken or image received.

UrgencyRole 

The notification urgency, either LowUrgency, NormalUrgency, or CriticalUrgency. Jobs do not have an urgency.

TimeoutRole 

The timeout for the notification in milliseconds.

0 means the notification should not timeout, -1 means a sensible default should be applied.

ConfigurableRole 

Whether the notification can be configured because a desktopEntry or notifyRcName is known, or the notification has a setting action.

See also
configure
ConfigureActionLabelRole 

The user-visible label for the settings action.

ClosableRole 

Whether the item can be closed. Notifications are always closable, jobs are only when in JobStateStopped.

ExpiredRole 

The notification timed out and closed. Actions on it cannot be invoked anymore.

DismissedRole 

The notification got temporarily hidden by the user but could still be interacted with.

ReadRole 

Whether the notification got read by the user.

If true, the notification isn't considered unread even if created after lastRead.

Since
5.17
UserActionFeedbackRole 

Whether this notification is a response/confirmation to an explicit user action.

Since
5.18
HasReplyActionRole 

Whether the notification has a reply action.

Since
5.18
ReplyActionLabelRole 

The user-visible label for the reply action.

Since
5.18
ReplyPlaceholderTextRole 

A custom placeholder text for the reply action, e.g. "Reply to Max...".

Since
5.18
ReplySubmitButtonTextRole 

A custom text for the reply submit button, e.g. "Submit Comment".

Since
5.18
ReplySubmitButtonIconNameRole 

A custom icon name for the reply submit button.

Since
5.18
CategoryRole 

The (optional) category of the notification.

Notifications can optionally have a type indicator. Although neither client or nor server must support this, some may choose to. Those servers implementing categories may use them to intelligently display the notification in a certain way, or group notifications of similar types.

Since
5.21
ResidentRole 

Whether the notification should keep its actions even when they were invoked.

Since
5.22
TransientRole 

Whether the notification is transient and should not be kept in history.

Since
5.22

Definition at line 210 of file notifications.h.

◆ SortMode

The sort mode for the model.

Enumerator
SortByDate 

Sort notifications strictly by the date they were updated or created.

SortByTypeAndUrgency 

Sort notifications taking into account their type and urgency. The order is (descending): Critical, jobs, Normal, Low.

Definition at line 330 of file notifications.h.

◆ Type

The type of model item.

Enumerator
NotificationType 

This item represents a notification.

JobType 

This item represents an application job.

Definition at line 284 of file notifications.h.

◆ Urgency

The notification urgency.

Note
jobs do not have an urgency, yet still might be above normal urgency notifications.
Enumerator
LowUrgency 

The notification has low urgency, it is not important and may not be shown or added to a history.

NormalUrgency 

The notification has normal urgency. This is also the default if no urgecny is supplied.

Definition at line 296 of file notifications.h.

Property Documentation

◆ activeJobsCount

int Notifications::activeJobsCount
read

The number of active jobs.

Definition at line 197 of file notifications.h.

◆ activeNotificationsCount

int Notifications::activeNotificationsCount
read

The number of active, i.e.

non-expired notifications

Definition at line 173 of file notifications.h.

◆ blacklistedDesktopEntries

QStringList Notifications::blacklistedDesktopEntries
readwrite

A list of desktop entries for which no notifications should be shown.

If the same desktop entry is present in both blacklist and whitelist, the blacklist takes precedence, i.e. the notification is not shown.

Definition at line 66 of file notifications.h.

◆ blacklistedNotifyRcNames

QStringList Notifications::blacklistedNotifyRcNames
readwrite

A list of notifyrc names for which no notifications should be shown.

If the same notifyrc name is present in both blacklist and whitelist, the blacklist takes precedence, i.e. the notification is not shown.

Definition at line 74 of file notifications.h.

◆ count

int Notifications::count
read

The number of notifications in the model.

Definition at line 168 of file notifications.h.

◆ expandUnread

bool Notifications::expandUnread
readwrite

Whether to automatically show notifications that are unread.

This is any notification that was created or updated after the value of lastRead.

Definition at line 163 of file notifications.h.

◆ expiredNotificationsCount

int Notifications::expiredNotificationsCount
read

The number of inactive, i.e.

non-expired notifications

Definition at line 178 of file notifications.h.

◆ groupLimit

int Notifications::groupLimit
readwrite

How many notifications are shown in each group.

You can expand a group by setting the IsGroupExpandedRole to true.

Default is 0, which means no limit.

Definition at line 156 of file notifications.h.

◆ groupMode

Notifications::GroupMode Notifications::groupMode
readwrite

The group mode for notifications.

Default is ungrouped.

Definition at line 147 of file notifications.h.

◆ jobsPercentage

int Notifications::jobsPercentage
read

The combined percentage of all jobs.

This is the average of all percentages and could can be used to show a global progress bar.

Definition at line 204 of file notifications.h.

◆ lastRead

QDateTime Notifications::lastRead
readwrite

The time when the user last could read the notifications.

This is typically reset whenever the list of notifications is opened and is used to determine the unreadNotificationsCount

Definition at line 185 of file notifications.h.

◆ limit

int Notifications::limit
readwrite

The number of notifications the model should at most contain.

Default is 0, which is no limit.

Definition at line 36 of file notifications.h.

◆ showDismissed

bool Notifications::showDismissed
readwrite

Whether to show dismissed notifications.

Dismissed notifications are those that are temporarily hidden by the user. This can e.g. be a copy job that has its popup closed but still continues in the background.

Default is false.

Definition at line 58 of file notifications.h.

◆ showExpired

bool Notifications::showExpired
readwrite

Whether to show expired notifications.

Expired notifications are those that timed out, i.e. ones that were not explicitly closed or acted upon by the user, nor revoked by the issuing application.

An expired notification has its actions removed.

Default is false.

Definition at line 48 of file notifications.h.

◆ showJobs

bool Notifications::showJobs
readwrite

Whether to show application jobs.

Default is false.

Definition at line 112 of file notifications.h.

◆ showNotifications

bool Notifications::showNotifications
readwrite

Whether to show notifications.

Default is true.

Definition at line 105 of file notifications.h.

◆ sortMode

Notifications::SortMode Notifications::sortMode
readwrite

The sort mode for notifications.

Default is strictly by date created/updated.

Definition at line 126 of file notifications.h.

◆ sortOrder

Qt::SortOrder Notifications::sortOrder
readwrite

The sort order for notifications.

This only affects the sort order by date. When sortMode is set to SortByTypeAndUrgency the order of notification groups (e.g. high - jobs - normal - low) is unaffected, and only notifications within the same group are either sorted ascending or descending by their creation/update date.

Default is DescendingOrder, i.e. newest notifications come first.

Since
5.19

Definition at line 140 of file notifications.h.

◆ unreadNotificationsCount

int Notifications::unreadNotificationsCount
read

The number of notifications added since lastRead.

This can be used to show a "n unread notifications" label

Definition at line 192 of file notifications.h.

◆ urgencies

Notifications::Urgencies Notifications::urgencies
readwrite

The notification urgency types the model should contain.

Default is all urgencies: low, normal, critical.

Definition at line 119 of file notifications.h.

◆ whitelistedDesktopEntries

QStringList Notifications::whitelistedDesktopEntries
readwrite

A list of desktop entries for which notifications should be shown.

This bypasses any filtering for urgency.

If the same desktop entry is present in both whitelist and blacklist, the blacklist takes precedence, i.e. the notification is not shown.

Default is empty list, which means normal filtering is applied.

Definition at line 86 of file notifications.h.

◆ whitelistedNotifyRcNames

QStringList Notifications::whitelistedNotifyRcNames
readwrite

A list of notifyrc names for which notifications should be shown.

This bypasses any filtering for urgency.

If the same notifyrc name is present in both whitelist and blacklist, the blacklist takes precedence, i.e. the notification is not shown.

Default is empty list, which means normal filtering is applied.

Definition at line 98 of file notifications.h.

Member Function Documentation

◆ clear()

void Notifications::clear ( ClearFlags  flags)

Clear notifications.

Removes the notifications matching th ClearFlags from the model. This can be used for e.g. a "Clear History" action.

Definition at line 773 of file notifications.cpp.

◆ close()

void Notifications::close ( const QModelIndex idx)

Close a notification.

Closes the notification in response to the user explicitly closing it.

When the model index belongs to a group, the entire group is closed.

Definition at line 659 of file notifications.cpp.

◆ configure()

void Notifications::configure ( const QModelIndex idx)

Configure a notification.

This will invoke the settings action, if available, otherwise open the kcm_notifications KCM for configuring the respective application and event.

Definition at line 694 of file notifications.cpp.

◆ expire()

void Notifications::expire ( const QModelIndex idx)

Expire a notification.

Closes the notification in response to its timeout running out.

Call this if you have an implementation that handles the timeout itself by having called stopTimeout

See also
stopTimeout

Definition at line 645 of file notifications.cpp.

◆ groupIndex()

QModelIndex Notifications::groupIndex ( const QModelIndex idx) const

Returns a model index pointing to the group of a notification.

Definition at line 783 of file notifications.cpp.

◆ invokeAction()

void Notifications::invokeAction ( const QModelIndex idx,
const QString actionId,
InvokeBehavior  behavior = None 
)

Invoke a notification action.

Invokes the action with the given actionId on the notification. For invoking the default action, i.e. the one that is triggered when clicking the notification bubble, use invokeDefaultAction

Definition at line 719 of file notifications.cpp.

◆ invokeDefaultAction()

void Notifications::invokeDefaultAction ( const QModelIndex idx,
InvokeBehavior  behavior = None 
)

Invoke the default notification action.

Invokes the action that should be triggered when clicking the notification bubble itself.

Definition at line 712 of file notifications.cpp.

◆ killJob()

void Notifications::killJob ( const QModelIndex idx)

Kill a job.

Definition at line 766 of file notifications.cpp.

◆ makePersistentModelIndex()

QPersistentModelIndex Notifications::makePersistentModelIndex ( const QModelIndex idx) const

Convert the given QModelIndex into a QPersistentModelIndex.

Definition at line 640 of file notifications.cpp.

◆ reply()

void Notifications::reply ( const QModelIndex idx,
const QString text,
InvokeBehavior  behavior 
)

Reply to a notification.

Replies to the given notification with the given text.

Since
5.18

Definition at line 726 of file notifications.cpp.

◆ resumeJob()

void Notifications::resumeJob ( const QModelIndex idx)

Resume a job.

Definition at line 759 of file notifications.cpp.

◆ startTimeout()

void Notifications::startTimeout ( const QModelIndex idx)

Start automatic timeout of notifications.

Call this if you no longer handle the timeout yourself.

See also
stopTimeout

Definition at line 733 of file notifications.cpp.

◆ stopTimeout()

void Notifications::stopTimeout ( const QModelIndex idx)

Stop the automatic timeout of notifications.

Call this if you have an implementation that handles the timeout itself taking into account e.g. whether the user is currently interacting with the notification to not close it under their mouse. Call expire once your custom timer has run out.

See also
expire

Definition at line 745 of file notifications.cpp.

◆ suspendJob()

void Notifications::suspendJob ( const QModelIndex idx)

Suspend a job.

Definition at line 752 of file notifications.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Jun 28 2022 03:49:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.