mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +03:00
Quota: handle special negative value for the quota #3940
Don't show a progress bar if there is an unkown or unlimited total
This commit is contained in:
parent
6aa26654f6
commit
a127debc54
2 changed files with 12 additions and 3 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue