[Pkg-owncloud-commits] [owncloud-client] 46/484: SelectiveSync: Apply excludes #3876

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:10 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 d610693af104e98f934878f228f6da57a2380fb2
Author: Christian Kamm <mail at ckamm.de>
Date:   Fri Oct 2 13:22:52 2015 +0200

    SelectiveSync: Apply excludes #3876
---
 src/gui/folderstatusmodel.cpp   | 19 ++++++++++++++-----
 src/gui/selectivesyncdialog.cpp | 18 +++++++++++++++++-
 src/gui/selectivesyncdialog.h   |  2 +-
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 9b9dbff..adfae66 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -496,22 +496,32 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list_)
         return;
     }
 
-    auto list = list_;
-    list.removeFirst(); // remove the parent item
-
     if (parentInfo->_hasError) {
         beginRemoveRows(idx, 0 ,0);
         parentInfo->_hasError = false;
         endRemoveRows();
     }
 
-    beginInsertRows(idx, 0, list.count() - 1);
+    auto list = list_;
+    list.removeFirst(); // remove the parent item
 
     QUrl url = parentInfo->_folder->remoteUrl();
     QString pathToRemove = url.path();
     if (!pathToRemove.endsWith('/'))
         pathToRemove += '/';
 
+    // Drop the folder base path and check for excludes.
+    QMutableListIterator<QString> it(list);
+    while (it.hasNext()) {
+        it.next();
+        if (parentInfo->_folder->isFileExcluded(it.value())) {
+            it.remove();
+        }
+        it.value().remove(pathToRemove);
+    }
+
+    beginInsertRows(idx, 0, list.count() - 1);
+
     parentInfo->_fetched = true;
     parentInfo->_fetching = false;
 
@@ -531,7 +541,6 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list_)
         newInfo._pathIdx << i++;
         auto size = job ? job->_sizes.value(path) : 0;
         newInfo._size = size;
-        path.remove(pathToRemove);
         newInfo._path = path;
         newInfo._name = path.split('/', QString::SkipEmptyParts).last();
 
diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp
index 273cbf7..b041ee8 100644
--- a/src/gui/selectivesyncdialog.cpp
+++ b/src/gui/selectivesyncdialog.cpp
@@ -156,7 +156,7 @@ void SelectiveSyncTreeView::recursiveInsert(QTreeWidgetItem* parent, QStringList
     }
 }
 
-void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list)
+void SelectiveSyncTreeView::slotUpdateDirectories(QStringList list)
 {
     auto job = qobject_cast<LsColJob *>(sender());
 
@@ -174,6 +174,22 @@ void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list)
     if (!_folderPath.isEmpty())
         pathToRemove.append('/');
 
+    // Check for excludes.
+    //
+    // We would like to use Folder::isFileExcluded, but the folder doesn't
+    // exist yet. So we just create one temporarily...
+    FolderDefinition def;
+    def.localPath = pathToRemove;
+    def.ignoreHiddenFiles = FolderMan::instance()->ignoreHiddenFiles();
+    Folder f(def);
+    QMutableListIterator<QString> it(list);
+    while (it.hasNext()) {
+        it.next();
+        if (f.isFileExcluded(it.value())) {
+            it.remove();
+        }
+    }
+
     // Since / cannot be in the blacklist, expand it to the actual
     // list of top-level folders as soon as possible.
     if (_oldBlackList == QStringList("/")) {
diff --git a/src/gui/selectivesyncdialog.h b/src/gui/selectivesyncdialog.h
index 41b2a04..f64fde3 100644
--- a/src/gui/selectivesyncdialog.h
+++ b/src/gui/selectivesyncdialog.h
@@ -48,7 +48,7 @@ public:
 
     QSize sizeHint() const Q_DECL_OVERRIDE;
 private slots:
-    void slotUpdateDirectories(const QStringList &);
+    void slotUpdateDirectories(QStringList);
     void slotItemExpanded(QTreeWidgetItem *);
     void slotItemChanged(QTreeWidgetItem*,int);
     void slotLscolFinishedWithError(QNetworkReply*);

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