Do not display dismissed notifications

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-02-01 14:39:59 +01:00
parent ae7ad8fb4f
commit 86251ff2e3
No known key found for this signature in database
GPG key ID: F941078878347C0C
3 changed files with 13 additions and 8 deletions

View file

@ -233,6 +233,12 @@ void ActivityListModel::addNotificationToActivityList(Activity activity) {
combineActivityLists();
}
void ActivityListModel::clearNotifications() {
qCInfo(lcActivity) << "Clear the notifications";
_notificationLists.clear();
combineActivityLists();
}
void ActivityListModel::removeActivityFromActivityList(int row) {
Activity activity = _finalList.at(row);
removeActivityFromActivityList(activity);

View file

@ -49,6 +49,7 @@ public:
ActivityList activityList() { return _finalList; }
ActivityList errorsList() { return _notificationErrorsLists; }
void addNotificationToActivityList(Activity activity);
void clearNotifications();
void addErrorToActivityList(Activity activity);
void addSyncFileItemToActivityList(Activity activity);
void removeActivityFromActivityList(int row);

View file

@ -430,20 +430,17 @@ void ActivityWidget::slotOpenFile(QModelIndex indx)
// collected.
void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list)
{
QString listAccountName;
// Whether a new notification was added to the list
bool newNotificationShown = false;
_model->clearNotifications();
foreach (auto activity, list) {
if (_blacklistedNotifications.contains(activity)) {
qCInfo(lcActivity) << "Activity in blacklist, skip";
continue;
}
// remember the list account name for the strayCat handling below.
listAccountName = activity._accName;
// handle gui logs. In order to NOT annoy the user with every fetching of the
// notifications the notification id is stored in a Set. Only if an id
// is not in the set, it qualifies for guiLog.
@ -468,14 +465,15 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list)
emit guiLog(activity._subject, activity._accName);
}
}
_model->addNotificationToActivityList(activity);
}
_model->addNotificationToActivityList(activity);
}
// restart the gui log timer now that we show a new notification
if(newNotificationShown)
if(newNotificationShown) {
_guiLogTimer.start();
}
}
void ActivityWidget::slotSendNotificationRequest(const QString &accountName, const QString &link, const QByteArray &verb, int row)