[Pkg-owncloud-commits] [owncloud-client] 122/219: SelectiveSyncDialog: Change 'partial' behavior.

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:17 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 45aefeb1461c0348b2d4ea3c1c58988ca908ebe8
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Wed Sep 17 16:35:23 2014 +0200

    SelectiveSyncDialog: Change 'partial' behavior.
    
    The real bug in #2219 actually was that the gui allowed users to
    choose to not sync the root folder. That's not supported and no
    longer possible in the UI.
    
    Instead you may now sync a folder's files without syncing its sub-
    folders.
---
 src/mirall/selectivesyncdialog.cpp | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/src/mirall/selectivesyncdialog.cpp b/src/mirall/selectivesyncdialog.cpp
index f112def..92398bc 100644
--- a/src/mirall/selectivesyncdialog.cpp
+++ b/src/mirall/selectivesyncdialog.cpp
@@ -72,11 +72,8 @@ void SelectiveSyncTreeView::recursiveInsert(QTreeWidgetItem* parent, QStringList
         QTreeWidgetItem *item = findFirstChild(parent, pathTrail.first());
         if (!item) {
             item = new QTreeWidgetItem(parent);
-            if (parent->checkState(0) == Qt::Checked) {
-                item->setCheckState(0, Qt::Checked);
-            } else if (parent->checkState(0) == Qt::Unchecked) {
-                item->setCheckState(0, Qt::Unchecked);
-            } else {
+            if (parent->checkState(0) == Qt::Checked
+                    || parent->checkState(0) == Qt::PartiallyChecked) {
                 item->setCheckState(0, Qt::Checked);
                 foreach(const QString &str , _oldBlackList) {
                     if (str + "/" == path) {
@@ -86,6 +83,8 @@ void SelectiveSyncTreeView::recursiveInsert(QTreeWidgetItem* parent, QStringList
                         item->setCheckState(0, Qt::PartiallyChecked);
                     }
                 }
+            } else if (parent->checkState(0) == Qt::Unchecked) {
+                item->setCheckState(0, Qt::Unchecked);
             }
             item->setIcon(0, folderIcon);
             item->setText(0, pathTrail.first());
@@ -111,8 +110,6 @@ void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list)
         root->setData(0, Qt::UserRole, QString());
         if (_oldBlackList.isEmpty()) {
             root->setCheckState(0, Qt::Checked);
-        } else if (_oldBlackList.contains("")) {
-            root->setCheckState(0, Qt::Unchecked);
         } else {
             root->setCheckState(0, Qt::PartiallyChecked);
         }
@@ -175,7 +172,7 @@ void SelectiveSyncTreeView::slotItemChanged(QTreeWidgetItem *item, int col)
                 parent->setCheckState(0, Qt::PartiallyChecked);
             }
         }
-        // also check all the childs
+        // also check all the children
         for (int i = 0; i < item->childCount(); ++i) {
             if (item->child(i)->checkState(0) != Qt::Checked) {
                 item->child(i)->setCheckState(0, Qt::Checked);
@@ -185,27 +182,21 @@ void SelectiveSyncTreeView::slotItemChanged(QTreeWidgetItem *item, int col)
 
     if (item->checkState(0) == Qt::Unchecked) {
         QTreeWidgetItem *parent = item->parent();
-        if (parent && parent->checkState(0) != Qt::Unchecked) {
-            bool hasChecked = false;
-            for (int i = 0; i < parent->childCount(); ++i) {
-                if (parent->child(i)->checkState(0) != Qt::Unchecked) {
-                    hasChecked = true;
-                    break;
-                }
-            }
-            if (!hasChecked) {
-                parent->setCheckState(0, Qt::Unchecked);
-            } else if (parent->checkState(0) == Qt::Checked) {
-                parent->setCheckState(0, Qt::PartiallyChecked);
-            }
+        if (parent && parent->checkState(0) == Qt::Checked) {
+            parent->setCheckState(0, Qt::PartiallyChecked);
         }
 
-        // Uncheck all the childs
+        // Uncheck all the children
         for (int i = 0; i < item->childCount(); ++i) {
             if (item->child(i)->checkState(0) != Qt::Unchecked) {
                 item->child(i)->setCheckState(0, Qt::Unchecked);
             }
         }
+
+        // Can't uncheck the root.
+        if (!parent) {
+            item->setCheckState(0, Qt::PartiallyChecked);
+        }
     }
 
     if (item->checkState(0) == Qt::PartiallyChecked) {

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