Add proxy type property to account

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

View file

@ -1103,4 +1103,19 @@ void Account::setNetworkProxySetting(const AccountNetworkProxySetting setting)
emit networkProxySettingChanged();
}
QNetworkProxy::ProxyType Account::proxyType() const
{
return _proxyType;
}
void Account::setProxyType(QNetworkProxy::ProxyType proxyType)
{
if (_proxyType == proxyType) {
return;
}
_proxyType = proxyType;
emit proxyTypeChanged();
}
} // namespace OCC

View file

@ -26,6 +26,7 @@
#include <QByteArray>
#include <QUrl>
#include <QNetworkCookie>
#include <QNetworkProxy>
#include <QNetworkRequest>
#include <QSslSocket>
#include <QSslCertificate>
@ -91,6 +92,7 @@ class OWNCLOUDSYNC_EXPORT Account : public QObject
Q_PROPERTY(bool e2eEncryptionKeysGenerationAllowed MEMBER _e2eEncryptionKeysGenerationAllowed)
Q_PROPERTY(bool askUserForMnemonic READ askUserForMnemonic WRITE setAskUserForMnemonic NOTIFY askUserForMnemonicChanged)
Q_PROPERTY(AccountNetworkProxySetting networkProxySetting READ networkProxySetting WRITE setNetworkProxySetting NOTIFY networkProxySettingChanged)
Q_PROPERTY(QNetworkProxy::ProxyType proxyType READ proxyType WRITE setProxyType NOTIFY proxyTypeChanged)
public:
enum class AccountNetworkProxySetting {
@ -359,6 +361,9 @@ public:
[[nodiscard]] AccountNetworkProxySetting networkProxySetting() const;
void setNetworkProxySetting(AccountNetworkProxySetting networkProxySetting);
[[nodiscard]] QNetworkProxy::ProxyType proxyType() const;
void setProxyType(QNetworkProxy::ProxyType proxyType);
public slots:
/// Used when forgetting credentials
void clearQNAMCache();
@ -404,6 +409,7 @@ signals:
void lockFileError(const QString&);
void networkProxySettingChanged();
void proxyTypeChanged();
protected Q_SLOTS:
void slotCredentialsFetched();
@ -481,6 +487,7 @@ private:
QHash<QString, QVector<SyncFileItem::LockStatus>> _lockStatusChangeInprogress;
AccountNetworkProxySetting _networkProxySetting = AccountNetworkProxySetting::GlobalProxy;
QNetworkProxy::ProxyType _proxyType = QNetworkProxy::NoProxy;
/* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
* TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
*