[Pkg-owncloud-commits] [owncloud-client] 19/27: Theme: Fix wizardSelectiveSyncDefaultNothing #3671

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Aug 28 09:43:45 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 6cf1caeaf3bcf6fdd0cd0f8a5f080bdf3ca1a992
Author: Christian Kamm <mail at ckamm.de>
Date:   Mon Aug 24 12:52:41 2015 +0200

    Theme: Fix wizardSelectiveSyncDefaultNothing #3671
---
 src/gui/selectivesyncdialog.cpp              | 41 ++++++++++++++++++++++------
 src/gui/selectivesyncdialog.h                |  2 ++
 src/gui/wizard/owncloudadvancedsetuppage.cpp | 18 +++++++++++-
 3 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp
index fad1b3a..273cbf7 100644
--- a/src/gui/selectivesyncdialog.cpp
+++ b/src/gui/selectivesyncdialog.cpp
@@ -165,6 +165,28 @@ void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list)
 
     SelectiveSyncTreeViewItem *root = static_cast<SelectiveSyncTreeViewItem*>(topLevelItem(0));
 
+    QUrl url = _account->davUrl();
+    QString pathToRemove = url.path();
+    if (!pathToRemove.endsWith('/')) {
+        pathToRemove.append('/');
+    }
+    pathToRemove.append(_folderPath);
+    if (!_folderPath.isEmpty())
+        pathToRemove.append('/');
+
+    // Since / cannot be in the blacklist, expand it to the actual
+    // list of top-level folders as soon as possible.
+    if (_oldBlackList == QStringList("/")) {
+        _oldBlackList.clear();
+        foreach (QString path, list) {
+            path.remove(pathToRemove);
+            if (path.isEmpty()) {
+                continue;
+            }
+            _oldBlackList.append(path);
+        }
+    }
+
     if (!root && list.size() <= 1) {
         _loading->setText(tr("No subfolders currently on the server."));
         _loading->resize(_loading->sizeHint()); // because it's not in a layout
@@ -185,15 +207,6 @@ void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list)
         }
     }
 
-    QUrl url = _account->davUrl();
-    QString pathToRemove = url.path();
-    if (!pathToRemove.endsWith('/')) {
-        pathToRemove.append('/');
-    }
-    pathToRemove.append(_folderPath);
-    if (!_folderPath.isEmpty())
-        pathToRemove.append('/');
-
     foreach (QString path, list) {
         auto size = job ? job->_sizes.value(path) : 0;
         path.remove(pathToRemove);
@@ -325,6 +338,11 @@ QStringList SelectiveSyncTreeView::createBlackList(QTreeWidgetItem* root) const
     return result;
 }
 
+QStringList SelectiveSyncTreeView::oldBlackList() const
+{
+    return _oldBlackList;
+}
+
 qint64 SelectiveSyncTreeView::estimatedSize(QTreeWidgetItem* root)
 {
     if (!root) {
@@ -427,6 +445,11 @@ QStringList SelectiveSyncDialog::createBlackList() const
     return _treeView->createBlackList();
 }
 
+QStringList SelectiveSyncDialog::oldBlackList() const
+{
+    return _treeView->oldBlackList();
+}
+
 qint64 SelectiveSyncDialog::estimatedSize()
 {
     return _treeView->estimatedSize();
diff --git a/src/gui/selectivesyncdialog.h b/src/gui/selectivesyncdialog.h
index 15702d8..41b2a04 100644
--- a/src/gui/selectivesyncdialog.h
+++ b/src/gui/selectivesyncdialog.h
@@ -36,6 +36,7 @@ public:
 
     /// Returns a list of blacklisted paths, each including the trailing /
     QStringList createBlackList(QTreeWidgetItem* root = 0) const;
+    QStringList oldBlackList() const;
 
     //Estimate the total size of checked item (recursively)
     qint64 estimatedSize(QTreeWidgetItem *root = 0);
@@ -77,6 +78,7 @@ public:
     virtual void accept() Q_DECL_OVERRIDE;
 
     QStringList createBlackList() const;
+    QStringList oldBlackList() const;
 
     // Estimate the size of the total of sync'ed files from the server
     qint64 estimatedSize();
diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp
index 5253e91..a933761 100644
--- a/src/gui/wizard/owncloudadvancedsetuppage.cpp
+++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp
@@ -258,8 +258,24 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
 
     AccountPtr acc = static_cast<OwncloudWizard *>(wizard())->account();
     SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this);
-    if (dlg->exec() == QDialog::Accepted) {
+
+    const int result = dlg->exec();
+    bool updateBlacklist = false;
+
+    // We need to update the selective sync blacklist either when the dialog
+    // was accepted, or when it was used in conjunction with the
+    // wizardSelectiveSyncDefaultNothing feature and was cancelled - in that
+    // case the stub blacklist of / was expanded to the actual list of top
+    // level folders by the selective sync dialog.
+    if (result == QDialog::Accepted) {
         _selectiveSyncBlacklist = dlg->createBlackList();
+        updateBlacklist = true;
+    } else if (result == QDialog::Rejected && _selectiveSyncBlacklist == QStringList("/")) {
+        _selectiveSyncBlacklist = dlg->oldBlackList();
+        updateBlacklist = true;
+    }
+
+    if (updateBlacklist) {
         if (!_selectiveSyncBlacklist.isEmpty()) {
             _ui.rSelectiveSync->blockSignals(true);
             _ui.rSelectiveSync->setChecked(true);

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