[Pkg-owncloud-commits] [owncloud-client] 09/27: SetupWizard: Keep initial local folder to compare later for changes.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Jul 29 16:23:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 71338000a44420d5bd46c18605e76e742c806e00
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Jul 8 18:32:43 2014 +0200

    SetupWizard: Keep initial local folder to compare later for changes.
    
    If the local folder changes, the sync has to be reinitialized as
    well. Until now we did not detect that, which led to the case that
    the sync folder was not reinitialized in case only the local folder
    changed in the setup dialog.
---
 src/mirall/owncloudsetupwizard.cpp | 20 ++++++++++++++++++--
 src/mirall/owncloudsetupwizard.h   |  1 +
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/mirall/owncloudsetupwizard.cpp b/src/mirall/owncloudsetupwizard.cpp
index a7d866b..c4b7388 100644
--- a/src/mirall/owncloudsetupwizard.cpp
+++ b/src/mirall/owncloudsetupwizard.cpp
@@ -111,6 +111,15 @@ void OwncloudSetupWizard::startWizard()
     }
 
     _ocWizard->setProperty("localFolder", localFolder);
+
+    // remember the local folder to compare later if it changed, but clean first
+    QString lf = QDir::fromNativeSeparators(localFolder);
+    if( !lf.endsWith(QLatin1Char('/'))) {
+        lf.append(QLatin1Char('/'));
+    }
+
+    _initLocalFolder = lf;
+
     _ocWizard->setRemoteFolder(_remoteFolder);
 
     _ocWizard->setStartId(WizardCommon::Page_ServerSetup);
@@ -392,10 +401,17 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
 
         Account *newAccount = _ocWizard->account();
         Account *origAccount = AccountManager::instance()->account();
-        const QString localFolder = _ocWizard->localFolder();
+
+        QString localFolder = QDir::fromNativeSeparators(_ocWizard->localFolder());
+        if( !localFolder.endsWith(QLatin1Char('/'))) {
+            localFolder.append(QLatin1Char('/'));
+        }
 
         bool isInitialSetup = (origAccount == 0);
-        bool reinitRequired = newAccount->changed(origAccount, true /* ignoreProtocol, allows http->https */);
+
+        // check if either the account or the local folder changed, than reinit
+        bool reinitRequired = _initLocalFolder != localFolder ||
+                newAccount->changed(origAccount, true /* ignoreProtocol, allows http->https */);
         bool startFromScratch = _ocWizard->field("OCSyncFromScratch").toBool();
 
         // This distinguishes three possibilities:
diff --git a/src/mirall/owncloudsetupwizard.h b/src/mirall/owncloudsetupwizard.h
index 681b776..b1f2a2b 100644
--- a/src/mirall/owncloudsetupwizard.h
+++ b/src/mirall/owncloudsetupwizard.h
@@ -94,6 +94,7 @@ private:
 
     Account* _account;
     OwncloudWizard* _ocWizard;
+    QString _initLocalFolder;
     QString _remoteFolder;
 
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list