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 };
300 Q_ENUM(Roles)
301
302 /**
303 * The type of model item.
304 */
305 enum Type {
306 NoType,
307 NotificationType, ///< This item represents a notification.
308 JobType, ///< This item represents an application job.
309 };
310 Q_ENUM(Type)
311
312 /**
313 * The notification urgency.
314 *
315 * @note jobs do not have an urgency, yet still might be above normal urgency notifications.
316 */
317 enum Urgency {
318 // these don't match the spec's value
319 LowUrgency = 1 << 0, ///< The notification has low urgency, it is not important and may not be shown or added to a history.
320 NormalUrgency = 1 << 1, ///< The notification has normal urgency. This is also the default if no urgecny is supplied.
321 CriticalUrgency = 1 << 2,
322 };
323 Q_ENUM(Urgency)
324 Q_DECLARE_FLAGS(Urgencies, Urgency)
325 Q_FLAG(Urgencies)
326
327 /**
328 * Which items should be cleared in a call to @c clear
329 */
331 ClearExpired = 1 << 1,
332 // TODO more
333 };
334 Q_ENUM(ClearFlag)
335 Q_DECLARE_FLAGS(ClearFlags, ClearFlag)
336 Q_FLAG(ClearFlags)
337
338 /**
339 * The state an application job is in.
340 */
341 enum JobState {
342 JobStateStopped, ///< The job is stopped. It has either finished (error is 0) or failed (error is not 0)
343 JobStateRunning, ///< The job is currently running.
344 JobStateSuspended, ///< The job is currentl paused
345 };
346 Q_ENUM(JobState)
347
348 /**
349 * The sort mode for the model.
350 */
351 enum SortMode {
352 SortByDate = 0, ///< Sort notifications strictly by the date they were updated or created.
353 // should this be flags? SortJobsFirst | SortByUrgency | ...?
354 SortByTypeAndUrgency, ///< Sort notifications taking into account their type and urgency. The order is (descending): Critical, jobs, Normal, Low.
355 };
356 Q_ENUM(SortMode)
357
358 /**
359 * The group mode for the model.
360 */
362 GroupDisabled = 0,
363 // GroupApplicationsTree, // TODO make actual tree
364 GroupApplicationsFlat,
365 };
366 Q_ENUM(GroupMode)
367
368 enum InvokeBehavior {
369 None = 0,
370 Close = 1,
371 };
372 Q_ENUM(InvokeBehavior)
373 Q_DECLARE_FLAGS(InvokeBehaviors, InvokeBehavior)
374 Q_FLAG(InvokeBehaviors)
375
376 int limit() const;
377 void setLimit(int limit);
378
379 bool showExpired() const;
380 void setShowExpired(bool show);
381
382 bool showDismissed() const;
383 void setShowDismissed(bool show);
384
385 bool showAddedDuringInhibition() const;
386 void setShowAddedDuringInhibition(bool show);
387
388 QStringList blacklistedDesktopEntries() const;
389 void setBlacklistedDesktopEntries(const QStringList &blacklist);
390
391 QStringList blacklistedNotifyRcNames() const;
392 void setBlacklistedNotifyRcNames(const QStringList &blacklist);
393
394 QStringList whitelistedDesktopEntries() const;
395 void setWhitelistedDesktopEntries(const QStringList &whitelist);
396
397 QStringList whitelistedNotifyRcNames() const;
398 void setWhitelistedNotifyRcNames(const QStringList &whitelist);
399
400 bool showNotifications() const;
401 void setShowNotifications(bool showNotifications);
402
403 bool showJobs() const;
404 void setShowJobs(bool showJobs);
405
406 Urgencies urgencies() const;
407 void setUrgencies(Urgencies urgencies);
408
409 SortMode sortMode() const;
410 void setSortMode(SortMode sortMode);
411
412 Qt::SortOrder sortOrder() const;
413 void setSortOrder(Qt::SortOrder sortOrder);
414
415 GroupMode groupMode() const;
416 void setGroupMode(GroupMode groupMode);
417
418 int groupLimit() const;
419 void setGroupLimit(int limit);
420
421 bool expandUnread() const;
422 void setExpandUnread(bool expand);
423
424 QWindow *window() const;
425 void setWindow(QWindow *window);
426
427 int count() const;
428
429 int activeNotificationsCount() const;
430 int expiredNotificationsCount() const;
431
432 QDateTime lastRead() const;
433 void setLastRead(const QDateTime &lastRead);
434 void resetLastRead();
435
436 int unreadNotificationsCount() const;
437
438 int activeJobsCount() const;
439 int jobsPercentage() const;
440
441 /**
442 * Convert the given QModelIndex into a QPersistentModelIndex
443 */
444 Q_INVOKABLE QPersistentModelIndex makePersistentModelIndex(const QModelIndex &idx) const;
445
446 /**
447 * @brief Expire a notification
448 *
449 * Closes the notification in response to its timeout running out.
450 *
451 * Call this if you have an implementation that handles the timeout itself
452 * by having called @c stopTimeout
453 *
454 * @sa stopTimeout
455 */
456 Q_INVOKABLE void expire(const QModelIndex &idx);
457 /**
458 * @brief Close a notification
459 *
460 * Closes the notification in response to the user explicitly closing it.
461 *
462 * When the model index belongs to a group, the entire group is closed.
463 */
464 Q_INVOKABLE void close(const QModelIndex &idx);
465 /**
466 * @brief Configure a notification
467 *
468 * This will invoke the settings action, if available, otherwise open the
469 * kcm_notifications KCM for configuring the respective application and event.
470 */
471 Q_INVOKABLE void configure(const QModelIndex &idx); // TODO pass ctx for transient handling
472 /**
473 * @brief Invoke the default notification action
474 *
475 * Invokes the action that should be triggered when clicking
476 * the notification bubble itself.
477 */
478 Q_INVOKABLE void invokeDefaultAction(const QModelIndex &idx, InvokeBehavior behavior = None);
479 /**
480 * @brief Invoke a notification action
481 *
482 * Invokes the action with the given actionId on the notification.
483 * For invoking the default action, i.e. the one that is triggered
484 * when clicking the notification bubble, use invokeDefaultAction
485 */
486 Q_INVOKABLE void invokeAction(const QModelIndex &idx, const QString &actionId, InvokeBehavior = None);
487
488 /**
489 * @brief Reply to a notification
490 *
491 * Replies to the given notification with the given text.
492 * @since 5.18
493 */
494 Q_INVOKABLE void reply(const QModelIndex &idx, const QString &text, InvokeBehavior behavior);
495
496 /**
497 * @brief Start automatic timeout of notifications
498 *
499 * Call this if you no longer handle the timeout yourself.
500 *
501 * @sa stopTimeout
502 */
503 Q_INVOKABLE void startTimeout(const QModelIndex &idx);
504
505 Q_INVOKABLE void startTimeout(uint notificationId);
506 /**
507 * @brief Stop the automatic timeout of notifications
508 *
509 * Call this if you have an implementation that handles the timeout itself
510 * taking into account e.g. whether the user is currently interacting with
511 * the notification to not close it under their mouse. Call @c expire
512 * once your custom timer has run out.
513 *
514 * @sa expire
515 */
516 Q_INVOKABLE void stopTimeout(const QModelIndex &idx);
517
518 /**
519 * @brief Suspend a job
520 */
521 Q_INVOKABLE void suspendJob(const QModelIndex &idx);
522 /**
523 * @brief Resume a job
524 */
525 Q_INVOKABLE void resumeJob(const QModelIndex &idx);
526 /**
527 * @brief Kill a job
528 */
529 Q_INVOKABLE void killJob(const QModelIndex &idx);
530
531 /**
532 * @brief Clear notifications
533 *
534 * Removes the notifications matching th ClearFlags from the model.
535 * This can be used for e.g. a "Clear History" action.
536 */
537 Q_INVOKABLE void clear(ClearFlags flags);
538
539 /**
540 * Returns a model index pointing to the group of a notification.
541 */
542 Q_INVOKABLE QModelIndex groupIndex(const QModelIndex &idx) const;
543
544 Q_INVOKABLE void collapseAllGroups();
545
546 /**
547 * Shows a notification to report the number of unread inhibited notifications.
548 */
549 Q_INVOKABLE void showInhibitionSummary();
550
551 QVariant data(const QModelIndex &index, int role) const override;
552 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
553 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
554 QHash<int, QByteArray> roleNames() const override;
555
556 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
557 bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
558
559Q_SIGNALS:
560 void limitChanged();
561 void showExpiredChanged();
562 void showDismissedChanged();
563 void showAddedDuringInhibitionChanged();
564 void blacklistedDesktopEntriesChanged();
565 void blacklistedNotifyRcNamesChanged();
566 void whitelistedDesktopEntriesChanged();
567 void whitelistedNotifyRcNamesChanged();
568 void showNotificationsChanged();
569 void showJobsChanged();
570 void urgenciesChanged();
571 void sortModeChanged();
572 void sortOrderChanged();
573 void groupModeChanged();
574 void groupLimitChanged();
575 void expandUnreadChanged();
576 void countChanged();
577 void activeNotificationsCountChanged();
578 void expiredNotificationsCountChanged();
579 void lastReadChanged();
580 void unreadNotificationsCountChanged();
581 void activeJobsCountChanged();
582 void jobsPercentageChanged();
583 void windowChanged(QWindow *window);
584
585protected:
586 void classBegin() override;
587 void componentComplete() override;
588
589private:
590 class Private;
591 std::unique_ptr<Private> d;
592};
593
594} // namespace NotificationManager
595
596Q_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.
@ 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 Feb 21 2025 11:51:10 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.