Diffstat (limited to 'libopie2/opiecore/ofilenotify.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/ofilenotify.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libopie2/opiecore/ofilenotify.h b/libopie2/opiecore/ofilenotify.h new file mode 100644 index 0000000..638eb6c --- a/dev/null +++ b/libopie2/opiecore/ofilenotify.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | =. Copyright (C) 2004 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
4 | .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This program is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This program is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
28 | |||
29 | #ifndef OFILENOTIFY_H | ||
30 | #define OFILENOTIFY_H | ||
31 | |||
32 | /* QT */ | ||
33 | #include <qstring.h> | ||
34 | #include <qobject.h> | ||
35 | |||
36 | /* STD */ | ||
37 | #include <signal.h> | ||
38 | #include <fcntl.h> | ||
39 | |||
40 | namespace Opie { | ||
41 | namespace Core { | ||
42 | |||
43 | enum OFileNotificationType { Single = 0x0000000, | ||
44 | Multi = DN_MULTISHOT, | ||
45 | Access = DN_ACCESS, | ||
46 | Modify = DN_MODIFY, | ||
47 | Create = DN_CREATE, | ||
48 | Delete = DN_DELETE, | ||
49 | Rename = DN_RENAME, | ||
50 | Attrib = DN_ATTRIB }; | ||
51 | |||
52 | class OFileNotifier : public QObject | ||
53 | { | ||
54 | public: | ||
55 | static void singleShot( const QString& path, | ||
56 | QObject *receiver, const char *member, | ||
57 | OFileNotificationType type = Modify ); | ||
58 | protected: | ||
59 | static void registerSignalHandler(); | ||
60 | static void unregisterSignalHandler(); | ||
61 | static void __signalHandler( int sig, siginfo_t *si, void *data ); | ||
62 | |||
63 | private: | ||
64 | OFileNotifier(); | ||
65 | ~OFileNotifier(); | ||
66 | }; | ||
67 | |||
68 | } | ||
69 | } | ||
70 | |||
71 | #endif | ||
72 | |||