diff options
author | Alexis Menard <alexis.menard@trolltech.com> | 2009-03-24 15:02:02 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@trolltech.com> | 2009-03-24 15:12:16 (GMT) |
commit | 2b9e47e4ce09802f00fa2ca39c0cd877f59ae4d9 (patch) | |
tree | f4123fd883c63c1df744fd1affe547b8e5fb30ce /src/gui/dialogs/qfileinfogatherer.cpp | |
parent | dd7b1f11fa4b682d4283274d1fcba8a801fa10f1 (diff) | |
download | Qt-2b9e47e4ce09802f00fa2ca39c0cd877f59ae4d9.zip Qt-2b9e47e4ce09802f00fa2ca39c0cd877f59ae4d9.tar.gz Qt-2b9e47e4ce09802f00fa2ca39c0cd877f59ae4d9.tar.bz2 |
Fix some extra file system stats that we were doing in the model.
This patch basically ensure that we share the same QFileinfo all over
the place for each nodes (then we benefit of the cache). It fix also an
extra stat due of a bugfix that was not optimal.
Task-number: 247645
Reviewed-by: jasplin
Diffstat (limited to 'src/gui/dialogs/qfileinfogatherer.cpp')
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 3fe64ff..23a2cbc 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -168,6 +168,20 @@ void QFileInfoGatherer::clear() } /* + Remove a \a path from the watcher + + \sa listed() +*/ +void QFileInfoGatherer::removePath(const QString &path) +{ +#ifndef QT_NO_FILESYSTEMWATCHER + mutex.lock(); + watcher->removePath(path); + mutex.unlock(); +#endif +} + +/* List all files in \a directoryPath \sa listed() @@ -286,15 +300,9 @@ QString QFileInfoGatherer::translateDriveName(const QFileInfo &drive) const void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &files) { #ifndef QT_NO_FILESYSTEMWATCHER - //### We test here if the path still exist before adding it in the watcher - //### because sometime the file is deleted just before enter here so QStringList files is not up to date - //### It is not a proper fix, perhaps in 4.6 we should have a better way to avoid that - //### to ensure the gatherer have fresh information - QFileInfo info(path); if (files.isEmpty() && !watcher->directories().contains(path) && !path.isEmpty() - && info.exists() && !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) { watcher->addPath(path); } |