author | mickeyl <mickeyl> | 2005-05-31 14:34:22 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-31 14:34:22 (UTC) |
commit | 89417179ed4d38875dc3edce0f4e184edf13f1f2 (patch) (side-by-side diff) | |
tree | 1924e9cf0a053519142554659ca4dd7632938735 | |
parent | 6d2273fb22e10474ae26dd249fa2836e100ffdaf (diff) | |
download | opie-89417179ed4d38875dc3edce0f4e184edf13f1f2.zip opie-89417179ed4d38875dc3edce0f4e184edf13f1f2.tar.gz opie-89417179ed4d38875dc3edce0f4e184edf13f1f2.tar.bz2 |
catch up with libopie2 improvements
-rw-r--r-- | examples/opiecore/onotifytest/main.cpp | 33 | ||||
-rw-r--r-- | examples/opiecore/onotifytest/main.h | 23 | ||||
-rw-r--r-- | examples/opiecore/onotifytest/onotifytest.pro | 1 | ||||
-rw-r--r-- | examples/opiecore/opcmciademo/main.cpp | 2 |
4 files changed, 46 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,56 +1,63 @@ // (C) Michael 'Mickey' Lauer <mickey@Vanille.de> // LICENSE = "GPLv2" +#include "main.h" + /* OPIE */ #include <opie2/odebug.h> #include <opie2/oapplication.h> #include <opie2/ofilenotify.h> 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" ); if ( tmpfoo->open( IO_ReadWrite ) ) { QTextStream stream( tmpfoo ); stream << "This is my content"; } QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) ); 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 ) ); +} int main( int argc, char** argv ) { App* app = new App( argc, 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 ); b->move( 150, 150 ); b->show(); app->setMainWidget( b ); app->exec(); delete app; return 0; diff --git a/examples/opiecore/onotifytest/main.h b/examples/opiecore/onotifytest/main.h new file mode 100644 index 0000000..afad947 --- a/dev/null +++ b/examples/opiecore/onotifytest/main.h @@ -0,0 +1,23 @@ +// (C) Michael 'Mickey' Lauer <mickey@Vanille.de> +// LICENSE = "GPLv2" + +#ifndef MAIN_H +#define MAIN_H + +/* QT */ +#include <qapplication.h> +#include <qpushbutton.h> +#include <qtextstream.h> + +class App : public QApplication +{ + Q_OBJECT +public: + App( int argc, char** argv ); + ~App(); + +public slots: + void triggered( const QString&, unsigned int, const QString& ); +}; + +#endif diff --git a/examples/opiecore/onotifytest/onotifytest.pro b/examples/opiecore/onotifytest/onotifytest.pro index 4e0faec..51bda92 100644 --- a/examples/opiecore/onotifytest/onotifytest.pro +++ b/examples/opiecore/onotifytest/onotifytest.pro @@ -1,10 +1,11 @@ TEMPLATE = app CONFIG = qt warn_on +HEADERS = main.h SOURCES = main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lopiecore2 TARGET = onotifytest !contains( platform, x11 ) { include( $(OPIEDIR)/include.pro ) diff --git a/examples/opiecore/opcmciademo/main.cpp b/examples/opiecore/opcmciademo/main.cpp index 3ee22c2..dfc4287 100644 --- a/examples/opiecore/opcmciademo/main.cpp +++ b/examples/opiecore/opcmciademo/main.cpp @@ -10,15 +10,17 @@ int main( int argc, char** argv ) odebug << "number of detected sockets is = " << sys->count() << oendl; odebug << "number of populated sockets is = " << sys->cardCount() << oendl; OPcmciaSystem::CardIterator it = sys->iterator(); OPcmciaSocket* sock = 0; while ( sock = it.current() ) { odebug << "card in socket # " << sock->number() << " is '" << sock->identity() << "'" << oendl; + odebug << "card status is " << sock->status() << oendl; + odebug << "card function is " << sock->function() << oendl; ++it; } odebug << "end" << oendl; return 0; } |