[Pkg-owncloud-commits] [owncloud-client] 59/484: Exclusion: Fix confusion with relative and absolute paths
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:12 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 51a2e6c5800526e99814a28138e882d373a677bb
Author: Christian Kamm <mail at ckamm.de>
Date: Tue Oct 13 12:53:38 2015 +0200
Exclusion: Fix confusion with relative and absolute paths
---
src/gui/folder.cpp | 7 ++++++-
src/gui/folder.h | 7 ++++++-
src/gui/folderstatusmodel.cpp | 5 ++---
src/gui/folderwatcher.cpp | 2 +-
src/gui/selectivesyncdialog.cpp | 5 +++--
src/gui/socketapi.cpp | 2 +-
6 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index 6aad701..1547469 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -707,7 +707,7 @@ void Folder::removeFromSettings() const
settings->remove(_definition.alias);
}
-bool Folder::isFileExcluded(const QString& fullPath) const
+bool Folder::isFileExcludedAbsolute(const QString& fullPath) const
{
QString myFullPath = fullPath;
if (myFullPath.endsWith(QLatin1Char('/'))) {
@@ -724,6 +724,11 @@ bool Folder::isFileExcluded(const QString& fullPath) const
return excl != CSYNC_NOT_EXCLUDED;
}
+bool Folder::isFileExcludedRelative(const QString& relativePath) const
+{
+ return isFileExcludedAbsolute(path() + relativePath);
+}
+
void Folder::watcherSlot(QString fn)
{
// FIXME: On OS X we could not do this "if" since on OS X the file watcher ignores events for ourselves
diff --git a/src/gui/folder.h b/src/gui/folder.h
index bbead3d..2734603 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -200,7 +200,12 @@ public:
/**
* Returns whether a file inside this folder should be excluded.
*/
- bool isFileExcluded(const QString& fullPath) const;
+ bool isFileExcludedAbsolute(const QString& fullPath) const;
+
+ /**
+ * Returns whether a file inside this folder should be excluded.
+ */
+ bool isFileExcludedRelative(const QString& relativePath) const;
signals:
void syncStateChange();
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index db8b67f..bcbbdcd 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -514,10 +514,9 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list_)
QMutableListIterator<QString> it(list);
while (it.hasNext()) {
it.next();
- if (parentInfo->_folder->isFileExcluded(it.value())) {
+ it.value().remove(pathToRemove);
+ if (parentInfo->_folder->isFileExcludedRelative(it.value())) {
it.remove();
- } else {
- it.value().remove(pathToRemove);
}
}
diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp
index 217ebd1..30809c8 100644
--- a/src/gui/folderwatcher.cpp
+++ b/src/gui/folderwatcher.cpp
@@ -55,7 +55,7 @@ bool FolderWatcher::pathIsIgnored( const QString& path )
if( !_folder ) return false;
#ifndef OWNCLOUD_TEST
- if (_folder->isFileExcluded(path)) {
+ if (_folder->isFileExcludedAbsolute(path)) {
qDebug() << "* Ignoring file" << path;
return true;
}
diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp
index f24e42f..021e005 100644
--- a/src/gui/selectivesyncdialog.cpp
+++ b/src/gui/selectivesyncdialog.cpp
@@ -185,7 +185,9 @@ void SelectiveSyncTreeView::slotUpdateDirectories(QStringList list)
QMutableListIterator<QString> it(list);
while (it.hasNext()) {
it.next();
- if (f.isFileExcluded(it.value())) {
+ QString path = it.value();
+ path.remove(pathToRemove);
+ if (f.isFileExcludedRelative(path)) {
it.remove();
}
}
@@ -195,7 +197,6 @@ void SelectiveSyncTreeView::slotUpdateDirectories(QStringList list)
if (_oldBlackList == QStringList("/")) {
_oldBlackList.clear();
foreach (QString path, list) {
- path.remove(pathToRemove);
if (path.isEmpty()) {
continue;
}
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index ea21155..e145f81 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -540,7 +540,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
}
// Is it excluded?
- if( folder->isFileExcluded(file) ) {
+ if( folder->isFileExcludedAbsolute(file) ) {
return SyncFileStatus(SyncFileStatus::STATUS_IGNORE);
}
--
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