[Pkg-owncloud-commits] [owncloud-client] 205/498: QuotaInfo: allow only one job at the same time

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:50 UTC 2015


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 236951d9b33c4fe899e23b20cfee2b34ee8566aa
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Fri Jun 26 16:58:34 2015 +0200

    QuotaInfo: allow only one job at the same time
---
 src/gui/quotainfo.cpp | 15 ++++++++++-----
 src/gui/quotainfo.h   |  2 ++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/gui/quotainfo.cpp b/src/gui/quotainfo.cpp
index 8098245..0b2475f 100644
--- a/src/gui/quotainfo.cpp
+++ b/src/gui/quotainfo.cpp
@@ -85,12 +85,17 @@ void QuotaInfo::slotCheckQuota()
         return;
     }
 
+    if (_job) {
+        // The previous job was not finished?  Then we cancel it!
+        _job->deleteLater();
+    }
+
     AccountPtr account = _accountState->account();
-    PropfindJob *job = new PropfindJob(account, "/", this);
-    job->setProperties(QList<QByteArray>() << "quota-available-bytes" << "quota-used-bytes");
-    connect(job, SIGNAL(result(QVariantMap)), SLOT(slotUpdateLastQuota(QVariantMap)));
-    connect(job, SIGNAL(networkError(QNetworkReply*)), SLOT(slotRequestFailed()));
-    job->start();
+    _job = new PropfindJob(account, "/", this);
+    _job->setProperties(QList<QByteArray>() << "quota-available-bytes" << "quota-used-bytes");
+    connect(_job, SIGNAL(result(QVariantMap)), SLOT(slotUpdateLastQuota(QVariantMap)));
+    connect(_job, SIGNAL(networkError(QNetworkReply*)), SLOT(slotRequestFailed()));
+    _job->start();
 }
 
 void QuotaInfo::slotUpdateLastQuota(const QVariantMap &result)
diff --git a/src/gui/quotainfo.h b/src/gui/quotainfo.h
index 583d1ed..cfd2b31 100644
--- a/src/gui/quotainfo.h
+++ b/src/gui/quotainfo.h
@@ -22,6 +22,7 @@
 
 namespace OCC {
 class AccountState;
+class PropfindJob;
 
 /**
  * This class handle the getting the quota to display in the UI
@@ -71,6 +72,7 @@ private:
     QTimer _jobRestartTimer;
     QDateTime _lastQuotaRecieved; // the time at which de quota was recieved last
     bool _active; // if we should check at regular interval (when the UI is visible)
+    QPointer<PropfindJob> _job; // the currently running job
 };
 
 

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