[Pkg-owncloud-commits] [owncloud-client] 63/498: Setup wizard: Do not remove all the folders of all theother acocunts when adding an account

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:35 UTC 2015


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 e4694a6db8ba0abf2cd0fbc44d051a01b26b35be
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Tue Apr 28 15:32:11 2015 +0200

    Setup wizard: Do not remove all the folders of all theother acocunts when adding an account
    
    Also we need the alias to be unique
---
 src/gui/folderman.cpp           | 12 ------------
 src/gui/folderman.h             |  3 ---
 src/gui/owncloudsetupwizard.cpp | 12 +++++++-----
 3 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index d0588ac..e9eacc4 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -788,18 +788,6 @@ Folder *FolderMan::folderForPath(const QString &path)
     return 0;
 }
 
-void FolderMan::removeAllFolderDefinitions()
-{
-    foreach( Folder *f, _folderMap.values() ) {
-        if(f) {
-            slotRemoveFolder( f->alias() );
-        }
-    }
-    // clear the queue.
-    _scheduleQueue.clear();
-
-}
-
 void FolderMan::slotRemoveFolder( const QString& alias )
 {
     Folder *f = folder(alias);
diff --git a/src/gui/folderman.h b/src/gui/folderman.h
index d8bdb6d..ca9906c 100644
--- a/src/gui/folderman.h
+++ b/src/gui/folderman.h
@@ -61,9 +61,6 @@ public:
     /** Creates a folder for a specific configuration, identified by alias. */
     Folder* setupFolderFromConfigFile(const QString & );
 
-    /** Wipes all folder defintions. No way back! */
-    void removeAllFolderDefinitions();
-
     /**
      * Ensures that a given directory does not contain a .csync_journal.
      *
diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp
index c62da09..c25f6b4 100644
--- a/src/gui/owncloudsetupwizard.cpp
+++ b/src/gui/owncloudsetupwizard.cpp
@@ -463,10 +463,6 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
         // is changed.
         auto account = applyAccountChanges();
 
-        // But if the user went through with the folder config wizard,
-        // we assume they always want to have only that folder configured.
-        folderMan->removeAllFolderDefinitions();
-
         QString localFolder = QDir::fromNativeSeparators(_ocWizard->localFolder());
         if( !localFolder.endsWith(QLatin1Char('/'))) {
             localFolder.append(QLatin1Char('/'));
@@ -476,7 +472,13 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
         if (!startFromScratch || ensureStartFromScratch(localFolder)) {
             qDebug() << "Adding folder definition for" << localFolder << _remoteFolder;
             FolderDefinition folderDefinition;
-            folderDefinition.alias = Theme::instance()->appName();
+            auto alias = Theme::instance()->appName();
+            int count = 0;
+            folderDefinition.alias = alias;
+            while (folderMan->folder(folderDefinition.alias)) {
+                // There is already a folder configured with this name and folder names need to be unique
+                folderDefinition.alias = alias + QString::number(++count);
+            }
             folderDefinition.localPath = localFolder;
             folderDefinition.targetPath = _remoteFolder;
             folderDefinition.selectiveSyncBlackList = _ocWizard->selectiveSyncBlacklist();

-- 
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