Commit ee787241 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Notifications] Group only same origin and show it in heading

This makes it group notifications of different "origins" not group together,
e.g. FooApp notifications from phone A won't be grouped together with FooApp notifications from phone B.
Also, email notifications from different accounts wouldn't be grouped together.
Finally, show the origin in the grouped header.

Differential Revision: https://phabricator.kde.org/D23583
parent 6c728dd1
......@@ -391,6 +391,7 @@ ColumnLayout{
NotificationHeader {
applicationName: model.applicationName
applicationIconSource: model.applicationIconName
originName: model.originName || ""
// don't show timestamp for group
......
......@@ -43,8 +43,12 @@ bool NotificationGroupingProxyModel::appsMatch(const QModelIndex &a, const QMode
const QString aDesktopEntry = a.data(Notifications::DesktopEntryRole).toString();
const QString bDesktopEntry = b.data(Notifications::DesktopEntryRole).toString();
const QString aOriginName = a.data(Notifications::OriginNameRole).toString();
const QString bOriginName = a.data(Notifications::OriginNameRole).toString();
return !aName.isEmpty() && aName == bName
&& aDesktopEntry == bDesktopEntry;
&& aDesktopEntry == bDesktopEntry
&& aOriginName == bOriginName;
}
bool NotificationGroupingProxyModel::isGroup(int row) const
......@@ -471,23 +475,16 @@ QVariant NotificationGroupingProxyModel::data(const QModelIndex &proxyIndex, int
return false;
case Notifications::DesktopEntryRole:
for (int i = 0; i < rowCount(proxyIndex); ++i) {
const QString desktopEntry = index(i, 0, proxyIndex).data(Notifications::DesktopEntryRole).toString();
if (!desktopEntry.isEmpty()) {
return desktopEntry;
}
}
return QString();
case Notifications::NotifyRcNameRole:
case Notifications::OriginNameRole:
for (int i = 0; i < rowCount(proxyIndex); ++i) {
const QString notifyRcName = index(i, 0, proxyIndex).data(Notifications::NotifyRcNameRole).toString();
if (!notifyRcName.isEmpty()) {
return notifyRcName;
const QString stringData = index(i, 0, proxyIndex).data(role).toString();
if (!stringData.isEmpty()) {
return stringData;
}
}
return QString();
case Notifications::ConfigurableRole: // if there is any configurable child item
for (int i = 0; i < rowCount(proxyIndex); ++i) {
if (index(i, 0, proxyIndex).data(Notifications::ConfigurableRole).toBool()) {
......
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