Index: kio/kio/kdirwatch.cpp =================================================================== --- kio/kio/kdirwatch.cpp (wersja 829875) +++ kio/kio/kdirwatch.cpp (kopia robocza) @@ -51,9 +51,6 @@ #include #include #include -#ifdef HAVE_QFILESYSTEMWATCHER -#include -#endif #include #include @@ -202,7 +199,7 @@ #endif #ifdef HAVE_QFILESYSTEMWATCHER availableMethods << "QFileSystemWatcher"; - fsWatcher = new QFileSystemWatcher(); + fsWatcher = new KFileSystemWatcher(); connect(fsWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(fswEventReceived(QString))); connect(fsWatcher, SIGNAL(fileChanged(QString)), this, SLOT(fswEventReceived(QString))); #endif Index: kio/CMakeLists.txt =================================================================== --- kio/CMakeLists.txt (wersja 829875) +++ kio/CMakeLists.txt (kopia robocza) @@ -128,6 +128,12 @@ ) endif(UNIX) +if(WIN32) + set(kiocore_STAT_SRCS ${kiocore_STAT_SRCS} + kio/kdirwatch_win.cpp + ) +endif(WIN32) + set(kbookmarks_STAT_SRCS bookmarks/kbookmark.cc bookmarks/kbookmarkimporter.cc Index: kio/kio/kdirwatch_p.h =================================================================== --- kio/kio/kdirwatch_p.h (wersja 829875) +++ kio/kio/kdirwatch_p.h (kopia robocza) @@ -7,6 +7,7 @@ * Copyright (C) 1998 Sven Radej * Copyright (C) 2006 Dirk Mueller * Copyright (C) 2007 Flavio Castelli + * Copyright (C) 2008 Jaroslaw Staniek * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -63,6 +64,40 @@ #define invalid_ctime ((time_t)-1) +#ifdef HAVE_QFILESYSTEMWATCHER +#include + +#if defined Q_WS_WIN +/* Maximum number of wait objects per single QFileSystemWatcher + * is MAXIMUM_WAIT_OBJECTS (64) on Windows. + * KFileSystemWatcher allocates more QFileSystemWatcher instances on demand + * (and deallocates them). + */ +class KFileSystemWatcher : public QObject +{ + Q_OBJECT +public: + KFileSystemWatcher(); + ~KFileSystemWatcher(); + void addPath(const QString &file); + void removePath(const QString &file); + +Q_SIGNALS: + void fileChanged(const QString &path); + void directoryChanged(const QString &path); + +private: + QFileSystemWatcher* availableWatcher(); + QFileSystemWatcher* m_recentWatcher; + QList m_watchers; + QHash m_usedObjects; + QHash m_paths; +}; +#else +typedef KFileSystemWatcher QFileSystemWatcher; +#endif +#endif + /* KDirWatchPrivate is a singleton and does the watching * for every KDirWatch instance in the application. */ @@ -194,7 +229,7 @@ bool useINotify(Entry*); #endif #ifdef HAVE_QFILESYSTEMWATCHER - QFileSystemWatcher *fsWatcher; + KFileSystemWatcher *fsWatcher; bool useQFSWatch(Entry* e); #endif