NotificationManager QML Type
The notification model, which handles freedesktop.org compliant notification requests. More...
Import Statement: | import QtApplicationManager.SystemUI 2.0 |
Properties
- count : int
Signals
- notificationAboutToBeRemoved(uint id)
- notificationAdded(uint id)
- notificationChanged(uint id, list<string> changedRoles)
Methods
- acknowledgeNotification(int id)
- dismissNotification(int id)
- object get(int index)
- int indexOfNotification(int id)
- object notification(int id)
- triggerNotificationAction(int id, string actionId)
Detailed Description
The NotificationManager singleton type provides a QML API only.
The type is derived from QAbstractListModel and can be directly used as a model in notification views.
Each item in this model corresponds to an active notification.
The following roles are available in this model - also take a look at the freedesktop.org specification for an in-depth explanation of these fields and how clients should populate them:
Role name | Type | Description |
---|---|---|
id | int | The unique id of this notification. |
applicationId | string | The id of the application that created this notification. This can be used to look up information about the application in the ApplicationManager model. Note: The |
priority | int | See the client side documentation of Notification::priority |
summary | string | See the client side documentation of Notification::summary |
body | string | See the client side documentation of Notification::body |
category | string | See the client side documentation of Notification::category |
icon | url | See the client side documentation of Notification::icon |
image | url | See the client side documentation of Notification::image |
actions | object | See the client side documentation of Notification::actions. This is a list where each item is a single property (the key is the actionId and the value the actionText). Easier access is provided with the actionList role below. |
actionList | object | See the client side documentation of Notification::actions. In contrast to the actions object above actions are provided as a list with actionId and actionText properties |
showActionsAsIcons | bool | See the client side documentation of Notification::showActionsAsIcons |
dismissOnAction | bool | See the client side documentation of Notification::dismissOnAction |
isAcknowledgeable | bool | See the client side documentation of Notification::acknowledgeable For backwards compatibility, isClickable can also be used to refer to this role. |
isSytemNotification | url | Holds true for notifications originating not from an application, but some system service. Always holds false for notifications coming from UI applications. |
isShowingProgress | bool | See the client side documentation of Notification::showProgress |
progress | qreal | See the client side documentation of Notification::progress |
isSticky | bool | See the client side documentation of Notification::sticky |
timeout | int | See the client side documentation of Notification::timeout |
extended | object | See the client side documentation of Notification::extended |
created | date | The timestamp denoting when the notification was created |
updated | date | The timestamp denoting when the notification was last modififed |
The actual backend implementation that is receiving the notifications from other process is fully compliant to the D-Bus interface of the freedesktop.org specification for notifications.
For testing purposes, the notify-send tool from the libnotify package can be used to create notifications.
Property Documentation
count : int |
This property holds the number of active notifications in the model.
Signal Documentation
notificationAboutToBeRemoved(uint id) |
This signal is emitted before an existing notification, identified by id, is removed from the model.
Note: In addition to the normal "low-level" QAbstractListModel signals, the application manager will also emit these "high-level" signals for System UIs that cannot work directly on the NotificationManager model: notificationAdded, notificationAboutToBeRemoved and notificationChanged.
Note: The corresponding handler is onNotificationAboutToBeRemoved
.
notificationAdded(uint id) |
This signal is emitted after a new notification, identified by id, has been added. The model has already been update before this signal is sent out.
Note: In addition to the normal "low-level" QAbstractListModel signals, the application manager will also emit these "high-level" signals for System UIs that cannot work directly on the NotificationManager model: notificationAdded, notificationAboutToBeRemoved and notificationChanged.
Note: The corresponding handler is onNotificationAdded
.
Emitted whenever one or more data roles, denoted by changedRoles, changed on the notification identified by id. An empty list in the changedRoles argument means that all roles should be considered modified.
Note: In addition to the normal "low-level" QAbstractListModel signals, the application manager will also emit these "high-level" signals for System UIs that cannot work directly on the NotificationManager model: notificationAdded, notificationAboutToBeRemoved and notificationChanged.
Note: The corresponding handler is onNotificationChanged
.
Method Documentation
acknowledgeNotification(int id) |
This function needs to be called by the System UI when the user acknowledged the notification identified by id (most likely by clicking on it).
dismissNotification(int id) |
This function needs to be called by the System UI when the notification identified by id is no longer needed.
The creator of the notification will be notified about this dismissal.
object get(int index) |
Retrieves the model data at index as a JavaScript object. See the role names for the expected object fields.
Returns an empty object if the specified index is invalid.
Maps the notification id to its position within the model.
Returns -1
if the specified id is invalid.
object notification(int id) |
Retrieves the model data for the notification identified by id as a JavaScript object. See the role names for the expected object fields.
Returns an empty object if the specified id is invalid.
This function needs to be called by the System UI when the user triggered a notification action. Unless the notification is made resident (dismissOnAction
is false
), the notification will also be dismissed.
The notification is identified by id and the action by actionId.
Note: You should only use action-ids that have been set for the the given notification (see the actions role). However, the application manager will accept and forward any arbitrary string. Be aware that this string is broadcast on the session D-Bus when running in multi-process mode.
See also dismissNotification().
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.