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 resident notifications that have been dismissed
209 *
210 * This can be used to show that there is an active notification in the history
211 *
212 * @since 6.4
213 */
214 Q_PROPERTY(int dismissedResidentNotificationsCount READ dismissedResidentNotificationsCount NOTIFY dismissedResidentNotificationsCountChanged)
215
216 /**
217 * The number of active jobs
218 */
219 Q_PROPERTY(int activeJobsCount READ activeJobsCount NOTIFY activeJobsCountChanged)
220 /**
221 * The combined percentage of all jobs.
222 *
223 * This is the average of all percentages and could can be used to show
224 * a global progress bar.
225 */
226 Q_PROPERTY(int jobsPercentage READ jobsPercentage NOTIFY jobsPercentageChanged)
227
228 /**
229 * The window that will render the notifications
230 *
231 * This is used to tell the xdg_activation_v1 protocol who is requesting the activation.
232 */
233 Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged)
234public:
235 explicit Notifications(QObject *parent = nullptr);
236 ~Notifications() override;
237
238 enum Roles {
239 IdRole = Qt::UserRole + 1, ///< A notification identifier. This can be uint notification ID or string application job source.
240 SummaryRole = Qt::DisplayRole, ///< The notification summary.
241 ImageRole = Qt::DecorationRole, ///< The notification main image, which is not the application icon. Only valid for pixmap icons.
242
243 IsGroupRole = Qt::UserRole + 2, ///< Whether the item is a group
244 GroupChildrenCountRole, ///< The number of children in a group.
245 ExpandedGroupChildrenCountRole, ///< The number of children in a group that are expanded.
246 IsGroupExpandedRole, ///< Whether the group is expanded, this role is writable.
247
248 IsInGroupRole, ///< Whether the notification is currently inside a group.
249 TypeRole, ///< The type of model entry, either NotificationType or JobType.
250 CreatedRole, ///< When the notification was first created.
251 UpdatedRole, ///< When the notification was last updated, invalid when it hasn't been updated.
252
253 BodyRole, ///< The notification body text.
254 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
255 ///< exposed as ImageRole instead.
256
257 DesktopEntryRole, ///< The desktop entry (without .desktop suffix, e.g. org.kde.spectacle) of the application that sent the notification.
258 NotifyRcNameRole, ///< The notifyrc name (e.g. spectaclerc) of the application that sent the notification.
259
260 ApplicationNameRole, ///< The user-visible name of the application (e.g. Spectacle)
261 ApplicationIconNameRole, ///< The icon name of the application
262 OriginNameRole, ///< The name of the device or account the notification originally came from, e.g. "My Phone" (in case of device sync) or
263 ///< "foo@example.com" (in case of an email notification)
264
265 // Jobs
266 JobStateRole, ///< The state of the job, either JobStateJopped, JobStateSuspended, or JobStateRunning.
267 PercentageRole, ///< The percentage of the job. Use @c jobsPercentage to get a global percentage for all jobs.
268 JobErrorRole, ///< The error id of the job, zero in case of no error.
269 SuspendableRole, ///< Whether the job can be suspended @sa suspendJob
270 KillableRole, ///< Whether the job can be killed/canceled @sa killJob
271 JobDetailsRole, ///< A pointer to a Job item itself containing more detailed information about the job
272
273 ActionNamesRole, ///< The IDs of the actions, excluding the default and settings action, e.g. [action1, action2]
274 ActionLabelsRole, ///< The user-visible labels of the actions, excluding the default and settings action, e.g. ["Accept", "Reject"]
275 HasDefaultActionRole, ///< Whether the notification has a default action, which is one that is invoked when the popup itself is clicked
276 DefaultActionLabelRole, ///< The user-visible label of the default action, typically not shown as the popup itself becomes clickable
277
278 UrlsRole, ///< A list of URLs associated with the notification, e.g. a path to a screenshot that was just taken or image received
279
280 UrgencyRole, ///< The notification urgency, either LowUrgency, NormalUrgency, or CriticalUrgency. Jobs do not have an urgency.
281 TimeoutRole, ///< The timeout for the notification in milliseconds. 0 means the notification should not timeout, -1 means a sensible default should be
282 ///< applied.
283
284 ConfigurableRole, ///< Whether the notification can be configured because a desktopEntry or notifyRcName is known, or the notification has a setting
285 ///< action. @sa configure
286 ConfigureActionLabelRole, ///< The user-visible label for the settings action
287 ClosableRole, ///< Whether the item can be closed. Notifications are always closable, jobs are only when in JobStateStopped.
288
289 ExpiredRole, ///< The notification timed out and closed. Actions on it cannot be invoked anymore.
290 DismissedRole, ///< The notification got temporarily hidden by the user but could still be interacted with.
291 ReadRole, ///< Whether the notification got read by the user. If true, the notification isn't considered unread even if created after lastRead.
292 ///< @since 5.17
293
294 UserActionFeedbackRole, ///< Whether this notification is a response/confirmation to an explicit user action. @since 5.18
295
296 HasReplyActionRole, ///< Whether the notification has a reply action. @since 5.18
297 ReplyActionLabelRole, ///< The user-visible label for the reply action. @since 5.18
298 ReplyPlaceholderTextRole, ///< A custom placeholder text for the reply action, e.g. "Reply to Max...". @since 5.18
299 ReplySubmitButtonTextRole, ///< A custom text for the reply submit button, e.g. "Submit Comment". @since 5.18
300 ReplySubmitButtonIconNameRole, ///< A custom icon name for the reply submit button. @since 5.18
301 CategoryRole, ///< The (optional) category of the notification. Notifications can optionally have a type indicator. Although neither client or nor
302 ///< server must support this, some may choose to. Those servers implementing categories may use them to intelligently display the
303 ///< notification in a certain way, or group notifications of similar types. @since 5.21
304 ResidentRole, ///< Whether the notification should keep its actions even when they were invoked. @since 5.22
305 TransientRole, ///< Whether the notification is transient and should not be kept in history. @since 5.22
306
307 WasAddedDuringInhibitionRole, ///< Whether the notification was added while inhibition was active. @since 6.3
308 HintsRole, ///< To provide extra data to a notification server that the server may be able to make use of. @since 6.4
309 DismissableRole, ///< Whether a notification can be dismissed (minimized). @since 6.4
310 };
311 Q_ENUM(Roles)
312
313 /**
314 * The type of model item.
315 */
316 enum Type {
317 NoType,
318 NotificationType, ///< This item represents a notification.
319 JobType, ///< This item represents an application job.
320 };
321 Q_ENUM(Type)
322
323 /**
324 * The notification urgency.
325 *
326 * @note jobs do not have an urgency, yet still might be above normal urgency notifications.
327 */
328 enum Urgency {
329 // these don't match the spec's value
330 LowUrgency = 1 << 0, ///< The notification has low urgency, it is not important and may not be shown or added to a history.
331 NormalUrgency = 1 << 1, ///< The notification has normal urgency. This is also the default if no urgecny is supplied.
332 CriticalUrgency = 1 << 2,
333 };
334 Q_ENUM(Urgency)
335 Q_DECLARE_FLAGS(Urgencies, Urgency)
336 Q_FLAG(Urgencies)
337
338 /**
339 * Which items should be cleared in a call to @c clear
340 */
342 ClearExpired = 1 << 1,
343 // TODO more
344 };
345 Q_ENUM(ClearFlag)
346 Q_DECLARE_FLAGS(ClearFlags, ClearFlag)
347 Q_FLAG(ClearFlags)
348
349 /**
350 * The state an application job is in.
351 */
352 enum JobState {
353 JobStateStopped, ///< The job is stopped. It has either finished (error is 0) or failed (error is not 0)
354 JobStateRunning, ///< The job is currently running.
355 JobStateSuspended, ///< The job is currentl paused
356 };
357 Q_ENUM(JobState)
358
359 /**
360 * The sort mode for the model.
361 */
362 enum SortMode {
363 SortByDate = 0, ///< Sort notifications strictly by the date they were updated or created.
364 // should this be flags? SortJobsFirst | SortByUrgency | ...?
365 SortByTypeAndUrgency, ///< Sort notifications taking into account their type and urgency. The order is (descending): Critical, jobs, Normal, Low.
366 };
367 Q_ENUM(SortMode)
368
369 /**
370 * The group mode for the model.
371 */
373 GroupDisabled = 0,
374 // GroupApplicationsTree, // TODO make actual tree
375 GroupApplicationsFlat,
376 };
377 Q_ENUM(GroupMode)
378
379 enum InvokeBehavior {
380 None = 0,
381 Close = 1,
382 };
383 Q_ENUM(InvokeBehavior)
384 Q_DECLARE_FLAGS(InvokeBehaviors, InvokeBehavior)
385 Q_FLAG(InvokeBehaviors)
386
387 int limit() const;
388 void setLimit(int limit);
389
390 bool showExpired() const;
391 void setShowExpired(bool show);
392
393 bool showDismissed() const;
394 void setShowDismissed(bool show);
395
396 bool showAddedDuringInhibition() const;
397 void setShowAddedDuringInhibition(bool show);
398
399 QStringList blacklistedDesktopEntries() const;
400 void setBlacklistedDesktopEntries(const QStringList &blacklist);
401
402 QStringList blacklistedNotifyRcNames() const;
403 void setBlacklistedNotifyRcNames(const QStringList &blacklist);
404
405 QStringList whitelistedDesktopEntries() const;
406 void setWhitelistedDesktopEntries(const QStringList &whitelist);
407
408 QStringList whitelistedNotifyRcNames() const;
409 void setWhitelistedNotifyRcNames(const QStringList &whitelist);
410
411 bool showNotifications() const;
412 void setShowNotifications(bool showNotifications);
413
414 bool showJobs() const;
415 void setShowJobs(bool showJobs);
416
417 Urgencies urgencies() const;
418 void setUrgencies(Urgencies urgencies);
419
420 SortMode sortMode() const;
421 void setSortMode(SortMode sortMode);
422
423 Qt::SortOrder sortOrder() const;
424 void setSortOrder(Qt::SortOrder sortOrder);
425
426 GroupMode groupMode() const;
427 void setGroupMode(GroupMode groupMode);
428
429 int groupLimit() const;
430 void setGroupLimit(int limit);
431
432 bool expandUnread() const;
433 void setExpandUnread(bool expand);
434
435 QWindow *window() const;
436 void setWindow(QWindow *window);
437
438 int count() const;
439
440 int activeNotificationsCount() const;
441 int expiredNotificationsCount() const;
442
443 QDateTime lastRead() const;
444 void setLastRead(const QDateTime &lastRead);
445 void resetLastRead();
446
447 int unreadNotificationsCount() const;
448 int dismissedResidentNotificationsCount() const;
449
450 int activeJobsCount() const;
451 int jobsPercentage() const;
452
453 /**
454 * Convert the given QModelIndex into a QPersistentModelIndex
455 */
456 Q_INVOKABLE QPersistentModelIndex makePersistentModelIndex(const QModelIndex &idx) const;
457
458 /**
459 * @brief Expire a notification
460 *
461 * Closes the notification in response to its timeout running out.
462 *
463 * Call this if you have an implementation that handles the timeout itself
464 * by having called @c stopTimeout
465 *
466 * @sa stopTimeout
467 */
468 Q_INVOKABLE void expire(const QModelIndex &idx);
469 /**
470 * @brief Close a notification
471 *
472 * Closes the notification in response to the user explicitly closing it.
473 *
474 * When the model index belongs to a group, the entire group is closed.
475 */
476 Q_INVOKABLE void close(const QModelIndex &idx);
477 /**
478 * @brief Configure a notification
479 *
480 * This will invoke the settings action, if available, otherwise open the
481 * kcm_notifications KCM for configuring the respective application and event.
482 */
483 Q_INVOKABLE void configure(const QModelIndex &idx); // TODO pass ctx for transient handling
484 /**
485 * @brief Invoke the default notification action
486 *
487 * Invokes the action that should be triggered when clicking
488 * the notification bubble itself.
489 */
490 Q_INVOKABLE void invokeDefaultAction(const QModelIndex &idx, InvokeBehavior behavior = None);
491 /**
492 * @brief Invoke a notification action
493 *
494 * Invokes the action with the given actionId on the notification.
495 * For invoking the default action, i.e. the one that is triggered
496 * when clicking the notification bubble, use invokeDefaultAction
497 */
498 Q_INVOKABLE void invokeAction(const QModelIndex &idx, const QString &actionId, InvokeBehavior = None);
499
500 /**
501 * @brief Reply to a notification
502 *
503 * Replies to the given notification with the given text.
504 * @since 5.18
505 */
506 Q_INVOKABLE void reply(const QModelIndex &idx, const QString &text, InvokeBehavior behavior);
507
508 /**
509 * @brief Start automatic timeout of notifications
510 *
511 * Call this if you no longer handle the timeout yourself.
512 *
513 * @sa stopTimeout
514 */
515 Q_INVOKABLE void startTimeout(const QModelIndex &idx);
516
517 Q_INVOKABLE void startTimeout(uint notificationId);
518 /**
519 * @brief Stop the automatic timeout of notifications
520 *
521 * Call this if you have an implementation that handles the timeout itself
522 * taking into account e.g. whether the user is currently interacting with
523 * the notification to not close it under their mouse. Call @c expire
524 * once your custom timer has run out.
525 *
526 * @sa expire
527 */
528 Q_INVOKABLE void stopTimeout(const QModelIndex &idx);
529
530 /**
531 * @brief Suspend a job
532 */
533 Q_INVOKABLE void suspendJob(const QModelIndex &idx);
534 /**
535 * @brief Resume a job
536 */
537 Q_INVOKABLE void resumeJob(const QModelIndex &idx);
538 /**
539 * @brief Kill a job
540 */
541 Q_INVOKABLE void killJob(const QModelIndex &idx);
542
543 /**
544 * @brief Clear notifications
545 *
546 * Removes the notifications matching th ClearFlags from the model.
547 * This can be used for e.g. a "Clear History" action.
548 */
549 Q_INVOKABLE void clear(ClearFlags flags);
550
551 /**
552 * Returns a model index pointing to the group of a notification.
553 */
554 Q_INVOKABLE QModelIndex groupIndex(const QModelIndex &idx) const;
555
556 Q_INVOKABLE void collapseAllGroups();
557
558 Q_INVOKABLE void playSoundHint(const QModelIndex &idx) const;
559
560 /**
561 * Shows a notification to report the number of unread inhibited notifications.
562 */
563 Q_INVOKABLE void showInhibitionSummary();
564
565 QVariant data(const QModelIndex &index, int role) const override;
566 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
567 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
568 QHash<int, QByteArray> roleNames() const override;
569
570 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
571 bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
572
573Q_SIGNALS:
574 void limitChanged();
575 void showExpiredChanged();
576 void showDismissedChanged();
577 void showAddedDuringInhibitionChanged();
578 void blacklistedDesktopEntriesChanged();
579 void blacklistedNotifyRcNamesChanged();
580 void whitelistedDesktopEntriesChanged();
581 void whitelistedNotifyRcNamesChanged();
582 void showNotificationsChanged();
583 void showJobsChanged();
584 void urgenciesChanged();
585 void sortModeChanged();
586 void sortOrderChanged();
587 void groupModeChanged();
588 void groupLimitChanged();
589 void expandUnreadChanged();
590 void countChanged();
591 void activeNotificationsCountChanged();
592 void expiredNotificationsCountChanged();
593 void lastReadChanged();
594 void unreadNotificationsCountChanged();
595 void dismissedResidentNotificationsCountChanged();
596 void activeJobsCountChanged();
597 void jobsPercentageChanged();
598 void windowChanged(QWindow *window);
599
600protected:
601 void classBegin() override;
602 void componentComplete() override;
603
604private:
605 class Private;
606 std::unique_ptr<Private> d;
607};
608
609} // namespace NotificationManager
610
611Q_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 dismissedResidentNotificationsCount
The number of resident notifications that have been dismissed.
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.
@ DismissableRole
Whether a notification can be dismissed (minimized).
@ 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 Apr 11 2025 11:52:44 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.