Commit 5d4821fb authored by Nicolas Fella's avatar Nicolas Fella

Only show notification title in plasmoid if different to app name

Summary: Like we do for the notifications in the plugin already. Passing the title and text separately to the plasmoid could be useful later as well.

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D7457
parent 1d78a2d2
......@@ -62,6 +62,8 @@ QHash<int, QByteArray> NotificationsModel::roleNames() const
names.insert(DismissableModelRole, "dismissable");
names.insert(RepliableModelRole, "repliable");
names.insert(IconPathModelRole, "appIcon");
names.insert(TitleModelRole, "title");
names.insert(TextModelRole, "notitext");
return names;
}
......@@ -198,6 +200,10 @@ QVariant NotificationsModel::data(const QModelIndex& index, int role) const
return !notification->replyId().isEmpty();
case IconPathModelRole:
return notification->iconPath();
case TitleModelRole:
return notification->title();
case TextModelRole:
return notification->text();
default:
return QVariant();
}
......
......@@ -46,7 +46,9 @@ public:
DismissableModelRole,
RepliableModelRole,
IconPathModelRole,
DbusInterfaceRole
DbusInterfaceRole,
TitleModelRole,
TextModelRole
};
explicit NotificationsModel(QObject* parent = nullptr);
......
......@@ -228,7 +228,7 @@ PlasmaComponents.ListItem
anchors.left: parent.left
}
PlasmaComponents.Label {
text: appName + ": " + display
text: appName + ": " + (title.length>0 ? (appName==title?notitext:title+": "+notitext) : display)
anchors.right: replyButton.left
anchors.left: notificationIcon.right
elide: listitem.checked ? Text.ElideNone : Text.ElideRight
......
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