From 6081658ce5e8c7c04ccd8592f5a110107db12a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Mon, 11 Mar 2013 17:39:17 +0000 Subject: Reorder for performance reasons. isSymLink() can be expensive in a few cases. Change-Id: Ib8b9f0c13d7ce141a539a4729be81d9faa4382ea Reviewed-by: David Faure (KDE) (cherry picked from commit 1975e65d73ef2bf225bd765e6b50b6f50167f71c) Reviewed-by: Friedemann Kleint --- src/gui/dialogs/qfileinfogatherer.cpp | 2 +- src/gui/dialogs/qfilesystemmodel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 00769f6..d58a183 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -248,7 +248,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const #endif #endif - if (fileInfo.isSymLink() && m_resolveSymlinks) { + if (m_resolveSymlinks && fileInfo.isSymLink()) { QFileInfo resolvedInfo(fileInfo.symLinkTarget()); resolvedInfo = resolvedInfo.canonicalFilePath(); if (resolvedInfo.exists()) { diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 76a38c2..8007c4e 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -803,7 +803,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const if (!index.isValid()) return QString(); QFileSystemNode *dirNode = node(index); - if (dirNode->isSymLink() && fileInfoGatherer.resolveSymlinks()) { + if (fileInfoGatherer.resolveSymlinks() && !resolvedSymLinks.isEmpty() && dirNode->isSymLink()) { QString fullPath = QDir::fromNativeSeparators(filePath(index)); if (resolvedSymLinks.contains(fullPath)) return resolvedSymLinks[fullPath]; -- cgit v0.12