Changeset 626 for trunk/src/corelib


Ignore:
Timestamp:
Mar 3, 2010, 11:18:36 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

Reverted r613 (see #137).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qfilesystemwatcher.cpp

    r616 r626  
    7171QT_BEGIN_NAMESPACE
    7272
    73 #if defined(Q_OS_OS2)
    74 #  define DRIVES_ROOT QString::null
    75 #endif
    76 
    7773class QPollingFileSystemWatcherEngine : public QFileSystemWatcherEngine
    7874{
     
    119115    mutable QMutex mutex;
    120116    QHash<QString, FileInfo> files, directories;
    121 #if defined(Q_OS_OS2)
    122     QFileInfoList drives;
    123 #endif
    124117
    125118public:
     
    171164            QHash<QString, FileInfo>::iterator x = dit.next();
    172165            QString path = x.key();
    173 #if defined(Q_OS_OS2)
    174             if (path.isEmpty()) {
    175                 // check if we got new/changed drives
    176                 QFileInfoList newDrives = QDir::drives();
    177                 if (drives != QDir::drives()) {
    178                     drives = newDrives;
    179                     emit directoryChanged(QString::null, false);
    180                 }
    181             } else
    182 #endif
    183             {
    184                 QFileInfo fi(path);
    185                 if (!path.endsWith(QLatin1Char('/')))
    186                     fi = QFileInfo(path + QLatin1Char('/'));
    187                 if (!fi.exists()) {
    188                     dit.remove();
    189                     emit directoryChanged(path, true);
    190                 } else if (x.value() != fi) {
    191                     x.value() = fi;
    192                     emit directoryChanged(path, false);
    193                 }
     166            QFileInfo fi(path);
     167            if (!path.endsWith(QLatin1Char('/')))
     168                fi = QFileInfo(path + QLatin1Char('/'));
     169            if (!fi.exists()) {
     170                dit.remove();
     171                emit directoryChanged(path, true);
     172            } else if (x.value() != fi) {
     173                x.value() = fi;
     174                emit directoryChanged(path, false);
    194175            }
    195176            yieldCurrentThread();
     
    216197    while (it.hasNext()) {
    217198        QString path = it.next();
    218 #if defined(Q_OS_OS2)
    219         if (path.isEmpty()) {
    220             // asked to watch for drives
    221             if (!directories->contains(DRIVES_ROOT))
    222                 directories->append(DRIVES_ROOT);
    223             this->directories.insert(DRIVES_ROOT, QFileInfo());
     199        QFileInfo fi(path);
     200        if (!fi.exists())
     201            continue;
     202        if (fi.isDir()) {
     203            if (!directories->contains(path))
     204                directories->append(path);
     205            if (!path.endsWith(QLatin1Char('/')))
     206                fi = QFileInfo(path + QLatin1Char('/'));
     207            this->directories.insert(path, fi);
    224208            startOver = true;
    225         } else
    226 #endif
    227         {
    228             QFileInfo fi(path);
    229             if (!fi.exists())
    230                 continue;
    231             if (fi.isDir()) {
    232                 if (!directories->contains(path))
    233                     directories->append(path);
    234                 if (!path.endsWith(QLatin1Char('/')))
    235                     fi = QFileInfo(path + QLatin1Char('/'));
    236                 this->directories.insert(path, fi);
    237                 startOver = true;
    238             } else {
    239                 if (!files->contains(path))
    240                     files->append(path);
    241                 this->files.insert(path, fi);
    242                 startOver = true;
    243             }
     209        } else {
     210            if (!files->contains(path))
     211                files->append(path);
     212            this->files.insert(path, fi);
     213            startOver = true;
    244214        }
    245215        it.remove();
     
    258228    while (it.hasNext()) {
    259229        QString path = it.next();
    260 #if defined(Q_OS_OS2)
    261         if (path.isEmpty()) {
    262             // asked to stop watching for drives
    263             if (this->directories.remove(DRIVES_ROOT)) {
    264                 directories->removeAll(DRIVES_ROOT);
    265                 it.remove();
    266                 startOver = true;
    267             }
    268         } else
    269 #endif
    270230        if (this->directories.remove(path)) {
    271231            directories->removeAll(path);
     
    533493void QFileSystemWatcher::addPath(const QString &path)
    534494{
    535 #if !defined(Q_OS_OS2)
    536495    if (path.isEmpty()) {
    537496        qWarning("QFileSystemWatcher::addPath: path is empty");
    538497        return;
    539498    }
    540 #endif
    541499    addPaths(QStringList(path));
    542500}
Note: See TracChangeset for help on using the changeset viewer.