diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2015-06-26 17:58:34 +0300 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2015-06-26 17:58:34 +0300 |
commit | 236951d9b33c4fe899e23b20cfee2b34ee8566aa (patch) | |
tree | 97a858712e2f50a88924db6d7f503e6784ec04bc /src/gui/quotainfo.cpp | |
parent | e7d76461516df14dcdb2f128d5cde6ef81f545d8 (diff) |
QuotaInfo: allow only one job at the same time
Diffstat (limited to 'src/gui/quotainfo.cpp')
-rw-r--r-- | src/gui/quotainfo.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/quotainfo.cpp b/src/gui/quotainfo.cpp index 8098245fe..0b2475f6c 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) |