Просмотр исходного кода

store in config file that we want to enable vfs when generating config

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Matthieu Gallien 2 лет назад
Родитель
Сommit
903c475d5a

+ 5 - 0
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()) {

+ 2 - 0
src/gui/accountsetupcommandlinemanager.h

@@ -32,6 +32,8 @@ public:
 
     [[nodiscard]] bool isCommandLineParsed() const;
 
+    [[nodiscard]] bool isVfsEnabled() const;
+
 public slots:
     void setupAccountFromCommandLine();
 

+ 2 - 0
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()) {

+ 13 - 0
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,

+ 3 - 0
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);
 

+ 13 - 0
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) {

+ 6 - 0
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