From a7dd3a7da14db1bb0bd59a130d56495f2427295a Mon Sep 17 00:00:00 2001 From: Camila San Date: Mon, 12 Feb 2018 22:15:36 +0100 Subject: [PATCH] Displays the actual notification subject in the system tray messages. Signed-off-by: Camila San --- src/gui/activitylistmodel.cpp | 3 +++ src/gui/activitywidget.cpp | 30 +++++++----------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/gui/activitylistmodel.cpp b/src/gui/activitylistmodel.cpp index 33e57690d..f42e6da10 100644 --- a/src/gui/activitylistmodel.cpp +++ b/src/gui/activitylistmodel.cpp @@ -152,6 +152,9 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st foreach (auto activ, activities) { auto json = activ.toObject(); + qDebug() << "Activity list" + << json.value("subject").toString(); + Activity a; a._type = Activity::ActivityType; a._accName = ast->account()->displayName(); diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp index 8a29d9152..353fe4fef 100644 --- a/src/gui/activitywidget.cpp +++ b/src/gui/activitywidget.cpp @@ -248,6 +248,8 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list) bool newNotificationShown = false; foreach (auto activity, list) { + qDebug() << "Notification list" + << activity._subject; if (_blacklistedNotifications.contains(activity)) { qCInfo(lcActivity) << "Activity in blacklist, skip"; continue; @@ -304,6 +306,10 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list) } _guiLoggedNotifications.insert(activity._id); } + + // Assemble a tray notification + QString log = tr("Notification for %1.").arg(activity._accName); + emit guiLog(log, activity._subject); } // check if there are widgets that have no corresponding activity from @@ -339,31 +345,9 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list) checkActivityTabVisibility(); - int newGuiLogCount = accNotified.count(); - - if (newGuiLogCount > 0) { + if (newNotificationShown) { // restart the gui log timer now that we show a notification _guiLogTimer.start(); - - // Assemble a tray notification - QString msg = tr("You received %n new notification(s) from %2.", "", accNotified[accNotified.keys().at(0)]).arg(accNotified.keys().at(0)); - - if (newGuiLogCount >= 2) { - QString acc1 = accNotified.keys().at(0); - QString acc2 = accNotified.keys().at(1); - if (newGuiLogCount == 2) { - int notiCount = accNotified[acc1] + accNotified[acc2]; - msg = tr("You received %n new notification(s) from %1 and %2.", "", notiCount).arg(acc1, acc2); - } else { - msg = tr("You received new notifications from %1, %2 and other accounts.").arg(acc1, acc2); - } - } - - const QString log = tr("%1 Notifications - Action Required").arg(Theme::instance()->appNameGUI()); - emit guiLog(log, msg); - } - - if (newNotificationShown) { emit newNotification(); } }