From: Matthieu Gallien Date: Thu, 16 Mar 2023 19:23:56 +0000 (+0100) Subject: store in config file that we want to enable vfs when generating config X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~96^2^2~131^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=903c475d5ab0f0c845f3857e5712d3532aa50fa4;p=nextcloud-desktop.git store in config file that we want to enable vfs when generating config Signed-off-by: Matthieu Gallien --- diff --git a/src/gui/accountsetupcommandlinemanager.cpp b/src/gui/accountsetupcommandlinemanager.cpp index a604cb53b..94388b7ea 100644 --- a/src/gui/accountsetupcommandlinemanager.cpp +++ b/src/gui/accountsetupcommandlinemanager.cpp @@ -95,6 +95,11 @@ bool AccountSetupCommandLineManager::isCommandLineParsed() const return !_appPassword.isEmpty() && !_userId.isEmpty() && _serverUrl.isValid(); } +bool AccountSetupCommandLineManager::isVfsEnabled() const +{ + return _isVfsEnabled; +} + void AccountSetupCommandLineManager::setupAccountFromCommandLine() { if (isCommandLineParsed()) { diff --git a/src/gui/accountsetupcommandlinemanager.h b/src/gui/accountsetupcommandlinemanager.h index 156ab5d90..70b8bf6cf 100644 --- a/src/gui/accountsetupcommandlinemanager.h +++ b/src/gui/accountsetupcommandlinemanager.h @@ -32,6 +32,8 @@ public: [[nodiscard]] bool isCommandLineParsed() const; + [[nodiscard]] bool isVfsEnabled() const; + public slots: void setupAccountFromCommandLine(); diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 27f7d6c9f..551fc487d 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -73,6 +73,8 @@ void OwncloudSetupWizard::runWizard(QObject *obj, const char *amember, QWidget * if (!cfg.overrideServerUrl().isEmpty()) { Theme::instance()->setOverrideServerUrl(cfg.overrideServerUrl()); Theme::instance()->setForceOverrideServerUrl(true); + Theme::instance()->setVfsEnabled(cfg.isVfsEnabled()); + Theme::instance()->setStartLoginFlowAutomatically(true); } if (!wiz.isNull()) { diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index c2c2cbca0..f60a4b19b 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -70,6 +70,7 @@ static constexpr char updateSegmentC[] = "updateSegment"; static constexpr char updateChannelC[] = "updateChannel"; static constexpr char overrideServerUrlC[] = "overrideServerUrl"; static constexpr char overrideLocalDirC[] = "overrideLocalDir"; +static constexpr char isVfsEnabledC[] = "isVfsEnabled"; static constexpr char geometryC[] = "geometry"; static constexpr char timeoutC[] = "timeout"; static constexpr char chunkSizeC[] = "chunkSize"; @@ -724,6 +725,18 @@ void ConfigFile::setOverrideLocalDir(const QString &localDir) settings.setValue(QLatin1String(overrideLocalDirC), localDir); } +bool ConfigFile::isVfsEnabled() const +{ + QSettings settings(configFile(), QSettings::IniFormat); + return settings.value({isVfsEnabledC}, {}).toBool(); +} + +void ConfigFile::setVfsEnabled(bool enabled) +{ + QSettings settings(configFile(), QSettings::IniFormat); + settings.setValue({isVfsEnabledC}, enabled); +} + void ConfigFile::setProxyType(int proxyType, const QString &host, int port, bool needsAuth, diff --git a/src/libsync/configfile.h b/src/libsync/configfile.h index 9284d4ea2..9f0f76155 100644 --- a/src/libsync/configfile.h +++ b/src/libsync/configfile.h @@ -196,6 +196,9 @@ public: [[nodiscard]] QString overrideLocalDir() const; void setOverrideLocalDir(const QString &localDir); + [[nodiscard]] bool isVfsEnabled() const; + void setVfsEnabled(bool enabled); + void saveGeometryHeader(QHeaderView *header); void restoreGeometryHeader(QHeaderView *header); diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 7336c329e..a8bcd1273 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -426,6 +426,11 @@ bool Theme::forceOverrideServerUrl() const return _forceOverrideServerUrl; } +bool Theme::isVfsEnabled() const +{ + return _isVfsEnabled; +} + bool Theme::startLoginFlowAutomatically() const { return _startLoginFlowAutomatically; @@ -971,6 +976,14 @@ void Theme::setForceOverrideServerUrl(bool forceOverride) } } +void Theme::setVfsEnabled(bool enabled) +{ + if (_isVfsEnabled != enabled) { + _isVfsEnabled = enabled; + emit vfsEnabledChanged(); + } +} + void Theme::setStartLoginFlowAutomatically(bool startLoginFlowAuto) { if (_startLoginFlowAutomatically != startLoginFlowAuto) { diff --git a/src/libsync/theme.h b/src/libsync/theme.h index de721f71c..5c805fd8f 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -57,6 +57,7 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject Q_PROPERTY(QString conflictHelpUrl READ conflictHelpUrl CONSTANT) Q_PROPERTY(QString overrideServerUrl READ overrideServerUrl WRITE setOverrideServerUrl NOTIFY overrideServerUrlChanged) Q_PROPERTY(bool forceOverrideServerUrl READ forceOverrideServerUrl WRITE setForceOverrideServerUrl NOTIFY forceOverrideServerUrlChanged) + Q_PROPERTY(bool isVfsEnabled READ isVfsEnabled WRITE setVfsEnabled NOTIFY vfsEnabledChanged) Q_PROPERTY(bool startLoginFlowAutomatically READ startLoginFlowAutomatically WRITE setStartLoginFlowAutomatically NOTIFY startLoginFlowAutomaticallyChanged) #ifndef TOKEN_AUTH_ONLY Q_PROPERTY(QColor wizardHeaderTitleColor READ wizardHeaderTitleColor CONSTANT) @@ -243,6 +244,8 @@ public: */ virtual bool forceOverrideServerUrl() const; + virtual bool isVfsEnabled() const; + /** * Automatically start login flow * @@ -595,6 +598,7 @@ public: public slots: virtual void setOverrideServerUrl(const QString &overrideServerUrl); virtual void setForceOverrideServerUrl(bool forceOverride); + virtual void setVfsEnabled(bool enabled); virtual void setStartLoginFlowAutomatically(bool startLoginFlowAuto); protected: @@ -617,6 +621,7 @@ signals: void darkModeChanged(); void overrideServerUrlChanged(); void forceOverrideServerUrlChanged(); + void vfsEnabledChanged(); void startLoginFlowAutomaticallyChanged(); private: @@ -634,6 +639,7 @@ private: QString _overrideServerUrl; bool _forceOverrideServerUrl = false; + bool _isVfsEnabled = false; bool _startLoginFlowAutomatically = false; #ifndef TOKEN_AUTH_ONLY