Index: /trunk/src/corelib/io/qfilesystemwatcher.cpp
===================================================================
--- /trunk/src/corelib/io/qfilesystemwatcher.cpp	(revision 612)
+++ /trunk/src/corelib/io/qfilesystemwatcher.cpp	(revision 613)
@@ -69,4 +69,8 @@
 QT_BEGIN_NAMESPACE
 
+#if defined(Q_OS_OS2)
+#  define DRIVES_ROOT QString::null
+#endif
+
 class QPollingFileSystemWatcherEngine : public QFileSystemWatcherEngine
 {
@@ -113,4 +117,7 @@
     mutable QMutex mutex;
     QHash<QString, FileInfo> files, directories;
+#if defined(Q_OS_OS2)
+    QFileInfoList drives;
+#endif
 
 public:
@@ -162,13 +169,25 @@
             QHash<QString, FileInfo>::iterator x = dit.next();
             QString path = x.key();
-            QFileInfo fi(path);
-            if (!path.endsWith(QLatin1Char('/')))
-                fi = QFileInfo(path + QLatin1Char('/'));
-            if (!fi.exists()) {
-                dit.remove();
-                emit directoryChanged(path, true);
-            } else if (x.value() != fi) {
-                x.value() = fi;
-                emit directoryChanged(path, false);
+#if defined(Q_OS_OS2)
+            if (path.isEmpty()) {
+                // check if we got new/changed drives
+                QFileInfoList newDrives = QDir::drives();
+                if (drives != QDir::drives()) {
+                    drives = newDrives;
+                    emit directoryChanged(QString::null, false);
+                }
+            } else
+#endif
+            {
+                QFileInfo fi(path);
+                if (!path.endsWith(QLatin1Char('/')))
+                    fi = QFileInfo(path + QLatin1Char('/'));
+                if (!fi.exists()) {
+                    dit.remove();
+                    emit directoryChanged(path, true);
+                } else if (x.value() != fi) {
+                    x.value() = fi;
+                    emit directoryChanged(path, false);
+                }
             }
             yieldCurrentThread();
@@ -195,19 +214,30 @@
     while (it.hasNext()) {
         QString path = it.next();
-        QFileInfo fi(path);
-        if (!fi.exists())
-            continue;
-        if (fi.isDir()) {
-            if (!directories->contains(path))
-                directories->append(path);
-            if (!path.endsWith(QLatin1Char('/')))
-                fi = QFileInfo(path + QLatin1Char('/'));
-            this->directories.insert(path, fi);
+#if defined(Q_OS_OS2)
+        if (path.isEmpty()) {
+            // asked to watch for drives
+            if (!directories->contains(DRIVES_ROOT))
+                directories->append(DRIVES_ROOT);
+            this->directories.insert(DRIVES_ROOT, QFileInfo());
             startOver = true;
-        } else {
-            if (!files->contains(path))
-                files->append(path);
-            this->files.insert(path, fi);
-            startOver = true;
+        } else
+#endif
+        {
+            QFileInfo fi(path);
+            if (!fi.exists())
+                continue;
+            if (fi.isDir()) {
+                if (!directories->contains(path))
+                    directories->append(path);
+                if (!path.endsWith(QLatin1Char('/')))
+                    fi = QFileInfo(path + QLatin1Char('/'));
+                this->directories.insert(path, fi);
+                startOver = true;
+            } else {
+                if (!files->contains(path))
+                    files->append(path);
+                this->files.insert(path, fi);
+                startOver = true;
+            }
         }
         it.remove();
@@ -226,4 +256,14 @@
     while (it.hasNext()) {
         QString path = it.next();
+#if defined(Q_OS_OS2)
+        if (path.isEmpty()) {
+            // asked to stop watching for drives
+            if (this->directories.remove(DRIVES_ROOT)) {
+                directories->removeAll(DRIVES_ROOT);
+                it.remove();
+                startOver = true;
+            }
+        } else
+#endif
         if (this->directories.remove(path)) {
             directories->removeAll(path);
@@ -485,8 +525,10 @@
 void QFileSystemWatcher::addPath(const QString &path)
 {
+#if !defined(Q_OS_OS2)
     if (path.isEmpty()) {
         qWarning("QFileSystemWatcher::addPath: path is empty");
         return;
     }
+#endif
     addPaths(QStringList(path));
 }
Index: /trunk/src/gui/dialogs/qfileinfogatherer.cpp
===================================================================
--- /trunk/src/gui/dialogs/qfileinfogatherer.cpp	(revision 612)
+++ /trunk/src/gui/dialogs/qfileinfogatherer.cpp	(revision 613)
@@ -302,5 +302,7 @@
     if (files.isEmpty()
         && !watcher->directories().contains(path)
+#if !defined(Q_OS_OS2)
         && !path.isEmpty()
+#endif
         && !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
         watcher->addPath(path);
