diff options
author | Zeno Albisser <zeno.albisser@nokia.com> | 2010-05-12 12:41:49 (GMT) |
---|---|---|
committer | Zeno Albisser <zeno.albisser@nokia.com> | 2010-05-27 09:04:51 (GMT) |
commit | 83ad5ebb033799352723a9d968b31a9cef61396c (patch) | |
tree | f92d0e7d7d18905f5297ef37d008fd3fcce0c9da /src/gui/dialogs | |
parent | 5658fac923b419df1f9a95f01b2a5c76737004b2 (diff) | |
download | Qt-83ad5ebb033799352723a9d968b31a9cef61396c.zip Qt-83ad5ebb033799352723a9d968b31a9cef61396c.tar.gz Qt-83ad5ebb033799352723a9d968b31a9cef61396c.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/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/qfilesystemmodel.cpp | 8 | ||||
-rw-r--r-- | src/gui/dialogs/qfilesystemmodel.h | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index e5a8445..b8aafe3 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -1612,6 +1612,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 d8178c7..741f22b 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 |