From 5159cd2beb2e87806a5b54e9991b7895285c9d3e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:04:16 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tdeio/tdeio/kdirwatch_p.h | 158 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 tdeio/tdeio/kdirwatch_p.h (limited to 'tdeio/tdeio/kdirwatch_p.h') diff --git a/tdeio/tdeio/kdirwatch_p.h b/tdeio/tdeio/kdirwatch_p.h new file mode 100644 index 000000000..8777f56b2 --- /dev/null +++ b/tdeio/tdeio/kdirwatch_p.h @@ -0,0 +1,158 @@ +/* Private Header for class of KDirWatchPrivate + * + * this separate header file is needed for MOC processing + * because KDirWatchPrivate has signals and slots + */ + +#ifndef _KDIRWATCH_P_H +#define _KDIRWATCH_P_H + +#ifdef HAVE_FAM +#include +#endif + +#include + +#define invalid_ctime ((time_t)-1) + +/* KDirWatchPrivate is a singleton and does the watching + * for every KDirWatch instance in the application. + */ +class KDirWatchPrivate : public TQObject +{ + Q_OBJECT +public: + + enum entryStatus { Normal = 0, NonExistent }; + enum entryMode { UnknownMode = 0, StatMode, DNotifyMode, INotifyMode, FAMMode }; + enum { NoChange=0, Changed=1, Created=2, Deleted=4 }; + + struct Client { + KDirWatch* instance; + int count; + // did the instance stop watching + bool watchingStopped; + // events blocked when stopped + int pending; + }; + + class Entry + { + public: + // the last observed modification time + time_t m_ctime; + // the last observed link count + int m_nlink; + entryStatus m_status; + entryMode m_mode; + bool isDir; + // instances interested in events + TQPtrList m_clients; + // nonexistent entries of this directory + TQPtrList m_entries; + TQString path; + + int msecLeft, freq; + + void addClient(KDirWatch*); + void removeClient(KDirWatch*); + int clients(); + bool isValid() { return m_clients.count() || m_entries.count(); } + + bool dirty; + void propagate_dirty(); + +#ifdef HAVE_FAM + FAMRequest fr; +#endif + +#ifdef HAVE_DNOTIFY + int dn_fd; +#endif +#ifdef HAVE_INOTIFY + int wd; +#endif + }; + + typedef TQMap EntryMap; + + KDirWatchPrivate(); + ~KDirWatchPrivate(); + + void resetList (KDirWatch*,bool); + void useFreq(Entry* e, int newFreq); + void addEntry(KDirWatch*,const TQString&, Entry*, bool); + void removeEntry(KDirWatch*,const TQString&, Entry*); + bool stopEntryScan(KDirWatch*, Entry*); + bool restartEntryScan(KDirWatch*, Entry*, bool ); + void stopScan(KDirWatch*); + void startScan(KDirWatch*, bool, bool); + + void removeEntries(KDirWatch*); + void statistics(); + + Entry* entry(const TQString&); + int scanEntry(Entry* e); + void emitEvent(Entry* e, int event, const TQString &fileName = TQString::null); + + // Memory management - delete when last KDirWatch gets deleted + void ref() { m_ref++; } + bool deref() { return ( --m_ref == 0 ); } + + static bool isNoisyFile( const char *filename ); + +public slots: + void slotRescan(); + void famEventReceived(); // for FAM + void slotActivated(); // for DNOTIFY + void slotRemoveDelayed(); + +public: + TQTimer *timer; + EntryMap m_mapEntries; + + int freq; + int statEntries; + int m_nfsPollInterval, m_PollInterval; + int m_ref; + bool useStat(Entry*); + + bool delayRemove; + TQPtrList removeList; + + bool rescan_all; + TQTimer rescan_timer; + +#ifdef HAVE_FAM + TQSocketNotifier *sn; + FAMConnection fc; + bool use_fam; + + void checkFAMEvent(FAMEvent*); + bool useFAM(Entry*); +#endif + +#if defined(HAVE_DNOTIFY) || defined(HAVE_INOTIFY) + TQSocketNotifier *mSn; +#endif + +#ifdef HAVE_DNOTIFY + bool supports_dnotify; + int mPipe[2]; + TQIntDict fd_Entry; + + static void dnotify_handler(int, siginfo_t *si, void *); + static void dnotify_sigio_handler(int, siginfo_t *si, void *); + bool useDNotify(Entry*); +#endif + +#ifdef HAVE_INOTIFY + bool supports_inotify; + int m_inotify_fd; + + bool useINotify(Entry*); +#endif +}; + +#endif // KDIRWATCH_P_H + -- cgit v1.2.3