mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Displays the actual notification subject in the system tray messages.
Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
0743c63c81
commit
a7dd3a7da1
2 changed files with 10 additions and 23 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue