Commit 48f040e5 authored by Marco Martin's avatar Marco Martin
Browse files

support notifications category

support notifications category hint
https://specifications.freedesktop.org/notification-spec/latest/ar01s06.html
as a property of Notification object and as a role of the models
parent 41e92ee9
...@@ -249,6 +249,8 @@ QVariant AbstractNotificationsModel::data(const QModelIndex &index, int role) co ...@@ -249,6 +249,8 @@ QVariant AbstractNotificationsModel::data(const QModelIndex &index, int role) co
case Notifications::ConfigurableRole: return notification.configurable(); case Notifications::ConfigurableRole: return notification.configurable();
case Notifications::ConfigureActionLabelRole: return notification.configureActionLabel(); case Notifications::ConfigureActionLabelRole: return notification.configureActionLabel();
case Notifications::CategoryRole: return notification.category();
case Notifications::ExpiredRole: return notification.expired(); case Notifications::ExpiredRole: return notification.expired();
case Notifications::ReadRole: return notification.read(); case Notifications::ReadRole: return notification.read();
......
...@@ -390,6 +390,8 @@ void Notification::Private::processHints(const QVariantMap &hints) ...@@ -390,6 +390,8 @@ void Notification::Private::processHints(const QVariantMap &hints)
replySubmitButtonText = hints.value(QStringLiteral("x-kde-reply-submit-button-text")).toString(); replySubmitButtonText = hints.value(QStringLiteral("x-kde-reply-submit-button-text")).toString();
replySubmitButtonIconName = hints.value(QStringLiteral("x-kde-reply-submit-button-icon-name")).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 // 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 // replaced by dashed hints in version 1.2. We need to support it for
// users of the 1.2 version of the spec. // users of the 1.2 version of the spec.
...@@ -733,6 +735,11 @@ QString Notification::replySubmitButtonIconName() const ...@@ -733,6 +735,11 @@ QString Notification::replySubmitButtonIconName() const
return d->replySubmitButtonIconName; return d->replySubmitButtonIconName;
} }
QString Notification::category() const
{
return d->category;
}
bool Notification::expired() const bool Notification::expired() const
{ {
return d->expired; return d->expired;
......
...@@ -123,6 +123,8 @@ public: ...@@ -123,6 +123,8 @@ public:
QString replySubmitButtonText() const; QString replySubmitButtonText() const;
QString replySubmitButtonIconName() const; QString replySubmitButtonIconName() const;
QString category() const;
bool expired() const; bool expired() const;
void setExpired(bool expired); void setExpired(bool expired);
......
...@@ -98,6 +98,8 @@ public: ...@@ -98,6 +98,8 @@ public:
QString replySubmitButtonText; QString replySubmitButtonText;
QString replySubmitButtonIconName; QString replySubmitButtonIconName;
QString category;
QList<QUrl> urls; QList<QUrl> urls;
QVariantMap hints = QVariantMap(); QVariantMap hints = QVariantMap();
......
...@@ -280,6 +280,7 @@ public: ...@@ -280,6 +280,7 @@ public:
ReplyPlaceholderTextRole, ///< A custom placeholder text for the reply action, e.g. "Reply to Max...". @since 5.18 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 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 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) Q_ENUM(Roles)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment