Plasma-workspace

notifications.h
1/*
2 SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@privat.broulik.de>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#pragma once
8
9#include <QQmlParserStatus>
10#include <QSortFilterProxyModel>
11#include <QWindow>
12
13#include <memory>
14
15#include "notificationmanager_export.h"
16
17#include <qqmlregistration.h>
18
19namespace NotificationManager
20{
21/**
22 * @brief A model with notifications and jobs
23 *
24 * This model contains application notifications as well as jobs
25 * and lets you apply fine-grained filter, sorting, and grouping rules.
26 *
27 * @author Kai Uwe Broulik <kde@privat.broulik.de>
28 **/
29class NOTIFICATIONMANAGER_EXPORT Notifications : public QSortFilterProxyModel, public QQmlParserStatus
30{
32 QML_ELEMENT
34
35 /**
36 * The number of notifications the model should at most contain.
37 *
38 * Default is 0, which is no limit.
39 */
40 Q_PROPERTY(int limit READ limit WRITE setLimit NOTIFY limitChanged)
41
42 /**
43 * Whether to show expired notifications.
44 *
45 * Expired notifications are those that timed out, i.e. ones that were not explicitly
46 * closed or acted upon by the user, nor revoked by the issuing application.
47 *
48 * An expired notification has its actions removed.
49 *
50 * Default is false.
51 */
52 Q_PROPERTY(bool showExpired READ showExpired WRITE setShowExpired NOTIFY showExpiredChanged)
53
54 /**
55 * Whether to show dismissed notifications.
56 *
57 * Dismissed notifications are those that are temporarily hidden by the user.
58 * This can e.g. be a copy job that has its popup closed but still continues in the background.
59 *
60 * Default is false.
61 */
62 Q_PROPERTY(bool showDismissed READ showDismissed WRITE setShowDismissed NOTIFY showDismissedChanged)
63
64 /**
65 * Whether to show notifications added during inhibition.
66 *
67 * If set to @c false, notifications are suppressed even after leaving "Do not disturb" mode.
68 *
69 * Default is @c true.
70 */
71 Q_PROPERTY(bool showAddedDuringInhibition READ showAddedDuringInhibition WRITE setShowAddedDuringInhibition NOTIFY showAddedDuringInhibitionChanged)
72
73 /**
74 * A list of desktop entries for which no notifications should be shown.
75 *
76 * If the same desktop entry is present in both blacklist and whitelist,
77 * the blacklist takes precedence, i.e. the notification is not shown.
78 */
79 Q_PROPERTY(QStringList blacklistedDesktopEntries READ blacklistedDesktopEntries WRITE setBlacklistedDesktopEntries NOTIFY blacklistedDesktopEntriesChanged)
80
81 /**
82 * A list of notifyrc names for which no notifications should be shown.
83 *
84 * If the same notifyrc name is present in both blacklist and whitelist,
85 * the blacklist takes precedence, i.e. the notification is not shown.
86 */
87 Q_PROPERTY(QStringList blacklistedNotifyRcNames READ blacklistedNotifyRcNames WRITE setBlacklistedNotifyRcNames NOTIFY blacklistedNotifyRcNamesChanged)
88
89 /**
90 * A list of desktop entries for which notifications should be shown.
91 *
92 * This bypasses any filtering for urgency.
93 *
94 * If the same desktop entry is present in both whitelist and blacklist,
95 * the blacklist takes precedence, i.e. the notification is not shown.
96 *
97 * Default is empty list, which means normal filtering is applied.
98 */
99 Q_PROPERTY(QStringList whitelistedDesktopEntries READ whitelistedDesktopEntries WRITE setWhitelistedDesktopEntries NOTIFY whitelistedDesktopEntriesChanged)
100
101 /**
102 * A list of notifyrc names for which notifications should be shown.
103 *
104 * This bypasses any filtering for urgency.
105 *
106 * If the same notifyrc name is present in both whitelist and blacklist,
107 * the blacklist takes precedence, i.e. the notification is not shown.
108 *
109 * Default is empty list, which means normal filtering is applied.
110 */
111 Q_PROPERTY(QStringList whitelistedNotifyRcNames READ whitelistedNotifyRcNames WRITE setWhitelistedNotifyRcNames NOTIFY whitelistedNotifyRcNamesChanged)
112
113 /**
114 * Whether to show notifications.
115 *
116 * Default is true.
117 */
118 Q_PROPERTY(bool showNotifications READ showNotifications WRITE setShowNotifications NOTIFY showNotificationsChanged)
119
120 /**
121 * Whether to show application jobs.
122 *
123 * Default is false.
124 */
125 Q_PROPERTY(bool showJobs READ showJobs WRITE setShowJobs NOTIFY showJobsChanged)
126
127 /**
128 * The notification urgency types the model should contain.
129 *
130 * Default is all urgencies: low, normal, critical.
131 */
132 Q_PROPERTY(Urgencies urgencies READ urgencies WRITE setUrgencies NOTIFY urgenciesChanged)
133
134 /**
135 * The sort mode for notifications.
136 *
137 * Default is strictly by date created/updated.
138 */
139 Q_PROPERTY(SortMode sortMode READ sortMode WRITE setSortMode NOTIFY sortModeChanged)
140
141 /**
142 * The sort order for notifications.
143 *
144 * This only affects the sort order by date. When @c sortMode is set to SortByTypeAndUrgency
145 * the order of notification groups (e.g. high - jobs - normal - low) is unaffected, and only
146 * notifications within the same group are either sorted ascending or descending by their
147 * creation/update date.
148 *
149 * Default is DescendingOrder, i.e. newest notifications come first.
150 *
151 * @since 5.19
152 */
153 Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged)
154
155 /**
156 * The group mode for notifications.
157 *
158 * Default is ungrouped.
159 */
160 Q_PROPERTY(GroupMode groupMode READ groupMode WRITE setGroupMode NOTIFY groupModeChanged)
161
162 /**
163 * How many notifications are shown in each group.
164 *
165 * You can expand a group by setting the IsGroupExpandedRole to true.
166 *
167 * Default is 0, which means no limit.
168 */
169 Q_PROPERTY(int groupLimit READ groupLimit WRITE setGroupLimit NOTIFY groupLimitChanged)
170
171 /**
172 * Whether to automatically show notifications that are unread.
173 *
174 * This is any notification that was created or updated after the value of @c lastRead.
175 */
176 Q_PROPERTY(bool expandUnread READ expandUnread WRITE setExpandUnread NOTIFY expandUnreadChanged)
177
178 /**
179 * The number of notifications in the model
180 */
181 Q_PROPERTY(int count READ count NOTIFY countChanged)
182
183 /**
184 * The number of active, i.e. non-expired notifications
185 */
186 Q_PROPERTY(int activeNotificationsCount READ activeNotificationsCount NOTIFY activeNotificationsCountChanged)
187
188 /**
189 * The number of inactive, i.e. non-expired notifications
190 */
191 Q_PROPERTY(int expiredNotificationsCount READ expiredNotificationsCount NOTIFY expiredNotificationsCountChanged)
192
193 /**
194 * The time when the user last could read the notifications.
195 * This is typically reset whenever the list of notifications is opened and is used to determine
196 * the @c unreadNotificationsCount
197 */
198 Q_PROPERTY(QDateTime lastRead READ lastRead WRITE setLastRead RESET resetLastRead NOTIFY lastReadChanged)
199
200 /**
201 * The number of notifications added since lastRead
202 *
203 * This can be used to show a "n unread notifications" label
204 */
205 Q_PROPERTY(int unreadNotificationsCount READ unreadNotificationsCount NOTIFY unreadNotificationsCountChanged)
206
207 /**
208 * The number of active jobs
209 */
210 Q_PROPERTY(int activeJobsCount READ activeJobsCount NOTIFY activeJobsCountChanged)
211 /**
212 * The combined percentage of all jobs.
213 *
214 * This is the average of all percentages and could can be used to show
215 * a global progress bar.
216 */
217 Q_PROPERTY(int jobsPercentage READ jobsPercentage NOTIFY jobsPercentageChanged)
218
219 /**
220 * The window that will render the notifications
221 *
222 * This is used to tell the xdg_activation_v1 protocol who is requesting the activation.
223 */
224 Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged)
225public:
226 explicit Notifications(QObject *parent = nullptr);
227 ~Notifications() override;
228
229 enum Roles {
230 IdRole = Qt::UserRole + 1, ///< A notification identifier. This can be uint notification ID or string application job source.
231 SummaryRole = Qt::DisplayRole, ///< The notification summary.
232 ImageRole = Qt::DecorationRole, ///< The notification main image, which is not the application icon. Only valid for pixmap icons.
233
234 IsGroupRole = Qt::UserRole + 2, ///< Whether the item is a group
235 GroupChildrenCountRole, ///< The number of children in a group.
236 ExpandedGroupChildrenCountRole, ///< The number of children in a group that are expanded.
237 IsGroupExpandedRole, ///< Whether the group is expanded, this role is writable.
238
239 IsInGroupRole, ///< Whether the notification is currently inside a group.
240 TypeRole, ///< The type of model entry, either NotificationType or JobType.
241 CreatedRole, ///< When the notification was first created.
242 UpdatedRole, ///< When the notification was last updated, invalid when it hasn't been updated.
243
244 BodyRole, ///< The notification body text.
245 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
246 ///< exposed as ImageRole instead.
247
248 DesktopEntryRole, ///< The desktop entry (without .desktop suffix, e.g. org.kde.spectacle) of the application that sent the notification.
249 NotifyRcNameRole, ///< The notifyrc name (e.g. spectaclerc) of the application that sent the notification.
250
251 ApplicationNameRole, ///< The user-visible name of the application (e.g. Spectacle)
252 ApplicationIconNameRole, ///< The icon name of the application
253 OriginNameRole, ///< The name of the device or account the notification originally came from, e.g. "My Phone" (in case of device sync) or
254 ///< "foo@example.com" (in case of an email notification)
255
256 // Jobs
257 JobStateRole, ///< The state of the job, either JobStateJopped, JobStateSuspended, or JobStateRunning.
258 PercentageRole, ///< The percentage of the job. Use @c jobsPercentage to get a global percentage for all jobs.
259 JobErrorRole, ///< The error id of the job, zero in case of no error.
260 SuspendableRole, ///< Whether the job can be suspended @sa suspendJob
261 KillableRole, ///< Whether the job can be killed/canceled @sa killJob
262 JobDetailsRole, ///< A pointer to a Job item itself containing more detailed information about the job
263
264 ActionNamesRole, ///< The IDs of the actions, excluding the default and settings action, e.g. [action1, action2]
265 ActionLabelsRole, ///< The user-visible labels of the actions, excluding the default and settings action, e.g. ["Accept", "Reject"]
266 HasDefaultActionRole, ///< Whether the notification has a default action, which is one that is invoked when the popup itself is clicked
267 DefaultActionLabelRole, ///< The user-visible label of the default action, typically not shown as the popup itself becomes clickable
268
269 UrlsRole, ///< A list of URLs associated with the notification, e.g. a path to a screenshot that was just taken or image received
270
271 UrgencyRole, ///< The notification urgency, either LowUrgency, NormalUrgency, or CriticalUrgency. Jobs do not have an urgency.
272 TimeoutRole, ///< The timeout for the notification in milliseconds. 0 means the notification should not timeout, -1 means a sensible default should be
273 ///< applied.
274
275 ConfigurableRole, ///< Whether the notification can be configured because a desktopEntry or notifyRcName is known, or the notification has a setting
276 ///< action. @sa configure
277 ConfigureActionLabelRole, ///< The user-visible label for the settings action
278 ClosableRole, ///< Whether the item can be closed. Notifications are always closable, jobs are only when in JobStateStopped.
279
280 ExpiredRole, ///< The notification timed out and closed. Actions on it cannot be invoked anymore.
281 DismissedRole, ///< The notification got temporarily hidden by the user but could still be interacted with.
282 ReadRole, ///< Whether the notification got read by the user. If true, the notification isn't considered unread even if created after lastRead.
283 ///< @since 5.17
284
285 UserActionFeedbackRole, ///< Whether this notification is a response/confirmation to an explicit user action. @since 5.18
286
287 HasReplyActionRole, ///< Whether the notification has a reply action. @since 5.18
288 ReplyActionLabelRole, ///< The user-visible label for the reply action. @since 5.18
289 ReplyPlaceholderTextRole, ///< A custom placeholder text for the reply action, e.g. "Reply to Max...". @since 5.18
290 ReplySubmitButtonTextRole, ///< A custom text for the reply submit button, e.g. "Submit Comment". @since 5.18
291 ReplySubmitButtonIconNameRole, ///< A custom icon name for the reply submit button. @since 5.18
292 CategoryRole, ///< The (optional) category of the notification. Notifications can optionally have a type indicator. Although neither client or nor
293 ///< server must support this, some may choose to. Those servers implementing categories may use them to intelligently display the
294 ///< notification in a certain way, or group notifications of similar types. @since 5.21
295 ResidentRole, ///< Whether the notification should keep its actions even when they were invoked. @since 5.22
296 TransientRole, ///< Whether the notification is transient and should not be kept in history. @since 5.22
297
298 WasAddedDuringInhibitionRole, ///< Whether the notification was added while inhibition was active. @since 6.3
299 HintsRole, ///< To provide extra data to a notification server that the server may be able to make use of. @since 6.4
300 };
301 Q_ENUM(Roles)
302
303 /**
304 * The type of model item.
305 */
306 enum Type {
307 NoType,
308 NotificationType, ///< This item represents a notification.
309 JobType, ///< This item represents an application job.
310 };
311 Q_ENUM(Type)
312
313 /**
314 * The notification urgency.
315 *
316 * @note jobs do not have an urgency, yet still might be above normal urgency notifications.
317 */
318 enum Urgency {
319 // these don't match the spec's value
320 LowUrgency = 1 << 0, ///< The notification has low urgency, it is not important and may not be shown or added to a history.
321 NormalUrgency = 1 << 1, ///< The notification has normal urgency. This is also the default if no urgecny is supplied.
322 CriticalUrgency = 1 << 2,
323 };
324 Q_ENUM(Urgency)
325 Q_DECLARE_FLAGS(Urgencies, Urgency)
326 Q_FLAG(Urgencies)
327
328 /**
329 * Which items should be cleared in a call to @c clear
330 */
332 ClearExpired = 1 << 1,
333 // TODO more
334 };
335 Q_ENUM(ClearFlag)
336 Q_DECLARE_FLAGS(ClearFlags, ClearFlag)
337 Q_FLAG(ClearFlags)
338
339 /**
340 * The state an application job is in.
341 */
342 enum JobState {
343 JobStateStopped, ///< The job is stopped. It has either finished (error is 0) or failed (error is not 0)
344 JobStateRunning, ///< The job is currently running.
345 JobStateSuspended, ///< The job is currentl paused
346 };
347 Q_ENUM(JobState)
348
349 /**
350 * The sort mode for the model.
351 */
352 enum SortMode {
353 SortByDate = 0, ///< Sort notifications strictly by the date they were updated or created.
354 // should this be flags? SortJobsFirst | SortByUrgency | ...?
355 SortByTypeAndUrgency, ///< Sort notifications taking into account their type and urgency. The order is (descending): Critical, jobs, Normal, Low.
356 };
357 Q_ENUM(SortMode)
358
359 /**
360 * The group mode for the model.
361 */
363 GroupDisabled = 0,
364 // GroupApplicationsTree, // TODO make actual tree
365 GroupApplicationsFlat,
366 };
367 Q_ENUM(GroupMode)
368
369 enum InvokeBehavior {
370 None = 0,
371 Close = 1,
372 };
373 Q_ENUM(InvokeBehavior)
374 Q_DECLARE_FLAGS(InvokeBehaviors, InvokeBehavior)
375 Q_FLAG(InvokeBehaviors)
376
377 int limit() const;
378 void setLimit(int limit);
379
380 bool showExpired() const;
381 void setShowExpired(bool show);
382
383 bool showDismissed() const;
384 void setShowDismissed(bool show);
385
386 bool showAddedDuringInhibition() const;
387 void setShowAddedDuringInhibition(bool show);
388
389 QStringList blacklistedDesktopEntries() const;
390 void setBlacklistedDesktopEntries(const QStringList &blacklist);
391
392 QStringList blacklistedNotifyRcNames() const;
393 void setBlacklistedNotifyRcNames(const QStringList &blacklist);
394
395 QStringList whitelistedDesktopEntries() const;
396 void setWhitelistedDesktopEntries(const QStringList &whitelist);
397
398 QStringList whitelistedNotifyRcNames() const;
399 void setWhitelistedNotifyRcNames(const QStringList &whitelist);
400
401 bool showNotifications() const;
402 void setShowNotifications(bool showNotifications);
403
404 bool showJobs() const;
405 void setShowJobs(bool showJobs);
406
407 Urgencies urgencies() const;
408 void setUrgencies(Urgencies urgencies);
409
410 SortMode sortMode() const;
411 void setSortMode(SortMode sortMode);
412
413 Qt::SortOrder sortOrder() const;
414 void setSortOrder(Qt::SortOrder sortOrder);
415
416 GroupMode groupMode() const;
417 void setGroupMode(GroupMode groupMode);
418
419 int groupLimit() const;
420 void setGroupLimit(int limit);
421
422 bool expandUnread() const;
423 void setExpandUnread(bool expand);
424
425 QWindow *window() const;
426 void setWindow(QWindow *window);
427
428 int count() const;
429
430 int activeNotificationsCount() const;
431 int expiredNotificationsCount() const;
432
433 QDateTime lastRead() const;
434 void setLastRead(const QDateTime &lastRead);
435 void resetLastRead();
436
437 int unreadNotificationsCount() const;
438
439 int activeJobsCount() const;
440 int jobsPercentage() const;
441
442 /**
443 * Convert the given QModelIndex into a QPersistentModelIndex
444 */
445 Q_INVOKABLE QPersistentModelIndex makePersistentModelIndex(const QModelIndex &idx) const;
446
447 /**
448 * @brief Expire a notification
449 *
450 * Closes the notification in response to its timeout running out.
451 *
452 * Call this if you have an implementation that handles the timeout itself
453 * by having called @c stopTimeout
454 *
455 * @sa stopTimeout
456 */
457 Q_INVOKABLE void expire(const QModelIndex &idx);
458 /**
459 * @brief Close a notification
460 *
461 * Closes the notification in response to the user explicitly closing it.
462 *
463 * When the model index belongs to a group, the entire group is closed.
464 */
465 Q_INVOKABLE void close(const QModelIndex &idx);
466 /**
467 * @brief Configure a notification
468 *
469 * This will invoke the settings action, if available, otherwise open the
470 * kcm_notifications KCM for configuring the respective application and event.
471 */
472 Q_INVOKABLE void configure(const QModelIndex &idx); // TODO pass ctx for transient handling
473 /**
474 * @brief Invoke the default notification action
475 *
476 * Invokes the action that should be triggered when clicking
477 * the notification bubble itself.
478 */
479 Q_INVOKABLE void invokeDefaultAction(const QModelIndex &idx, InvokeBehavior behavior = None);
480 /**
481 * @brief Invoke a notification action
482 *
483 * Invokes the action with the given actionId on the notification.
484 * For invoking the default action, i.e. the one that is triggered
485 * when clicking the notification bubble, use invokeDefaultAction
486 */
487 Q_INVOKABLE void invokeAction(const QModelIndex &idx, const QString &actionId, InvokeBehavior = None);
488
489 /**
490 * @brief Reply to a notification
491 *
492 * Replies to the given notification with the given text.
493 * @since 5.18
494 */
495 Q_INVOKABLE void reply(const QModelIndex &idx, const QString &text, InvokeBehavior behavior);
496
497 /**
498 * @brief Start automatic timeout of notifications
499 *
500 * Call this if you no longer handle the timeout yourself.
501 *
502 * @sa stopTimeout
503 */
504 Q_INVOKABLE void startTimeout(const QModelIndex &idx);
505
506 Q_INVOKABLE void startTimeout(uint notificationId);
507 /**
508 * @brief Stop the automatic timeout of notifications
509 *
510 * Call this if you have an implementation that handles the timeout itself
511 * taking into account e.g. whether the user is currently interacting with
512 * the notification to not close it under their mouse. Call @c expire
513 * once your custom timer has run out.
514 *
515 * @sa expire
516 */
517 Q_INVOKABLE void stopTimeout(const QModelIndex &idx);
518
519 /**
520 * @brief Suspend a job
521 */
522 Q_INVOKABLE void suspendJob(const QModelIndex &idx);
523 /**
524 * @brief Resume a job
525 */
526 Q_INVOKABLE void resumeJob(const QModelIndex &idx);
527 /**
528 * @brief Kill a job
529 */
530 Q_INVOKABLE void killJob(const QModelIndex &idx);
531
532 /**
533 * @brief Clear notifications
534 *
535 * Removes the notifications matching th ClearFlags from the model.
536 * This can be used for e.g. a "Clear History" action.
537 */
538 Q_INVOKABLE void clear(ClearFlags flags);
539
540 /**
541 * Returns a model index pointing to the group of a notification.
542 */
543 Q_INVOKABLE QModelIndex groupIndex(const QModelIndex &idx) const;
544
545 Q_INVOKABLE void collapseAllGroups();
546
547 Q_INVOKABLE void playSoundHint(const QModelIndex &idx) const;
548
549 /**
550 * Shows a notification to report the number of unread inhibited notifications.
551 */
552 Q_INVOKABLE void showInhibitionSummary();
553
554 QVariant data(const QModelIndex &index, int role) const override;
555 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
556 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
557 QHash<int, QByteArray> roleNames() const override;
558
559 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
560 bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
561
562Q_SIGNALS:
563 void limitChanged();
564 void showExpiredChanged();
565 void showDismissedChanged();
566 void showAddedDuringInhibitionChanged();
567 void blacklistedDesktopEntriesChanged();
568 void blacklistedNotifyRcNamesChanged();
569 void whitelistedDesktopEntriesChanged();
570 void whitelistedNotifyRcNamesChanged();
571 void showNotificationsChanged();
572 void showJobsChanged();
573 void urgenciesChanged();
574 void sortModeChanged();
575 void sortOrderChanged();
576 void groupModeChanged();
577 void groupLimitChanged();
578 void expandUnreadChanged();
579 void countChanged();
580 void activeNotificationsCountChanged();
581 void expiredNotificationsCountChanged();
582 void lastReadChanged();
583 void unreadNotificationsCountChanged();
584 void activeJobsCountChanged();
585 void jobsPercentageChanged();
586 void windowChanged(QWindow *window);
587
588protected:
589 void classBegin() override;
590 void componentComplete() override;
591
592private:
593 class Private;
594 std::unique_ptr<Private> d;
595};
596
597} // namespace NotificationManager
598
599Q_DECLARE_OPERATORS_FOR_FLAGS(NotificationManager::Notifications::Urgencies)
QStringList whitelistedDesktopEntries
A list of desktop entries for which notifications should be shown.
GroupMode groupMode
The group mode for notifications.
QStringList blacklistedNotifyRcNames
A list of notifyrc names for which no notifications should be shown.
int groupLimit
How many notifications are shown in each group.
bool showNotifications
Whether to show notifications.
int unreadNotificationsCount
The number of notifications added since lastRead.
bool expandUnread
Whether to automatically show notifications that are unread.
bool showDismissed
Whether to show dismissed notifications.
int activeNotificationsCount
The number of active, i.e.
QWindow * window
The window that will render the notifications.
bool showExpired
Whether to show expired notifications.
int jobsPercentage
The combined percentage of all jobs.
Urgencies urgencies
The notification urgency types the model should contain.
QStringList whitelistedNotifyRcNames
A list of notifyrc names for which notifications should be shown.
SortMode
The sort mode for the model.
@ 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,...
@ JobType
This item represents an application job.
@ NotificationType
This item represents a notification.
Urgency
The notification urgency.
@ 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.
bool showAddedDuringInhibition
Whether to show notifications added during inhibition.
Qt::SortOrder sortOrder
The sort order for notifications.
JobState
The state an application job is in.
@ 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.
int expiredNotificationsCount
The number of inactive, i.e.
bool showJobs
Whether to show application jobs.
QML_ELEMENTint limit
The number of notifications the model should at most contain.
GroupMode
The group mode for the model.
int activeJobsCount
The number of active jobs.
int count
The number of notifications in the model.
ClearFlag
Which items should be cleared in a call to clear.
@ ApplicationNameRole
The user-visible name of the application (e.g. Spectacle)
@ ConfigurableRole
Whether the notification can be configured because a desktopEntry or notifyRcName is known,...
@ SummaryRole
The notification summary.
@ HasReplyActionRole
Whether the notification has a reply action.
@ UpdatedRole
When the notification was last updated, invalid when it hasn't been updated.
@ NotifyRcNameRole
The notifyrc name (e.g. spectaclerc) of the application that sent the notification.
@ CategoryRole
The (optional) category of the notification.
@ ReadRole
Whether the notification got read by the user.
@ BodyRole
The notification body text.
@ JobDetailsRole
A pointer to a Job item itself containing more detailed information about the job.
@ ResidentRole
Whether the notification should keep its actions even when they were invoked.
@ OriginNameRole
The name of the device or account the notification originally came from, e.g.
@ SuspendableRole
Whether the job can be suspended.
@ DismissedRole
The notification got temporarily hidden by the user but could still be interacted with.
@ DefaultActionLabelRole
The user-visible label of the default action, typically not shown as the popup itself becomes clickab...
@ ActionLabelsRole
The user-visible labels of the actions, excluding the default and settings action,...
@ IconNameRole
The notification main icon name, which is not the application icon.
@ ReplySubmitButtonTextRole
A custom text for the reply submit button, e.g. "Submit Comment".
@ IsGroupExpandedRole
Whether the group is expanded, this role is writable.
@ IsInGroupRole
Whether the notification is currently inside a group.
@ HasDefaultActionRole
Whether the notification has a default action, which is one that is invoked when the popup itself is ...
@ JobStateRole
The state of the job, either JobStateJopped, JobStateSuspended, or JobStateRunning.
@ IdRole
A notification identifier. This can be uint notification ID or string application job source.
@ DesktopEntryRole
The desktop entry (without .desktop suffix, e.g. org.kde.spectacle) of the application that sent the ...
@ ApplicationIconNameRole
The icon name of the application.
@ IsGroupRole
Whether the item is a group.
@ ConfigureActionLabelRole
The user-visible label for the settings action.
@ KillableRole
Whether the job can be killed/canceled.
@ ReplySubmitButtonIconNameRole
A custom icon name for the reply submit button.
@ ActionNamesRole
The IDs of the actions, excluding the default and settings action, e.g. [action1, action2].
@ WasAddedDuringInhibitionRole
Whether the notification was added while inhibition was active.
@ ExpiredRole
The notification timed out and closed. Actions on it cannot be invoked anymore.
@ JobErrorRole
The error id of the job, zero in case of no error.
@ HintsRole
To provide extra data to a notification server that the server may be able to make use of.
@ CreatedRole
When the notification was first created.
@ UserActionFeedbackRole
Whether this notification is a response/confirmation to an explicit user action.
@ ReplyPlaceholderTextRole
A custom placeholder text for the reply action, e.g. "Reply to Max...".
@ TimeoutRole
The timeout for the notification in milliseconds.
@ ClosableRole
Whether the item can be closed. Notifications are always closable, jobs are only when in JobStateStop...
@ UrgencyRole
The notification urgency, either LowUrgency, NormalUrgency, or CriticalUrgency. Jobs do not have an u...
@ ImageRole
The notification main image, which is not the application icon. Only valid for pixmap icons.
@ ReplyActionLabelRole
The user-visible label for the reply action.
@ UrlsRole
A list of URLs associated with the notification, e.g. a path to a screenshot that was just taken or i...
@ ExpandedGroupChildrenCountRole
The number of children in a group that are expanded.
@ TypeRole
The type of model entry, either NotificationType or JobType.
@ GroupChildrenCountRole
The number of children in a group.
@ PercentageRole
The percentage of the job. Use jobsPercentage to get a global percentage for all jobs.
@ TransientRole
Whether the notification is transient and should not be kept in history.
QDateTime lastRead
The time when the user last could read the notifications.
QStringList blacklistedDesktopEntries
A list of desktop entries for which no notifications should be shown.
SortMode sortMode
The sort mode for notifications.
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QSortFilterProxyModel(QObject *parent)
virtual QModelIndex parent(const QModelIndex &child) const const override
UserRole
SortOrder
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Mar 28 2025 11:53:53 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.