Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/dialogs/qfileinfogatherer.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5656#ifndef QT_NO_FILESYSTEMMODEL
    5757
    58 bool QFileInfoGatherer::fetchedRoot = false;
     58#ifdef QT_BUILD_INTERNAL
     59static bool fetchedRoot = false;
     60Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot()
     61{
     62    fetchedRoot = false;
     63}
     64
     65Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot()
     66{
     67    return fetchedRoot;
     68}
     69#endif
    5970
    6071/*!
     
    217228}
    218229
    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_WIN
    227     return permissions;
    228 #else
    229     QFile::Permissions p = permissions;
    230     p &= ~(QFile::ReadUser|QFile::WriteUser|QFile::ExeUser);
    231     if (                                     permissions & QFile::ReadOther
    232         || (fileInfo.ownerId() == userId  && permissions & QFile::ReadOwner)
    233         || (fileInfo.groupId() == groupId && permissions & QFile::ReadGroup))
    234         p |= QFile::ReadUser;
    235 
    236     if (                                     permissions & QFile::WriteOther
    237         || (fileInfo.ownerId() == userId  && permissions & QFile::WriteOwner)
    238         || (fileInfo.groupId() == groupId && permissions & QFile::WriteGroup))
    239         p |= QFile::WriteUser;
    240 
    241     if (                                     permissions & QFile::ExeOther
    242         || (fileInfo.ownerId() == userId  && permissions & QFile::ExeOwner)
    243         || (fileInfo.groupId() == groupId && permissions & QFile::ExeGroup))
    244         p |= QFile::ExeUser;
    245     return p;
    246 #endif
    247 }
    248 
    249230QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
    250231{
    251232    QExtendedInformation info(fileInfo);
    252233    info.icon = m_iconProvider->icon(fileInfo);
    253     info.setPermissions(translatePermissions(fileInfo));
    254234    info.displayType = m_iconProvider->type(fileInfo);
    255235#ifndef QT_NO_FILESYSTEMWATCHER
     
    310290    // List drives
    311291    if (path.isEmpty()) {
    312 #if defined Q_AUTOTEST_EXPORT
     292#ifdef QT_BUILD_INTERNAL
    313293        fetchedRoot = true;
    314294#endif
     
    329309    }
    330310
    331     QTime base = QTime::currentTime();
     311    QElapsedTimer base;
     312    base.start();
    332313    QFileInfo fileInfo;
    333314    bool firstTime = true;
     
    355336    if (!updatedFiles.isEmpty())
    356337        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
     341void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) {
    360342    updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo));
    361     QTime current = QTime::currentTime();
     343    QElapsedTimer current;
     344    current.start();
    362345    if ((firstTime && updatedFiles.count() > 100) || base.msecsTo(current) > 1000) {
    363346        emit updates(path, updatedFiles);
Note: See TracChangeset for help on using the changeset viewer.