mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 12:19:03 +03:00
Remove seen Talk notificatios from Tray window.
Signed-off-by: alex-z <blackslayer4@gmail.com>
This commit is contained in:
parent
88b4c7ebeb
commit
b56200e0d7
4 changed files with 21 additions and 0 deletions
|
@ -689,6 +689,15 @@ void ActivityListModel::removeActivityFromActivityList(const Activity &activity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActivityListModel::checkAndRemoveSeenActivities(const OCC::ActivityList &newActivities)
|
||||||
|
{
|
||||||
|
for (const auto &activity : _finalList) {
|
||||||
|
if (activity._objectType == QStringLiteral("chat") && !newActivities.contains(activity)) {
|
||||||
|
removeActivityFromActivityList(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ActivityListModel::slotTriggerDefaultAction(const int activityIndex)
|
void ActivityListModel::slotTriggerDefaultAction(const int activityIndex)
|
||||||
{
|
{
|
||||||
if (activityIndex < 0 || activityIndex >= _finalList.size()) {
|
if (activityIndex < 0 || activityIndex >= _finalList.size()) {
|
||||||
|
|
|
@ -134,6 +134,8 @@ public slots:
|
||||||
void removeActivityFromActivityList(int row);
|
void removeActivityFromActivityList(int row);
|
||||||
void removeActivityFromActivityList(const OCC::Activity &activity);
|
void removeActivityFromActivityList(const OCC::Activity &activity);
|
||||||
|
|
||||||
|
void checkAndRemoveSeenActivities(const OCC::ActivityList &newActivities);
|
||||||
|
|
||||||
void setAccountState(OCC::AccountState *state);
|
void setAccountState(OCC::AccountState *state);
|
||||||
void setReplyMessageSent(const int activityIndex, const QString &message);
|
void setReplyMessageSent(const int activityIndex, const QString &message);
|
||||||
void setCurrentItem(const int currentItem);
|
void setCurrentItem(const int currentItem);
|
||||||
|
|
|
@ -221,13 +221,21 @@ void User::slotBuildNotificationDisplay(const ActivityList &list)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto chatNotificationsReceivedCount = 0;
|
||||||
|
|
||||||
for(const auto &activity : qAsConst(toNotifyList)) {
|
for(const auto &activity : qAsConst(toNotifyList)) {
|
||||||
if (activity._objectType == QStringLiteral("chat")) {
|
if (activity._objectType == QStringLiteral("chat")) {
|
||||||
|
++chatNotificationsReceivedCount;
|
||||||
showDesktopTalkNotification(activity);
|
showDesktopTalkNotification(activity);
|
||||||
} else {
|
} else {
|
||||||
showDesktopNotification(activity);
|
showDesktopNotification(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chatNotificationsReceivedCount < _lastChatNotificationsReceivedCount) {
|
||||||
|
_activityModel->checkAndRemoveSeenActivities(toNotifyList);
|
||||||
|
}
|
||||||
|
_lastChatNotificationsReceivedCount = chatNotificationsReceivedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void User::slotBuildIncomingCallDialogs(const ActivityList &list)
|
void User::slotBuildIncomingCallDialogs(const ActivityList &list)
|
||||||
|
|
|
@ -182,6 +182,8 @@ private:
|
||||||
// number of currently running notification requests. If non zero,
|
// number of currently running notification requests. If non zero,
|
||||||
// no query for notifications is started.
|
// no query for notifications is started.
|
||||||
int _notificationRequestsRunning = 0;
|
int _notificationRequestsRunning = 0;
|
||||||
|
|
||||||
|
int _lastChatNotificationsReceivedCount = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UserModel : public QAbstractListModel
|
class UserModel : public QAbstractListModel
|
||||||
|
|
Loading…
Reference in a new issue