Diffstat (limited to 'examples/opiecore/onotifytest/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | examples/opiecore/onotifytest/main.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/examples/opiecore/onotifytest/main.cpp b/examples/opiecore/onotifytest/main.cpp index 467ebc9..8374c59 100644 --- a/examples/opiecore/onotifytest/main.cpp +++ b/examples/opiecore/onotifytest/main.cpp | |||
@@ -1,6 +1,8 @@ | |||
1 | // (C) Michael 'Mickey' Lauer <mickey@Vanille.de> | 1 | // (C) Michael 'Mickey' Lauer <mickey@Vanille.de> |
2 | // LICENSE = "GPLv2" | 2 | // LICENSE = "GPLv2" |
3 | 3 | ||
4 | #include "main.h" | ||
5 | |||
4 | /* OPIE */ | 6 | /* OPIE */ |
5 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
6 | #include <opie2/oapplication.h> | 8 | #include <opie2/oapplication.h> |
@@ -8,19 +10,16 @@ | |||
8 | using namespace Opie::Core; | 10 | using namespace Opie::Core; |
9 | 11 | ||
10 | /* QT */ | 12 | /* QT */ |
13 | #include <qdir.h> | ||
11 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #include <qstringlist.h> | ||
12 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #include <qmessagebox.h> | ||
13 | 18 | ||
14 | class App : public OApplication | 19 | App::App( int argc, char** argv ) : QApplication( argc, argv ) |
15 | { | ||
16 | |||
17 | public: | ||
18 | OFile* tmpfoo; | ||
19 | |||
20 | App( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify test" ) | ||
21 | { | 20 | { |
22 | odebug << "App()" << oendl; | 21 | odebug << "App()" << oendl; |
23 | 22 | #if 0 | |
24 | tmpfoo = new OFile( "/tmp/foo" ); | 23 | tmpfoo = new OFile( "/tmp/foo" ); |
25 | if ( tmpfoo->open( IO_ReadWrite ) ) | 24 | if ( tmpfoo->open( IO_ReadWrite ) ) |
26 | { | 25 | { |
@@ -30,22 +29,30 @@ App( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify test" | |||
30 | 29 | ||
31 | QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) ); | 30 | QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) ); |
32 | QObject::connect( tmpfoo, SIGNAL(closed(const QString&,bool)), this, SLOT(quit()) ); | 31 | QObject::connect( tmpfoo, SIGNAL(closed(const QString&,bool)), this, SLOT(quit()) ); |
32 | #endif | ||
33 | |||
34 | ODirNotification* tmpfoo = new ODirNotification( 0, 0 ); | ||
35 | |||
36 | int result = tmpfoo->watch( "/tmp/foo", false, CreateFile, 1 ); | ||
37 | QObject::connect( tmpfoo, SIGNAL(triggered(const QString&,unsigned int,const QString&)), | ||
38 | this, SLOT(triggered(const QString&,unsigned int,const QString&)) ); | ||
33 | } | 39 | } |
34 | 40 | ||
35 | ~App() | 41 | App::~App() |
36 | { | 42 | { |
37 | odebug << "~App()" << oendl; | 43 | odebug << "~App()" << oendl; |
38 | |||
39 | delete tmpfoo; | ||
40 | } | 44 | } |
41 | 45 | ||
42 | }; | 46 | void App::triggered( const QString& str1, unsigned int id, const QString& str2 ) |
47 | { | ||
48 | QMessageBox::information( qApp->desktop(), "info", QString( "%1\n%2\n%3" ).arg( str1 ).arg( id ).arg( str2 ) ); | ||
49 | } | ||
43 | 50 | ||
44 | int main( int argc, char** argv ) | 51 | int main( int argc, char** argv ) |
45 | { | 52 | { |
46 | App* app = new App( argc, argv ); | 53 | App* app = new App( argc, argv ); |
47 | QPushButton* b = new QPushButton( "Click me to close", 0 ); | 54 | QPushButton* b = new QPushButton( "Click me to close", 0 ); |
48 | QObject::connect( b, SIGNAL(clicked()), app, SLOT(quit()) ); | 55 | QObject::connect( b, SIGNAL(clicked()), qApp, SLOT(quit()) ); |
49 | b->resize( 200, 200 ); | 56 | b->resize( 200, 200 ); |
50 | b->move( 150, 150 ); | 57 | b->move( 150, 150 ); |
51 | b->show(); | 58 | b->show(); |