Diffstat (limited to 'libopie2/opiecore/ofilenotify.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/ofilenotify.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/libopie2/opiecore/ofilenotify.h b/libopie2/opiecore/ofilenotify.h index 638eb6c..a14842a 100644 --- a/libopie2/opiecore/ofilenotify.h +++ b/libopie2/opiecore/ofilenotify.h | |||
@@ -29,10 +29,11 @@ _;:, .> :=|. This program is free software; you can | |||
29 | #ifndef OFILENOTIFY_H | 29 | #ifndef OFILENOTIFY_H |
30 | #define OFILENOTIFY_H | 30 | #define OFILENOTIFY_H |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qstring.h> | ||
34 | #include <qobject.h> | 33 | #include <qobject.h> |
34 | #include <qsignal.h> | ||
35 | #include <qstring.h> | ||
35 | 36 | ||
36 | /* STD */ | 37 | /* STD */ |
37 | #include <signal.h> | 38 | #include <signal.h> |
38 | #include <fcntl.h> | 39 | #include <fcntl.h> |
@@ -48,22 +49,41 @@ enum OFileNotificationType { Single = 0x0000000, | |||
48 | Delete = DN_DELETE, | 49 | Delete = DN_DELETE, |
49 | Rename = DN_RENAME, | 50 | Rename = DN_RENAME, |
50 | Attrib = DN_ATTRIB }; | 51 | Attrib = DN_ATTRIB }; |
51 | 52 | ||
52 | class OFileNotifier : public QObject | 53 | class OFileNotification : public QObject |
53 | { | 54 | { |
55 | Q_OBJECT | ||
56 | |||
54 | public: | 57 | public: |
55 | static void singleShot( const QString& path, | 58 | OFileNotification( QObject* parent = 0, const char* name = 0 ); |
56 | QObject *receiver, const char *member, | 59 | ~OFileNotification(); |
57 | OFileNotificationType type = Modify ); | 60 | |
61 | static void singleShot( const QString& path, QObject* receiver, const char* member, OFileNotificationType type = Modify ); | ||
62 | |||
63 | int start( const QString& path, bool sshot = false, OFileNotificationType type = Modify ); | ||
64 | void stop(); | ||
65 | |||
66 | OFileNotificationType type() const; | ||
67 | QString path() const; | ||
68 | int fileno() const; | ||
69 | bool isActive() const; | ||
70 | |||
71 | signals: | ||
72 | void triggered(); | ||
73 | |||
58 | protected: | 74 | protected: |
59 | static void registerSignalHandler(); | 75 | void activate(); |
76 | static bool registerSignalHandler(); | ||
60 | static void unregisterSignalHandler(); | 77 | static void unregisterSignalHandler(); |
61 | static void __signalHandler( int sig, siginfo_t *si, void *data ); | 78 | static void __signalHandler( int sig, siginfo_t *si, void *data ); |
62 | 79 | ||
63 | private: | 80 | private: |
64 | OFileNotifier(); | 81 | QString _path; |
65 | ~OFileNotifier(); | 82 | OFileNotificationType _type; |
83 | QSignal _signal; | ||
84 | int _fd; | ||
85 | bool _active; | ||
66 | }; | 86 | }; |
67 | 87 | ||
68 | } | 88 | } |
69 | } | 89 | } |