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

[Notifications] For group parents combine the child bodies

This enables some basic grouping when pointing a list at the group parents instead of the individual child elements.
Effectively unused right now (popups don't group and history only shows the application name for sections)
but this is in preparation for being able to have groups in the popup as well.

Differential Revision: https://phabricator.kde.org/D27130
parent 4b286d7c
......@@ -465,7 +465,6 @@ QVariant NotificationGroupingProxyModel::data(const QModelIndex &proxyIndex, int
}
if (isGroup) {
// For group parent items, DisplayRole is mapped to AppName of the first child.
switch (role) {
case Notifications::IsGroupRole:
return true;
......@@ -474,6 +473,21 @@ QVariant NotificationGroupingProxyModel::data(const QModelIndex &proxyIndex, int
case Notifications::IsInGroupRole:
return false;
// Combine all notifications into one for some basic grouping
case Notifications::BodyRole: {
QString body;
for (int i = 0; i < rowCount(proxyIndex); ++i) {
const QString stringData = index(i, 0, proxyIndex).data(role).toString();
if (!stringData.isEmpty()) {
if (!body.isEmpty()) {
body.append(QLatin1String("<br>"));
}
body.append(stringData);
}
}
return body;
}
case Notifications::DesktopEntryRole:
case Notifications::NotifyRcNameRole:
case Notifications::OriginNameRole:
......
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