[Pkg-owncloud-commits] [owncloud-client] 324/498: FolderWatcher: Add flag to ignore hidden files (or not).
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:03 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 711ae1d347f2d9795511e1d34c363bc1e17f10da
Author: Klaas Freitag <freitag at owncloud.com>
Date: Tue Jul 14 12:00:22 2015 +0200
FolderWatcher: Add flag to ignore hidden files (or not).
---
src/gui/folderwatcher.cpp | 25 ++++++++++++++++++++-----
src/gui/folderwatcher.h | 5 +++++
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp
index 8742039..b76480f 100644
--- a/src/gui/folderwatcher.cpp
+++ b/src/gui/folderwatcher.cpp
@@ -36,7 +36,8 @@
namespace OCC {
FolderWatcher::FolderWatcher(const QString &root, QObject *parent)
- : QObject(parent)
+ : QObject(parent),
+ _ignoreHidden(true)
{
_d.reset(new FolderWatcherPrivate(this, root));
@@ -46,6 +47,16 @@ FolderWatcher::FolderWatcher(const QString &root, QObject *parent)
FolderWatcher::~FolderWatcher()
{ }
+void FolderWatcher::setIgnoreHidden(bool ignore)
+{
+ _ignoreHidden = ignore;
+}
+
+bool FolderWatcher::ignoreHidden()
+{
+ return _ignoreHidden;
+}
+
void FolderWatcher::addIgnoreListFile( const QString& file )
{
if( file.isEmpty() ) return;
@@ -71,10 +82,14 @@ bool FolderWatcher::pathIsIgnored( const QString& path )
{
if( path.isEmpty() ) return true;
- QFileInfo fInfo(path);
- if( fInfo.isHidden() ) {
- qDebug() << "* Discarded as is hidden!" << fInfo.filePath();
- return true;
+ // if events caused by changes to hidden files should be ignored, a QFileInfo
+ // object will tell us if the file is hidden
+ if( _ignoreHidden ) {
+ QFileInfo fInfo(path);
+ if( fInfo.isHidden() ) {
+ qDebug() << "* Discarded as is hidden!" << fInfo.filePath();
+ return true;
+ }
}
// TODO: Best use csync_excluded_no_ctx() here somehow!
diff --git a/src/gui/folderwatcher.h b/src/gui/folderwatcher.h
index 7a7a41d..b0f5299 100644
--- a/src/gui/folderwatcher.h
+++ b/src/gui/folderwatcher.h
@@ -77,6 +77,10 @@ public:
/* Check if the path is ignored. */
bool pathIsIgnored( const QString& path );
+ /* set if the folderwatcher ignores events of hidden files */
+ void setIgnoreHidden(bool ignore);
+ bool ignoreHidden();
+
signals:
/** Emitted when one of the watched directories or one
* of the contained files is changed. */
@@ -98,6 +102,7 @@ private:
QStringList _ignores;
QTime _timer;
QSet<QString> _lastPaths;
+ bool _ignoreHidden;
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