Add download limit setting property to account

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-06-28 17:57:16 +08:00
parent d06e8b1d4e
commit 35bc728a39
No known key found for this signature in database
GPG key ID: C839200C384636B0
2 changed files with 22 additions and 0 deletions

View file

@ -1238,4 +1238,19 @@ void Account::setUploadLimit(const unsigned int limit)
emit uploadLimitChanged();
}
unsigned int Account::downloadLimit() const
{
return _downloadLimit;
}
void Account::setDownloadLimit(const unsigned int limit)
{
if (_downloadLimit == limit) {
return;
}
_downloadLimit = limit;
emit downloadLimitChanged();
}
} // namespace OCC

View file

@ -101,6 +101,7 @@ class OWNCLOUDSYNC_EXPORT Account : public QObject
Q_PROPERTY(AccountNetworkTransferLimitSetting uploadLimitSetting READ uploadLimitSetting WRITE setUploadLimitSetting NOTIFY uploadLimitSettingChanged)
Q_PROPERTY(AccountNetworkTransferLimitSetting downloadLimitSetting READ downloadLimitSetting WRITE setDownloadLimitSetting NOTIFY downloadLimitSettingChanged)
Q_PROPERTY(unsigned int uploadLimit READ uploadLimit WRITE setUploadLimit NOTIFY uploadLimitChanged)
Q_PROPERTY(unsigned int downloadLimit READ downloadLimit WRITE setDownloadLimit NOTIFY downloadLimitChanged)
public:
enum class AccountNetworkProxySetting {
@ -397,6 +398,9 @@ public:
[[nodiscard]] unsigned int uploadLimit() const;
void setUploadLimit(unsigned int kbytes);
[[nodiscard]] unsigned int downloadLimit() const;
void setDownloadLimit(unsigned int kbytes);
public slots:
/// Used when forgetting credentials
void clearQNAMCache();
@ -451,6 +455,7 @@ signals:
void uploadLimitSettingChanged();
void downloadLimitSettingChanged();
void uploadLimitChanged();
void downloadLimitChanged();
protected Q_SLOTS:
void slotCredentialsFetched();
@ -537,6 +542,8 @@ private:
AccountNetworkTransferLimitSetting _uploadLimitSetting = AccountNetworkTransferLimitSetting::GlobalLimit;
AccountNetworkTransferLimitSetting _downloadLimitSetting = AccountNetworkTransferLimitSetting::GlobalLimit;
unsigned int _uploadLimit = 0;
unsigned int _downloadLimit = 0;
/* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
* TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
*