[Pkg-owncloud-commits] [owncloud-client] 323/498: Hidden Files: Add a setting to ignore hidden files or not.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:02 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 a4336092f61fe87b372f6853d2549c097c8f3860
Author: Klaas Freitag <freitag at owncloud.com>
Date: Mon Jul 13 22:15:02 2015 +0200
Hidden Files: Add a setting to ignore hidden files or not.
This setting goes to the folder definition. By default, no hidden
files are synced.
---
csync/src/csync.c | 1 +
csync/src/csync_private.h | 2 ++
csync/src/csync_update.c | 2 +-
src/gui/folder.cpp | 5 +++++
src/gui/folder.h | 2 ++
5 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/csync/src/csync.c b/csync/src/csync.c
index 985e084..0122b5f 100644
--- a/csync/src/csync.c
+++ b/csync/src/csync.c
@@ -593,6 +593,7 @@ int csync_commit(CSYNC *ctx) {
ctx->remote.read_from_db = 0;
ctx->read_remote_from_db = true;
ctx->db_is_empty = false;
+ ctx->ignore_hidden_files = true; // do NOT sync hidden files by default.
/* Create new trees */
diff --git a/csync/src/csync_private.h b/csync/src/csync_private.h
index 973437b..4209bbe 100644
--- a/csync/src/csync_private.h
+++ b/csync/src/csync_private.h
@@ -168,6 +168,8 @@ struct csync_s {
*/
bool db_is_empty;
+ bool ignore_hidden_files;
+
struct csync_owncloud_ctx_s *owncloud_context;
};
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index a848ff8..3fd98eb 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -177,7 +177,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
} else {
/* This code should probably be in csync_exclude, but it does not have the fs parameter.
Keep it here for now */
- if (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN) {
+ if (ctx->ignore_hidden_files && (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN)) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path);
excluded = CSYNC_FILE_EXCLUDE_HIDDEN;
}
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index b2cc62f..f83ad78 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -813,6 +813,9 @@ void Folder::startSync(const QStringList &pathList)
return;
}
+ // pass the setting if hidden files are to be ignored, will be read in csync_update
+ _csync_ctx->ignore_hidden_files = _definition.ignoreHiddenFiles;
+
_engine.reset(new SyncEngine( _accountState->account(), _csync_ctx, path(), remoteUrl().path(), remotePath(), &_journal));
qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector");
@@ -1086,6 +1089,7 @@ void FolderDefinition::save(QSettings& settings, const FolderDefinition& folder)
settings.setValue(QLatin1String("localPath"), folder.localPath);
settings.setValue(QLatin1String("targetPath"), folder.targetPath);
settings.setValue(QLatin1String("paused"), folder.paused);
+ settings.setValue(QLatin1String("ignoreHiddenFiles"), folder.ignoreHiddenFiles);
settings.endGroup();
}
@@ -1097,6 +1101,7 @@ bool FolderDefinition::load(QSettings& settings, const QString& alias,
folder->localPath = settings.value(QLatin1String("localPath")).toString();
folder->targetPath = settings.value(QLatin1String("targetPath")).toString();
folder->paused = settings.value(QLatin1String("paused")).toBool();
+ folder->ignoreHiddenFiles = settings.value(QLatin1String("ignoreHiddenFiles"), QVariant(true)).toBool();
settings.endGroup();
return true;
}
diff --git a/src/gui/folder.h b/src/gui/folder.h
index 72843ed..837cae4 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -63,6 +63,8 @@ public:
QString targetPath;
/// whether the folder is paused
bool paused;
+ /// whether the folder syncs hidden files
+ bool ignoreHiddenFiles;
/// Saves the folder definition, creating a new settings group.
static void save(QSettings& settings, const FolderDefinition& folder);
--
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