30 #include <io/config-kdirwatch.h> 33 #ifndef QT_NO_FILESYSTEMWATCHER 34 #define HAVE_QFILESYSTEMWATCHER 37 #include <QtCore/QList> 38 #include <QtCore/QSet> 39 #include <QtCore/QMap> 40 #include <QtCore/QObject> 41 #include <QtCore/QString> 42 #include <QtCore/QTimer> 43 class QFileSystemWatcher;
44 class QSocketNotifier;
51 #ifdef HAVE_SYS_INOTIFY_H 54 #include <sys/inotify.h> 56 #ifndef IN_DONT_FOLLOW 57 #define IN_DONT_FOLLOW 0x02000000 61 #define IN_ONLYDIR 0x01000000 67 #include <sys/param.h> 71 #define invalid_ctime ((time_t)-1) 73 #ifdef HAVE_QFILESYSTEMWATCHER 74 #include <QtCore/QFileSystemWatcher> 102 QFileSystemWatcher* availableWatcher();
103 QFileSystemWatcher* m_recentWatcher;
122 enum entryMode { UnknownMode = 0, StatMode, DNotifyMode, INotifyMode, FAMMode, QFSWatchMode };
123 enum { NoChange=0, Changed=1, Created=2, Deleted=4 };
156 QString parentDirectory()
const;
157 void addClient(
KDirWatch*, KDirWatch::WatchModes);
159 int clientCount()
const;
160 bool isValid() {
return m_clients.count() || m_entries.count(); }
163 Q_FOREACH(
Entry* sub_entry, m_entries) {
164 if (sub_entry->
path == path)
171 void propagate_dirty();
180 #ifdef HAVE_SYS_INOTIFY_H 197 void useFreq(
Entry* e,
int newFreq);
210 void addWatch(
Entry* entry);
211 void removeWatch(
Entry* entry);
213 int scanEntry(
Entry* e);
218 bool deref() {
return ( --m_ref == 0 ); }
220 static bool isNoisyFile(
const char *filename );
224 void famEventReceived();
225 void inotifyEventReceived();
226 void slotRemoveDelayed();
227 void fswEventReceived(
const QString &path);
238 bool useStat(
Entry*);
252 void checkFAMEvent(FAMEvent*);
256 #ifdef HAVE_SYS_INOTIFY_H 257 QSocketNotifier *mSn;
258 bool supports_inotify;
261 bool useINotify(
Entry*);
263 #ifdef HAVE_QFILESYSTEMWATCHER 265 bool useQFSWatch(
Entry* e);
273 #endif // KDIRWATCH_P_H
QList< Client * > m_clients
Watch just the specified directory.
QList< Entry * > m_entries
KDirWatch::WatchModes m_watchModes
QDebug operator<<(QDebug debug, const KDirWatchPrivate::Entry &entry)
void removePath(const QString &file)
void fileChanged(const QString &path)
KDirWatch::Method m_preferredMethod
KFileSystemWatcher * fsWatcher
QSet< Entry * > removeList
void addPath(const QString &file)
QMap< QString, Entry > EntryMap
Class for watching directory and file changes.
Entry * findSubEntry(const QString &path) const
void directoryChanged(const QString &path)