summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2010-12-27 00:59:40 (GMT)
committerFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-04-04 13:55:32 (GMT)
commitb60d82fd56897b1a1d3cc730172f71c27a497ede (patch)
tree8b80e18d0562b0b049a75fe8a3ac29d247c97b10 /src/gui/dialogs
parentd8941c0c0e3e3019a2048ae470e4e46111a2cfcf (diff)
downloadQt-b60d82fd56897b1a1d3cc730172f71c27a497ede.zip
Qt-b60d82fd56897b1a1d3cc730172f71c27a497ede.tar.gz
Qt-b60d82fd56897b1a1d3cc730172f71c27a497ede.tar.bz2
QFileSystemModel: Handle QDir::NoDot and QDir::NoDotDot for setFilter
Add support for QDir::NoDot and QDir::NoDotDot for setFilter in QFileSystemModel. Task-number: QTBUG-14760 Reviewed-by: Frederik
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index cb8eb6a..ff4410d 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -1977,13 +1977,14 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
const bool hideHidden = !(filters & QDir::Hidden);
const bool hideSystem = !(filters & QDir::System);
const bool hideSymlinks = (filters & QDir::NoSymLinks);
- const bool hideDotAndDotDot = (filters & QDir::NoDotAndDotDot);
+ const bool hideDot = (filters & QDir::NoDot) || (filters & QDir::NoDotAndDotDot); // ### Qt5: simplify (because NoDotAndDotDot=NoDot|NoDotDot)
+ const bool hideDotDot = (filters & QDir::NoDotDot) || (filters & QDir::NoDotAndDotDot); // ### Qt5: simplify (because NoDotAndDotDot=NoDot|NoDotDot)
// Note that we match the behavior of entryList and not QFileInfo on this and this
// incompatibility won't be fixed until Qt 5 at least
- bool isDotOrDot = ( (node->fileName == QLatin1String(".")
- || node->fileName == QLatin1String("..")));
- if ( (hideHidden && (!isDotOrDot && node->isHidden()))
+ bool isDot = (node->fileName == QLatin1String("."));
+ bool isDotDot = (node->fileName == QLatin1String(".."));
+ if ( (hideHidden && !(isDot || isDotDot) && node->isHidden())
|| (hideSystem && node->isSystem())
|| (hideDirs && node->isDir())
|| (hideFiles && node->isFile())
@@ -1991,7 +1992,8 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
|| (hideReadable && node->isReadable())
|| (hideWritable && node->isWritable())
|| (hideExecutable && node->isExecutable())
- || (hideDotAndDotDot && isDotOrDot))
+ || (hideDot && isDot)
+ || (hideDotDot && isDotDot))
return false;
return nameFilterDisables || passNameFilters(node);