From 204f389f9296cc742153b38dea67128d38514b66 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Tue, 9 Mar 2010 14:57:28 +0100 Subject: remove unneeded "permissions normalization" code from QFileInfoGatherer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the file engine now properly calculates user permissions, there's no need to check the owner and group IDs here. Merge-request: 428 Reviewed-by: João Abecasis --- src/gui/dialogs/qfileinfogatherer.cpp | 31 ------------------------------- src/gui/dialogs/qfileinfogatherer_p.h | 8 +------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index c75cdfd..3b08bf6 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -216,41 +216,10 @@ void QFileInfoGatherer::run() } } -/* - QFileInfo::permissions is different depending upon your platform. - - "normalize this" so they can mean the same to us. -*/ -QFile::Permissions QFileInfoGatherer::translatePermissions(const QFileInfo &fileInfo) const { - QFile::Permissions permissions = fileInfo.permissions(); -#ifdef Q_OS_WIN - return permissions; -#else - QFile::Permissions p = permissions; - p &= ~(QFile::ReadUser|QFile::WriteUser|QFile::ExeUser); - if ( permissions & QFile::ReadOther - || (fileInfo.ownerId() == userId && permissions & QFile::ReadOwner) - || (fileInfo.groupId() == groupId && permissions & QFile::ReadGroup)) - p |= QFile::ReadUser; - - if ( permissions & QFile::WriteOther - || (fileInfo.ownerId() == userId && permissions & QFile::WriteOwner) - || (fileInfo.groupId() == groupId && permissions & QFile::WriteGroup)) - p |= QFile::WriteUser; - - if ( permissions & QFile::ExeOther - || (fileInfo.ownerId() == userId && permissions & QFile::ExeOwner) - || (fileInfo.groupId() == groupId && permissions & QFile::ExeGroup)) - p |= QFile::ExeUser; - return p; -#endif -} - QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const { QExtendedInformation info(fileInfo); info.icon = m_iconProvider->icon(fileInfo); - info.setPermissions(translatePermissions(fileInfo)); info.displayType = m_iconProvider->type(fileInfo); #ifndef QT_NO_FILESYSTEMWATCHER // ### Not ready to listen all modifications diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index b8b58a2..eff6b3c 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -88,11 +88,7 @@ public: return fe.caseSensitive(); } QFile::Permissions permissions() const { - return mPermissions; - } - - void setPermissions (QFile::Permissions permissions) { - mPermissions = permissions; + return mFileInfo.permissions(); } Type type() const { @@ -140,7 +136,6 @@ public: private : QFileInfo mFileInfo; - QFile::Permissions mPermissions; }; class QFileIconProvider; @@ -181,7 +176,6 @@ protected: private: void fetch(const QFileInfo &info, QTime &base, bool &firstTime, QList > &updatedFiles, const QString &path); QString translateDriveName(const QFileInfo &drive) const; - QFile::Permissions translatePermissions(const QFileInfo &fileInfo) const; QMutex mutex; QWaitCondition condition; -- cgit v0.12