diff options
Diffstat (limited to 'src/widgets/dialogs/qfilesystemmodel.cpp')
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 8e3ecc3e0e..9c6d972baa 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -199,32 +199,10 @@ QT_BEGIN_NAMESPACE bool QFileSystemModel::remove(const QModelIndex &aindex) { - //### TODO optim - QString path = filePath(aindex); + const QString path = filePath(aindex); QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func()); d->fileInfoGatherer.removePath(path); - QDirIterator it(path, - QDir::AllDirs | QDir:: Files | QDir::NoDotAndDotDot, - QDirIterator::Subdirectories); - QStringList children; - while (it.hasNext()) - children.prepend(it.next()); - children.append(path); - - bool error = false; - for (int i = 0; i < children.count(); ++i) { - QFileInfo info(children.at(i)); - QModelIndex modelIndex = index(children.at(i)); - if (info.isDir()) { - QDir dir; - if (children.at(i) != path) - error |= remove(modelIndex); - error |= rmdir(modelIndex); - } else { - error |= QFile::remove(filePath(modelIndex)); - } - } - return error; + return QDir(path).removeRecursively(); } /*! @@ -800,7 +778,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const if (!index.isValid()) return QString(); QFileSystemNode *dirNode = node(index); - if (fileInfoGatherer.resolveSymlinks() && !resolvedSymLinks.isEmpty() && dirNode->isSymLink()) { + if (fileInfoGatherer.resolveSymlinks() && !resolvedSymLinks.isEmpty() && dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) { QString fullPath = QDir::fromNativeSeparators(filePath(index)); if (resolvedSymLinks.contains(fullPath)) return resolvedSymLinks[fullPath]; @@ -1669,7 +1647,7 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons return; QStringList toRemove; QStringList newFiles = files; - qSort(newFiles.begin(), newFiles.end()); + std::sort(newFiles.begin(), newFiles.end()); QHash<QString, QFileSystemNode*>::const_iterator i = parentNode->children.constBegin(); while (i != parentNode->children.constEnd()) { QStringList::iterator iterator; @@ -1874,7 +1852,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QL } // bundle up all of the changed signals into as few as possible. - qSort(rowsToUpdate.begin(), rowsToUpdate.end()); + std::sort(rowsToUpdate.begin(), rowsToUpdate.end()); QString min; QString max; for (int i = 0; i < rowsToUpdate.count(); ++i) { |