diff options
author | Klaas Freitag <freitag@owncloud.com> | 2015-07-14 13:00:22 +0300 |
---|---|---|
committer | Klaas Freitag <freitag@owncloud.com> | 2015-07-15 16:54:41 +0300 |
commit | 711ae1d347f2d9795511e1d34c363bc1e17f10da (patch) | |
tree | 64871da3766910b2ebefbe50618500567b796655 /src/gui/folderwatcher.cpp | |
parent | a4336092f61fe87b372f6853d2549c097c8f3860 (diff) |
FolderWatcher: Add flag to ignore hidden files (or not).
Diffstat (limited to 'src/gui/folderwatcher.cpp')
-rw-r--r-- | src/gui/folderwatcher.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp index 874203982..b76480f70 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! |