[Pkg-owncloud-commits] [owncloud-client] 191/470: Notifications: remove notification widgets if the notification is gone.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:02 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit d407aacc4aa1b4862e2ffa3b90b393af62decdae
Author: Klaas Freitag <freitag at owncloud.com>
Date: Mon Mar 21 16:26:37 2016 +0100
Notifications: remove notification widgets if the notification is gone.
If a notification is not longer in the list that comes from the
server, the notification is removed.
That is mainly for the notifications that are created by the
announcement application
---
src/gui/activitywidget.cpp | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp
index 18418d0..ea96f12 100644
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@ -273,6 +273,30 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
}
}
+ // check if we have widgets that have no corresponding activity from
+ // the server any more. Collect them in a list
+ QList<int> strayCats;
+ foreach( auto id, _widgetForNotifId.keys() ) {
+ bool found = false;
+ foreach( auto activity, list ) {
+ if( activity._id == id ) {
+ // found an activity
+ found = true;
+ break;
+ }
+ }
+ if( ! found ) {
+ // the activity does not exist any more.
+ strayCats.append(id);
+ }
+ }
+ // .. and now delete all these stray cat widgets.
+ foreach( auto strayCatId, strayCats ) {
+ NotificationWidget *widgetToGo = _widgetForNotifId[strayCatId];
+ widgetToGo->deleteLater();
+ _widgetForNotifId.remove(strayCatId);
+ }
+
_ui->_notifyLabel->setHidden( _widgetForNotifId.isEmpty() );
_ui->_notifyScroll->setHidden( _widgetForNotifId.isEmpty() );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list