From 35bc728a39980dc88a42c7d224fe258c2c35cf22 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 28 Jun 2024 17:57:16 +0800 Subject: [PATCH] Add download limit setting property to account Signed-off-by: Claudio Cambra --- src/libsync/account.cpp | 15 +++++++++++++++ src/libsync/account.h | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 42f46c250..046d984fd 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -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 diff --git a/src/libsync/account.h b/src/libsync/account.h index e50df0f48..8fbc2acac 100644 --- a/src/libsync/account.h +++ b/src/libsync/account.h @@ -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! *