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
This commit is contained in:
parent
1d78a2d288
commit
5d4821fb9c
3 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue