diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2013-11-21 18:33:37 +0400 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2013-11-25 18:34:16 +0400 |
commit | 0a2861a7318e354ad126e358c490134719ec3b40 (patch) | |
tree | a9a933c78de9e1c5c010c93e2ca717e7d2883701 /src | |
parent | 6f17131e3c9241eaaa3c616f3b446894f4581a2c (diff) |
Disable quota polling when default account does not exist or is offline
Diffstat (limited to 'src')
-rw-r--r-- | src/mirall/quotainfo.cpp | 12 | ||||
-rw-r--r-- | src/mirall/quotainfo.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/mirall/quotainfo.cpp b/src/mirall/quotainfo.cpp index 2c2b70d48..3a9994ec9 100644 --- a/src/mirall/quotainfo.cpp +++ b/src/mirall/quotainfo.cpp @@ -41,8 +41,18 @@ QuotaInfo::QuotaInfo(QObject *parent) void QuotaInfo::slotAccountChanged(Account *newAccount, Account *oldAccount) { - Q_UNUSED(oldAccount); _account = newAccount; + disconnect(oldAccount, SIGNAL(onlineStateChanged(bool)), this, SLOT(slotOnlineStateChanged(bool))); + connect(newAccount, SIGNAL(onlineStateChanged(bool)), this, SLOT(slotOnlineStateChanged(bool))); +} + +void QuotaInfo::slotOnlineStateChanged(bool online) +{ + if (online) { + _refreshTimer->start(); + } else { + _refreshTimer->stop(); + } } void QuotaInfo::slotCheckQuota() diff --git a/src/mirall/quotainfo.h b/src/mirall/quotainfo.h index a8dd04d24..294a3928c 100644 --- a/src/mirall/quotainfo.h +++ b/src/mirall/quotainfo.h @@ -34,6 +34,7 @@ public Q_SLOTS: private Q_SLOTS: void slotAccountChanged(Account *newAccount, Account *oldAccount); + void slotOnlineStateChanged(bool online); Q_SIGNALS: void quotaUpdated(qint64 total, qint64 used); |