Changeset 846 for trunk/src/gui/dialogs/qfileinfogatherer.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/dialogs/qfileinfogatherer.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 56 56 #ifndef QT_NO_FILESYSTEMMODEL 57 57 58 bool QFileInfoGatherer::fetchedRoot = false; 58 #ifdef QT_BUILD_INTERNAL 59 static bool fetchedRoot = false; 60 Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot() 61 { 62 fetchedRoot = false; 63 } 64 65 Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot() 66 { 67 return fetchedRoot; 68 } 69 #endif 59 70 60 71 /*! … … 217 228 } 218 229 219 /*220 QFileInfo::permissions is different depending upon your platform.221 222 "normalize this" so they can mean the same to us.223 */224 QFile::Permissions QFileInfoGatherer::translatePermissions(const QFileInfo &fileInfo) const {225 QFile::Permissions permissions = fileInfo.permissions();226 #ifdef Q_OS_WIN227 return permissions;228 #else229 QFile::Permissions p = permissions;230 p &= ~(QFile::ReadUser|QFile::WriteUser|QFile::ExeUser);231 if ( permissions & QFile::ReadOther232 || (fileInfo.ownerId() == userId && permissions & QFile::ReadOwner)233 || (fileInfo.groupId() == groupId && permissions & QFile::ReadGroup))234 p |= QFile::ReadUser;235 236 if ( permissions & QFile::WriteOther237 || (fileInfo.ownerId() == userId && permissions & QFile::WriteOwner)238 || (fileInfo.groupId() == groupId && permissions & QFile::WriteGroup))239 p |= QFile::WriteUser;240 241 if ( permissions & QFile::ExeOther242 || (fileInfo.ownerId() == userId && permissions & QFile::ExeOwner)243 || (fileInfo.groupId() == groupId && permissions & QFile::ExeGroup))244 p |= QFile::ExeUser;245 return p;246 #endif247 }248 249 230 QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const 250 231 { 251 232 QExtendedInformation info(fileInfo); 252 233 info.icon = m_iconProvider->icon(fileInfo); 253 info.setPermissions(translatePermissions(fileInfo));254 234 info.displayType = m_iconProvider->type(fileInfo); 255 235 #ifndef QT_NO_FILESYSTEMWATCHER … … 310 290 // List drives 311 291 if (path.isEmpty()) { 312 #if defined Q_AUTOTEST_EXPORT292 #ifdef QT_BUILD_INTERNAL 313 293 fetchedRoot = true; 314 294 #endif … … 329 309 } 330 310 331 QTime base = QTime::currentTime(); 311 QElapsedTimer base; 312 base.start(); 332 313 QFileInfo fileInfo; 333 314 bool firstTime = true; … … 355 336 if (!updatedFiles.isEmpty()) 356 337 emit updates(path, updatedFiles); 357 } 358 359 void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QTime &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) { 338 emit directoryLoaded(path); 339 } 340 341 void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) { 360 342 updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo)); 361 QTime current = QTime::currentTime(); 343 QElapsedTimer current; 344 current.start(); 362 345 if ((firstTime && updatedFiles.count() > 100) || base.msecsTo(current) > 1000) { 363 346 emit updates(path, updatedFiles);
Note:
See TracChangeset
for help on using the changeset viewer.