summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@nokia.com>2010-05-12 12:41:49 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:39 (GMT)
commitbed275599ff44809372af99b9b6cbe492f5fdec8 (patch)
treefcc8fdde12af7567a08b5e69c1c10b55b340a182 /src
parent0cc309d2dd0469bc8997154455b91fba4697ccc5 (diff)
downloadQt-bed275599ff44809372af99b9b6cbe492f5fdec8.zip
Qt-bed275599ff44809372af99b9b6cbe492f5fdec8.tar.gz
Qt-bed275599ff44809372af99b9b6cbe492f5fdec8.tar.bz2
make QFileSystemModel::rmdir(dir) remove dir from fileInfoGatherer
Otherwise directories cannot be deleted as long as they are watched, since the fileInfoGatherer keeps a QFileInfo object with open file handles. Reviewed-by: Joao Task-number: QTBUG-8241
Diffstat (limited to 'src')
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp8
-rw-r--r--src/gui/dialogs/qfilesystemmodel.h4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index f9f9df8..86f2920 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -1631,6 +1631,14 @@ bool QFileSystemModel::event(QEvent *event)
return QAbstractItemModel::event(event);
}
+bool QFileSystemModel::rmdir(const QModelIndex &aindex) const
+{
+ QString path = filePath(aindex);
+ QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func());
+ d->fileInfoGatherer.removePath(path);
+ return QDir().rmdir(path);
+}
+
/*!
\internal
diff --git a/src/gui/dialogs/qfilesystemmodel.h b/src/gui/dialogs/qfilesystemmodel.h
index 1e4d673..0b1fa47 100644
--- a/src/gui/dialogs/qfilesystemmodel.h
+++ b/src/gui/dialogs/qfilesystemmodel.h
@@ -139,7 +139,7 @@ public:
QDateTime lastModified(const QModelIndex &index) const;
QModelIndex mkdir(const QModelIndex &parent, const QString &name);
- inline bool rmdir(const QModelIndex &index) const;
+ bool rmdir(const QModelIndex &index) const; // ### Qt5: should not be const
inline QString fileName(const QModelIndex &index) const;
inline QIcon fileIcon(const QModelIndex &index) const;
QFile::Permissions permissions(const QModelIndex &index) const;
@@ -163,8 +163,6 @@ private:
friend class QFileDialogPrivate;
};
-inline bool QFileSystemModel::rmdir(const QModelIndex &aindex) const
-{ QDir dir; return dir.rmdir(filePath(aindex)); }
inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const
{ return aindex.data(Qt::DisplayRole).toString(); }
inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const