NotificationManager QML Type

The notification model, which handles freedesktop.org compliant notification requests. More...

Import Statement: import QtApplicationManager.SystemUI 2.0

Properties

Methods

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 nameTypeDescription
idintThe unique id of this notification.
applicationIdstringThe 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 applicationId role is neither unique within this model, nor is it guaranteed to be valid. A single application can have multiple active notifications, and on the other hand, system-notifications have no application context at all.

priorityintSee the client side documentation of Notification::priority
summarystringSee the client side documentation of Notification::summary
bodystringSee the client side documentation of Notification::body
categorystringSee the client side documentation of Notification::category
iconurlSee the client side documentation of Notification::icon
imageurlSee the client side documentation of Notification::image
actionsobjectSee the client side documentation of Notification::actions
showActionsAsIconsboolSee the client side documentation of Notification::showActionsAsIcons
dismissOnActionboolSee the client side documentation of Notification::dismissOnAction
isClickableboolSee the client side documentation of Notification::clickable
isSytemNotificationurlHolds true for notifications originating not from an application, but some system service. Always holds false for notifications coming from UI applications.
isShowingProgressboolSee the client side documentation of Notification::showProgress
progressqrealSee the client side documentation of Notification::progress
isStickyboolSee the client side documentation of Notification::sticky
timeoutintSee the client side documentation of Notification::timeout
extendedobjectSee the client side documentation of Notification::extended

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

[read-only] count : int

This property holds the number of active notifications in the model.


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.


int indexOfNotification(int id)

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.


triggerNotificationAction(int id, string actionId)

This function needs to be called by the System UI when the user triggered a notification action.

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.


© 2021 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.