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 @@ -3,2 +3,4 @@ +#include "main.h" + /* OPIE */ @@ -10,15 +12,12 @@ using namespace Opie::Core; /* QT */ +#include <qdir.h> #include <qpushbutton.h> +#include <qstringlist.h> #include <qtextstream.h> +#include <qmessagebox.h> -class App : public OApplication -{ - -public: -OFile* tmpfoo; - -App( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify test" ) +App::App( int argc, char** argv ) : QApplication( argc, argv ) { odebug << "App()" << oendl; - +#if 0 tmpfoo = new OFile( "/tmp/foo" ); @@ -32,12 +31,20 @@ App( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify test" QObject::connect( tmpfoo, SIGNAL(closed(const QString&,bool)), this, SLOT(quit()) ); +#endif + + ODirNotification* tmpfoo = new ODirNotification( 0, 0 ); + + int result = tmpfoo->watch( "/tmp/foo", false, CreateFile, 1 ); + QObject::connect( tmpfoo, SIGNAL(triggered(const QString&,unsigned int,const QString&)), + this, SLOT(triggered(const QString&,unsigned int,const QString&)) ); } -~App() +App::~App() { odebug << "~App()" << oendl; - - delete tmpfoo; } -}; +void App::triggered( const QString& str1, unsigned int id, const QString& str2 ) +{ + QMessageBox::information( qApp->desktop(), "info", QString( "%1\n%2\n%3" ).arg( str1 ).arg( id ).arg( str2 ) ); +} @@ -47,3 +54,3 @@ int main( int argc, char** argv ) QPushButton* b = new QPushButton( "Click me to close", 0 ); - QObject::connect( b, SIGNAL(clicked()), app, SLOT(quit()) ); + QObject::connect( b, SIGNAL(clicked()), qApp, SLOT(quit()) ); b->resize( 200, 200 ); |