summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_win_p.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-05-24 11:15:16 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2016-10-18 07:52:22 +0000
commit45580aa92557caa4f3f5be783573ddb80602e494 (patch)
tree31abaac0c77ae0588e65b56ea7f2c401492bb4d4 /src/corelib/io/qfilesystemwatcher_win_p.h
parentae6681673eb5c7768070cad61f483d2a5405dc9e (diff)
QFileSystemWatcher/Win32: Listen for WM_DEVICECHANGE
Add a class QWindowsRemovableDriveListener to QWindowsFileSystemWatcherEngine listening to the WM_DEVICECHANGE messages sent to the top level windows to detect insertion and removal of USB drives. In addition, hook into QWindowsFileSystemWatcherEngine::addPaths() when watching on removable drives, registering a notification for a volume-lock-for-removal message on the internal window handle obtained from QEventDispatcherWin32. When a request to lock the volume for removal is received, remove the paths from the watcher, enabling removal. The class instance is set as a dynamic property on the QFileSystemWatcher where it can be retrieved from clients. This is primarily intended for use by QFileInfoGatherer/QFileSystemModel. Task-number: QTBUG-14290 Task-number: QTBUG-18729 Task-number: QTBUG-55459 Change-Id: Ic95b9d9291b1ec6f426c0702bad896bb064b9346 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_win_p.h')
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index e8f5c49dec..51c7082483 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -66,6 +66,7 @@
QT_BEGIN_NAMESPACE
class QWindowsFileSystemWatcherEngineThread;
+class QWindowsRemovableDriveListener;
// Even though QWindowsFileSystemWatcherEngine is derived of QThread
// via QFileSystemWatcher, it does not start a thread.
@@ -75,9 +76,7 @@ class QWindowsFileSystemWatcherEngine : public QFileSystemWatcherEngine
{
Q_OBJECT
public:
- inline QWindowsFileSystemWatcherEngine(QObject *parent)
- : QFileSystemWatcherEngine(parent)
- { }
+ explicit QWindowsFileSystemWatcherEngine(QObject *parent);
~QWindowsFileSystemWatcherEngine();
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
@@ -121,9 +120,17 @@ public:
|| lastModified != fileInfo.lastModified());
}
};
+
+signals:
+ void driveLockForRemoval(const QString &);
+ void driveLockForRemovalFailed(const QString &);
+ void driveRemoved(const QString &);
+
private:
QList<QWindowsFileSystemWatcherEngineThread *> threads;
-
+#ifndef Q_OS_WINRT
+ QWindowsRemovableDriveListener *m_driveListener;
+#endif
};
class QFileSystemWatcherPathKey : public QString