[Pkg-owncloud-commits] [owncloud-client] 193/484: Quota: handle special negative value for the quota #3940

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:42 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 a127debc54c001e3d47f4d0e4b54bce01ad797f7
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Oct 29 14:33:29 2015 +0100

    Quota: handle special negative value for the quota #3940
    
    Don't show a progress bar if there is an unkown or unlimited total
---
 src/gui/accountsettings.cpp | 10 +++++++++-
 src/gui/quotainfo.cpp       |  5 +++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index 962cddd..fa3d7ae 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -455,7 +455,15 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used)
         ui->quotaProgressBar->setToolTip(toolTip);
     } else {
         ui->quotaProgressBar->setVisible(false);
-        ui->quotaInfoLabel->setText(tr("Currently there is no storage usage information available."));
+        ui->quotaInfoLabel->setToolTip(QString());
+
+        /* -1 means not computed; -2 means unknown; -3 means unlimited  (#3940)*/
+        if (total == 0 || total == -1) {
+            ui->quotaInfoLabel->setText(tr("Currently there is no storage usage information available."));
+        } else {
+            QString usedStr = Utility::octetsToString(used);
+            ui->quotaInfoLabel->setText(tr("%1 in use").arg(usedStr));
+        }
     }
 }
 
diff --git a/src/gui/quotainfo.cpp b/src/gui/quotainfo.cpp
index 49c188b..02d5dfd 100644
--- a/src/gui/quotainfo.cpp
+++ b/src/gui/quotainfo.cpp
@@ -102,9 +102,10 @@ void QuotaInfo::slotUpdateLastQuota(const QVariantMap &result)
 {
     // The server can return fractional bytes (#1374)
     // <d:quota-available-bytes>1374532061.2</d:quota-available-bytes>
-    quint64 avail = result["quota-available-bytes"].toDouble();
+    qint64 avail = result["quota-available-bytes"].toDouble();
     _lastQuotaUsedBytes = result["quota-used-bytes"].toDouble();
-    _lastQuotaTotalBytes = _lastQuotaUsedBytes + avail;
+    // negative value of the available quota have special meaning (#3940)
+    _lastQuotaTotalBytes = avail >= 0 ? _lastQuotaUsedBytes + avail : avail;
     emit quotaUpdated(_lastQuotaTotalBytes, _lastQuotaUsedBytes);
     _jobRestartTimer.start(defaultIntervalT);
     _lastQuotaRecieved = QDateTime::currentDateTime();

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