[Pkg-owncloud-commits] [owncloud-client] 93/120: Folder Wizard: always make an alias that does not conflict with anything

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Aug 24 00:02:50 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 64bd6b204be6b9cf8f99c9a8ffa951b40798fb73
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Mon Aug 17 11:54:01 2015 +0200

    Folder Wizard:  always make an alias that does not conflict with anything
---
 src/gui/folderwizard.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp
index e7a4458..cd39c6c 100644
--- a/src/gui/folderwizard.cpp
+++ b/src/gui/folderwizard.cpp
@@ -69,7 +69,15 @@ FolderWizardLocalPath::FolderWizardLocalPath()
     _ui.localFolderLineEdit->setToolTip(tr("Enter the path to the local folder."));
 
     registerField(QLatin1String("alias*"), _ui.aliasLineEdit);
-    _ui.aliasLineEdit->setText( Theme::instance()->appNameGUI() );
+
+    QString newAlias = Theme::instance()->appName();
+    int count = 0;
+    while (FolderMan::instance()->folder(newAlias)) {
+        // There is already a folder configured with this name and folder names need to be unique
+        newAlias = Theme::instance()->appName() + QString::number(++count);
+    }
+    _ui.aliasLineEdit->setText( newAlias );
+
     _ui.aliasLineEdit->setToolTip(tr("The directory alias is a descriptive name for this sync connection."));
     _ui.warnLabel->setTextFormat(Qt::RichText);
     _ui.warnLabel->hide();
@@ -157,6 +165,11 @@ void FolderWizardLocalPath::slotChooseLocalFolder()
 
         QDir pickedDir(dir);
         QString newAlias = pickedDir.dirName();
+        int count = 0;
+        while (FolderMan::instance()->folder(newAlias)) {
+            // There is already a folder configured with this name and folder names need to be unique
+            newAlias = pickedDir.dirName() + QString::number(++count);
+        }
         if( !newAlias.isEmpty() ) {
             _ui.aliasLineEdit->setText(newAlias);
         }

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