[Pkg-owncloud-commits] [owncloud-client] 194/470: Notifications: Maintain a timeSinceLastCheck for every Account.

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 d03fcc95e4d50d6978509bca6e7d01085375e917
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Mar 22 09:58:30 2016 +0100

    Notifications: Maintain a timeSinceLastCheck for every Account.
    
    In multi-account environment every account needs the own counter.
---
 src/gui/activitywidget.cpp | 12 +++++++-----
 src/gui/activitywidget.h   |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp
index ea96f12..68e7d67 100644
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@ -516,9 +516,11 @@ void ActivitySettings::slotRemoveAccount( AccountState *ptr )
 
 void ActivitySettings::slotRefresh( AccountState* ptr )
 {
+    QElapsedTimer timer = _timeSinceLastCheck[ptr];
+
     // Fetch Activities only if visible and if last check is longer than 15 secs ago
-    if( _timeSinceLastCheck.isValid() && _timeSinceLastCheck.elapsed() < NOTIFICATION_REQUEST_FREE_PERIOD ) {
-        qDebug() << Q_FUNC_INFO << "do not check as last check is only secs ago: " << _timeSinceLastCheck.elapsed() / 1000;
+    if( timer.isValid() && timer.elapsed() < NOTIFICATION_REQUEST_FREE_PERIOD ) {
+        qDebug() << Q_FUNC_INFO << "do not check as last check is only secs ago: " << timer.elapsed() / 1000;
         return;
     }
     if( ptr && ptr->isConnected() ) {
@@ -527,10 +529,10 @@ void ActivitySettings::slotRefresh( AccountState* ptr )
             _activityWidget->slotRefreshActivities( ptr);
         }
         _activityWidget->slotRefreshNotifications(ptr);
-        if( !_timeSinceLastCheck.isValid() ) {
-            _timeSinceLastCheck.start();
+        if( !( _timeSinceLastCheck[ptr].isValid() ) ) {
+            _timeSinceLastCheck[ptr].start();
         } else {
-            _timeSinceLastCheck.restart();
+            _timeSinceLastCheck[ptr].restart();
         }
     }
 }
diff --git a/src/gui/activitywidget.h b/src/gui/activitywidget.h
index acbab0d..cf6d732 100644
--- a/src/gui/activitywidget.h
+++ b/src/gui/activitywidget.h
@@ -142,7 +142,7 @@ private:
     ProtocolWidget *_protocolWidget;
     QProgressIndicator *_progressIndicator;
     QTimer         _notificationCheckTimer;
-    QElapsedTimer  _timeSinceLastCheck;
+    QHash<AccountState*, QElapsedTimer>  _timeSinceLastCheck;
 };
 
 }

-- 
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