diff --git a/libnotificationmanager/abstractnotificationsmodel.cpp b/libnotificationmanager/abstractnotificationsmodel.cpp index b77dc1057..6b54ae699 100644 --- a/libnotificationmanager/abstractnotificationsmodel.cpp +++ b/libnotificationmanager/abstractnotificationsmodel.cpp @@ -249,6 +249,8 @@ QVariant AbstractNotificationsModel::data(const QModelIndex &index, int role) co case Notifications::ConfigurableRole: return notification.configurable(); case Notifications::ConfigureActionLabelRole: return notification.configureActionLabel(); + case Notifications::CategoryRole: return notification.category(); + case Notifications::ExpiredRole: return notification.expired(); case Notifications::ReadRole: return notification.read(); diff --git a/libnotificationmanager/notification.cpp b/libnotificationmanager/notification.cpp index 71889daa0..8c5ffad82 100644 --- a/libnotificationmanager/notification.cpp +++ b/libnotificationmanager/notification.cpp @@ -390,6 +390,8 @@ void Notification::Private::processHints(const QVariantMap &hints) replySubmitButtonText = hints.value(QStringLiteral("x-kde-reply-submit-button-text")).toString(); replySubmitButtonIconName = hints.value(QStringLiteral("x-kde-reply-submit-button-icon-name")).toString(); + category = hints.value(QStringLiteral("category")).toString(); + // Underscored hints was in use in version 1.1 of the spec but has been // replaced by dashed hints in version 1.2. We need to support it for // users of the 1.2 version of the spec. @@ -733,6 +735,11 @@ QString Notification::replySubmitButtonIconName() const return d->replySubmitButtonIconName; } +QString Notification::category() const +{ + return d->category; +} + bool Notification::expired() const { return d->expired; diff --git a/libnotificationmanager/notification.h b/libnotificationmanager/notification.h index 0ec777c5a..4e3342558 100644 --- a/libnotificationmanager/notification.h +++ b/libnotificationmanager/notification.h @@ -123,6 +123,8 @@ public: QString replySubmitButtonText() const; QString replySubmitButtonIconName() const; + QString category() const; + bool expired() const; void setExpired(bool expired); diff --git a/libnotificationmanager/notification_p.h b/libnotificationmanager/notification_p.h index 6585bcec2..43ba54a88 100644 --- a/libnotificationmanager/notification_p.h +++ b/libnotificationmanager/notification_p.h @@ -98,6 +98,8 @@ public: QString replySubmitButtonText; QString replySubmitButtonIconName; + QString category; + QList urls; QVariantMap hints = QVariantMap(); diff --git a/libnotificationmanager/notifications.h b/libnotificationmanager/notifications.h index c6bb955eb..cae1cce6e 100644 --- a/libnotificationmanager/notifications.h +++ b/libnotificationmanager/notifications.h @@ -280,6 +280,7 @@ public: ReplyPlaceholderTextRole, ///< A custom placeholder text for the reply action, e.g. "Reply to Max...". @since 5.18 ReplySubmitButtonTextRole, ///< A custom text for the reply submit button, e.g. "Submit Comment". @since 5.18 ReplySubmitButtonIconNameRole, ///< A custom icon name for the reply submit button. @since 5.18 + CategoryRole, ///< The (optional) category of the notification. Notifications can optionally have a type indicator. Although neither client or nor server must support this, some may choose to. Those servers implementing categories may use them to intelligently display the notification in a certain way, or group notifications of similar types. @since 5.21 }; Q_ENUM(Roles)