[Pkg-owncloud-commits] [owncloud-client] 62/84: FolderWatcher: Act on relative paths #5116 (#5153)

Sandro Knauß hefee at moszumanska.debian.org
Fri Oct 21 22:51:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee pushed a commit to branch master
in repository owncloud-client.

commit 907918dca35b2e4153963d9ab8690511c7a80710
Author: Markus Goetz <markus at woboq.com>
Date:   Mon Sep 12 14:03:11 2016 +0200

    FolderWatcher: Act on relative paths #5116 (#5153)
    
    (cherry picked from commit d5a481f13240b50ff3993184152d3d4145ebfde0)
---
 src/gui/folder.cpp        |  5 -----
 src/gui/folder.h          |  5 -----
 src/gui/folderwatcher.cpp | 17 +++++++++++++----
 src/gui/folderwatcher.h   |  1 +
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index a4f2e25..738fe7f 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -628,11 +628,6 @@ void Folder::removeFromSettings() const
     settings->remove(FolderMan::escapeAlias(_definition.alias));
 }
 
-bool Folder::isFileExcludedAbsolute(const QString& fullPath) const
-{
-    return _engine->excludedFiles().isExcluded(fullPath, path(), _definition.ignoreHiddenFiles);
-}
-
 bool Folder::isFileExcludedRelative(const QString& relativePath) const
 {
     return _engine->excludedFiles().isExcluded(path() + relativePath, path(), _definition.ignoreHiddenFiles);
diff --git a/src/gui/folder.h b/src/gui/folder.h
index 79a27ad..bfd4de4 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -186,11 +186,6 @@ public:
      /**
       * Returns whether a file inside this folder should be excluded.
       */
-     bool isFileExcludedAbsolute(const QString& fullPath) const;
-
-     /**
-      * Returns whether a file inside this folder should be excluded.
-      */
      bool isFileExcludedRelative(const QString& relativePath) const;
 
 signals:
diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp
index 30809c8..c115611 100644
--- a/src/gui/folderwatcher.cpp
+++ b/src/gui/folderwatcher.cpp
@@ -41,7 +41,9 @@ FolderWatcher::FolderWatcher(const QString &root, Folder* folder)
     : QObject(folder),
       _folder(folder)
 {
-    _d.reset(new FolderWatcherPrivate(this, root));
+    _canonicalFolderPath = QFileInfo(root).canonicalFilePath();
+
+    _d.reset(new FolderWatcherPrivate(this, _canonicalFolderPath));
 
     _timer.start();
 }
@@ -55,10 +57,17 @@ bool FolderWatcher::pathIsIgnored( const QString& path )
     if( !_folder ) return false;
 
 #ifndef OWNCLOUD_TEST
-    if (_folder->isFileExcludedAbsolute(path)) {
-        qDebug() << "* Ignoring file" << path;
-        return true;
+    QString relPath = path;
+    if (relPath.startsWith(_canonicalFolderPath)) {
+        relPath = relPath.remove(0, _canonicalFolderPath.length()+1);
+        if (_folder->isFileExcludedRelative(relPath)) {
+            qDebug() << "* Ignoring file" << relPath << "in" << _canonicalFolderPath;
+            return true;
+        }
     }
+    // there could be an odd watch event not being inside the _canonicalFolderPath
+    // We will just not ignore it then, who knows.
+
 #endif
     return false;
 }
diff --git a/src/gui/folderwatcher.h b/src/gui/folderwatcher.h
index 15fe223..9b0d174 100644
--- a/src/gui/folderwatcher.h
+++ b/src/gui/folderwatcher.h
@@ -89,6 +89,7 @@ private:
     QTime _timer;
     QSet<QString> _lastPaths;
     Folder* _folder;
+    QString _canonicalFolderPath;
 
     friend class FolderWatcherPrivate;
 };

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