Don't display quota information when the user has no quota.
authorCamila <hello@camila.codes>
Wed, 1 Jul 2020 19:30:17 +0000 (21:30 +0200)
committerKevin Ottens <ervin@ipsquad.net>
Thu, 2 Jul 2020 18:06:12 +0000 (20:06 +0200)
- The code handling the api response was not up to date with the latest
api changes.
- Unlimited quota display: use qint64 to avoid data loss
- Change total with quota: total holds the quota total and not the storage total.

Signed-off-by: Camila <hello@camila.codes>
src/gui/accountsettings.cpp
src/gui/accountsettings.h
src/gui/userinfo.cpp

index 0c89b983ee603f5d0e02ba6572ef2c577e4dad2b..d625d7d2d2dab89595190372fbec684b26ce432e 100644 (file)
@@ -739,7 +739,7 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used)
         _ui->quotaProgressBar->setVisible(false);
         _ui->quotaInfoLabel->setToolTip(QString());
 
-        /* -1 means not computed; -2 means unknown; -3 means unlimited  (#3940)*/
+        /* -1 means not computed; -2 means unknown; -3 means unlimited  (#owncloud/client/issues/3940)*/
         if (total == 0 || total == -1) {
             _ui->quotaInfoLabel->setText(tr("Currently there is no storage usage information available."));
         } else {
index a67994279dc26035ecb22e20eaee3ad7c9e5b352..3dfa18fb9bfc7d9ac9b4c979e3e155f3ddf2122c 100644 (file)
@@ -68,7 +68,7 @@ signals:
 
 public slots:
     void slotOpenOC();
-    void slotUpdateQuota(qint64, qint64);
+    void slotUpdateQuota(qint64 total, qint64 used);
     void slotAccountStateChanged();
     void slotStyleChanged();
 
index c7916c516d7dff22615ba4b7fa3ce36acc1871da..d26bcab9c6e2d1967c47b6548f17355e83ee5048 100644 (file)
@@ -124,7 +124,7 @@ void UserInfo::slotUpdateLastInfo(const QJsonDocument &json)
     // Quota
     auto objQuota = objData.value("quota").toObject();
     qint64 used = objQuota.value("used").toDouble();
-    qint64 total = objQuota.value("total").toDouble();
+    qint64 total = objQuota.value("quota").toDouble();
 
     if(_lastInfoReceived.isNull() || _lastQuotaUsedBytes != used || _lastQuotaTotalBytes != total) {
         _lastQuotaUsedBytes = used;