[Pkg-owncloud-commits] [owncloud-client] 195/470: Notifications: Fix handling of notifications to remove from the list.
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 ad60e8ac8956b7d00045d9e08b75b17125ce1d61
Author: Klaas Freitag <freitag at owncloud.com>
Date: Tue Mar 22 10:35:24 2016 +0100
Notifications: Fix handling of notifications to remove from the list.
If a notification is not longer in the list of notifications coming from
the server, it needs to be removed from the widget list.
---
src/gui/activitywidget.cpp | 18 ++++++++++++++++--
src/gui/notificationwidget.cpp | 5 +++++
src/gui/notificationwidget.h | 1 +
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp
index 68e7d67..08b9195 100644
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@ -221,10 +221,14 @@ void ActivityWidget::slotOpenFile(QModelIndex indx)
}
}
-// GUI: Display the notifications
+// GUI: Display the notifications.
+// All notifications in list are coming from the same account
+// but in the _widgetForNotifId hash widgets for all accounts are
+// collected.
void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
{
QHash<QString, int> accNotified;
+ QString listAccountName;
foreach( auto activity, list ) {
NotificationWidget *widget = 0;
@@ -243,6 +247,9 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
widget->setActivity( activity );
+ // 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.
@@ -278,6 +285,12 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
QList<int> strayCats;
foreach( auto id, _widgetForNotifId.keys() ) {
bool found = false;
+ NotificationWidget *widget = _widgetForNotifId[id];
+
+ // do not mark widgets of other accounts to delete.
+ if( widget->accountName() != listAccountName ) {
+ continue;
+ }
foreach( auto activity, list ) {
if( activity._id == id ) {
// found an activity
@@ -290,6 +303,7 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
strayCats.append(id);
}
}
+
// .. and now delete all these stray cat widgets.
foreach( auto strayCatId, strayCats ) {
NotificationWidget *widgetToGo = _widgetForNotifId[strayCatId];
@@ -297,7 +311,7 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
_widgetForNotifId.remove(strayCatId);
}
- _ui->_notifyLabel->setHidden( _widgetForNotifId.isEmpty() );
+ _ui->_notifyLabel->setHidden( _widgetForNotifId.isEmpty() );
_ui->_notifyScroll->setHidden( _widgetForNotifId.isEmpty() );
int newGuiLogCount = accNotified.count();
diff --git a/src/gui/notificationwidget.cpp b/src/gui/notificationwidget.cpp
index de28c7c..2e398a6 100644
--- a/src/gui/notificationwidget.cpp
+++ b/src/gui/notificationwidget.cpp
@@ -65,6 +65,11 @@ void NotificationWidget::setActivity(const Activity& activity)
}
}
+QString NotificationWidget::accountName() const
+{
+ return _myActivity._accName;
+}
+
void NotificationWidget::slotButtonClicked()
{
QObject *buttonWidget = QObject::sender();
diff --git a/src/gui/notificationwidget.h b/src/gui/notificationwidget.h
index 8c14339..adafd43 100644
--- a/src/gui/notificationwidget.h
+++ b/src/gui/notificationwidget.h
@@ -33,6 +33,7 @@ public:
explicit NotificationWidget(QWidget *parent = 0);
bool readyToClose();
+ QString accountName() const;
signals:
void sendNotificationRequest( const QString&, const QString& link, const QString& verb);
--
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