summaryrefslogtreecommitdiff
path: root/examples/opiecore/onotifytest
Unidiff
Diffstat (limited to 'examples/opiecore/onotifytest') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opiecore/onotifytest/main.cpp18
-rw-r--r--examples/opiecore/onotifytest/main.h10
2 files changed, 22 insertions, 6 deletions
diff --git a/examples/opiecore/onotifytest/main.cpp b/examples/opiecore/onotifytest/main.cpp
index b773da9..7b7b0bc 100644
--- a/examples/opiecore/onotifytest/main.cpp
+++ b/examples/opiecore/onotifytest/main.cpp
@@ -32,9 +32,17 @@ App::App( int argc, char** argv ) : QApplication( argc, argv )
32#endif 32#endif
33 33
34 ODirNotification* tmpfoo = new ODirNotification( 0, 0 ); 34 tmpfoo = new ODirNotification( 0, 0 );
35 35
36 int result = tmpfoo->watch( "/tmp/foo", false, CreateFile, 2 ); 36 int result = tmpfoo->watch( "/tmp/foo", false, CreateFile, 2 );
37 QObject::connect( tmpfoo, SIGNAL(triggered(const QString&,unsigned int,const QString&)), 37
38 this, SLOT(triggered(const QString&,unsigned int,const QString&)) ); 38 if ( result != -1 )
39 {
40 QObject::connect( tmpfoo, SIGNAL(triggered(const QString&,unsigned int,const QString&)),
41 this, SLOT(triggered(const QString&,unsigned int,const QString&)) );
42 }
43 else
44 {
45 QMessageBox::warning( qApp->desktop(), "info", "Couldn't watch /tmp/foo\nDoes it exist?" );
46 }
39} 47}
40 48
@@ -42,9 +50,11 @@ App::~App()
42{ 50{
43 odebug << "~App()" << oendl; 51 odebug << "~App()" << oendl;
52 delete tmpfoo;
44} 53}
45 54
46void App::triggered( const QString& str1, unsigned int id, const QString& str2 ) 55void App::triggered( const QString& str1, unsigned int id, const QString& str2 )
47{ 56{
48 QMessageBox::information( qApp->desktop(), "info", QString( "%1\n%2\n%3" ).arg( str1 ).arg( id ).arg( str2 ) ); 57 QMessageBox::information( qApp->desktop(), "info", QString().sprintf( "%s\n0x%08x\n%s",
58 (const char*) str1, id, (const char*) str2 ) );
49} 59}
50 60
diff --git a/examples/opiecore/onotifytest/main.h b/examples/opiecore/onotifytest/main.h
index afad947..7ce4b9f 100644
--- a/examples/opiecore/onotifytest/main.h
+++ b/examples/opiecore/onotifytest/main.h
@@ -5,4 +5,7 @@
5#define MAIN_H 5#define MAIN_H
6 6
7/* OPIE */
8#include <opie2/ofilenotify.h>
9
7/* QT */ 10/* QT */
8#include <qapplication.h> 11#include <qapplication.h>
@@ -13,10 +16,13 @@ class App : public QApplication
13{ 16{
14 Q_OBJECT 17 Q_OBJECT
15public: 18 public:
16 App( int argc, char** argv ); 19 App( int argc, char** argv );
17 ~App(); 20 ~App();
18 21
19public slots: 22 public slots:
20 void triggered( const QString&, unsigned int, const QString& ); 23 void triggered( const QString&, unsigned int, const QString& );
24
25 private:
26 Opie::Core::ODirNotification* tmpfoo;
21}; 27};
22 28