author | mickeyl <mickeyl> | 2005-05-06 19:47:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-06 19:47:16 (UTC) |
commit | 8b1a64ffe497f5395544c6702225003aca293f80 (patch) (unidiff) | |
tree | 98d8aa7db946ae0bc9f96f51fd040627a125dceb /libopie2/opiecore/ofilenotify.h | |
parent | e73cc9ec4596e1b5e9eed13af710606f358860ba (diff) | |
download | opie-8b1a64ffe497f5395544c6702225003aca293f80.zip opie-8b1a64ffe497f5395544c6702225003aca293f80.tar.gz opie-8b1a64ffe497f5395544c6702225003aca293f80.tar.bz2 |
fix a couple of issues with OFileNotification, seems to work with single and multiple file notifications now
add a named trigger
Diffstat (limited to 'libopie2/opiecore/ofilenotify.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/ofilenotify.h | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/libopie2/opiecore/ofilenotify.h b/libopie2/opiecore/ofilenotify.h index ea525e9..41ba84d 100644 --- a/libopie2/opiecore/ofilenotify.h +++ b/libopie2/opiecore/ofilenotify.h | |||
@@ -98,7 +98,7 @@ enum OFileNotificationType | |||
98 | * @brief Represents a file notification | 98 | * @brief Represents a file notification |
99 | * | 99 | * |
100 | * This class allows to watch for events happening to files. | 100 | * This class allows to watch for events happening to files. |
101 | * It uses the inotify kernel interface | 101 | * It uses the inotify linux (2.6.x) kernel interface. |
102 | * | 102 | * |
103 | * @see http://www.kernel.org/pub/linux/kernel/people/rml/inotify/ | 103 | * @see http://www.kernel.org/pub/linux/kernel/people/rml/inotify/ |
104 | * | 104 | * |
@@ -140,7 +140,7 @@ class OFileNotification : public QObject | |||
140 | * | 140 | * |
141 | * The @a receiver is the receiving object and the @a member is the slot. | 141 | * The @a receiver is the receiving object and the @a member is the slot. |
142 | **/ | 142 | **/ |
143 | static void singleShot( const QString& path, QObject* receiver, const char* member, OFileNotificationType type = Modify ); | 143 | static bool singleShot( const QString& path, QObject* receiver, const char* member, OFileNotificationType type = Modify ); |
144 | /** | 144 | /** |
145 | * Starts to watch for @a type changes to @a path. Set @a sshot to True if you want to be notified only once. | 145 | * Starts to watch for @a type changes to @a path. Set @a sshot to True if you want to be notified only once. |
146 | * Note that in that case it may be more convenient to use @ref OFileNotification::singleShot() then. | 146 | * Note that in that case it may be more convenient to use @ref OFileNotification::singleShot() then. |
@@ -162,12 +162,16 @@ class OFileNotification : public QObject | |||
162 | * @returns if a file is currently being watched. | 162 | * @returns if a file is currently being watched. |
163 | **/ | 163 | **/ |
164 | bool isActive() const; | 164 | bool isActive() const; |
165 | /** | ||
166 | * @internal | ||
167 | */ | ||
168 | int startWatching( const QString& path, bool sshot = false, OFileNotificationType type = Modify ); | ||
165 | 169 | ||
166 | signals: | 170 | signals: |
167 | /** | 171 | /** |
168 | * This signal is emitted if an event happens of the specified type happens to the file being watched. | 172 | * This signal is emitted if an event happens of the specified type happens to the file being watched. |
169 | **/ | 173 | **/ |
170 | void triggered(); | 174 | void triggered( const QString& name ); |
171 | 175 | ||
172 | protected: | 176 | protected: |
173 | bool activate(); | 177 | bool activate(); |
@@ -189,6 +193,38 @@ class OFileNotification : public QObject | |||
189 | static int _fd; // inotify device descriptor | 193 | static int _fd; // inotify device descriptor |
190 | }; | 194 | }; |
191 | 195 | ||
196 | /*====================================================================================== | ||
197 | * ODirNotification | ||
198 | *======================================================================================*/ | ||
199 | |||
200 | /** | ||
201 | * @brief Represents a directory notification | ||
202 | * | ||
203 | * This class allows to watch for events happening to directories | ||
204 | * It uses the OFileNotification class | ||
205 | * | ||
206 | * @see http://www.kernel.org/pub/linux/kernel/people/rml/inotify/ | ||
207 | * | ||
208 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | ||
209 | * | ||
210 | **/ | ||
211 | |||
212 | class ODirNotification : public QObject | ||
213 | { | ||
214 | Q_OBJECT | ||
215 | |||
216 | public: | ||
217 | ODirNotification( QObject* parent = 0, const char* name = 0 ); | ||
218 | ~ODirNotification(); | ||
219 | /** | ||
220 | * Starts to watch for @a type changes to @a path. Recurse @a recurse levels down the filesystem tree, | ||
221 | * use 0 for no recursion and -1 for unlimited recursion. | ||
222 | * Set @a sshot to True if you want to be notified only once. | ||
223 | **/ | ||
224 | int watch( const QString& path, bool sshot = false, OFileNotificationType type = Modify, int recurse = 0 ); | ||
225 | }; | ||
226 | |||
227 | |||
192 | } | 228 | } |
193 | } | 229 | } |
194 | 230 | ||