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) (ignore 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 | |||
@@ -99,5 +99,5 @@ enum OFileNotificationType | |||
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/ |
@@ -141,5 +141,5 @@ class OFileNotification : public QObject | |||
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. |
@@ -163,4 +163,8 @@ class OFileNotification : public QObject | |||
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: |
@@ -168,5 +172,5 @@ class OFileNotification : public QObject | |||
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: |
@@ -190,4 +194,36 @@ class OFileNotification : public QObject | |||
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 | } |