author | mickeyl <mickeyl> | 2005-06-02 21:44:41 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-02 21:44:41 (UTC) |
commit | d0f6a0721d7ab67a115d08990143944ee71d54ba (patch) (unidiff) | |
tree | ba22ad18027419a6417f3d6439a2faf67917ab74 /examples | |
parent | f55a56f54de1d3fa9084160159a379079a317d96 (diff) | |
download | opie-d0f6a0721d7ab67a115d08990143944ee71d54ba.zip opie-d0f6a0721d7ab67a115d08990143944ee71d54ba.tar.gz opie-d0f6a0721d7ab67a115d08990143944ee71d54ba.tar.bz2 |
- move addLanguage.sh and mkipks to scripts/ directory
- finish recursive directory locks and mention in ChangeLog
beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS:
ChangeLog libopie2/opiecore/linux/ofilenotify.cpp CVS: libopie2/opiecore/linux/ofilenotify.h CVS:
examples/opiecore/onotifytest/main.cpp CVS: examples/opiecore/onotifytest/main.h CVS: Added Files: CVS:
scripts/addLanguage.sh scripts/mkipks CVS:
----------------------------------------------------------------------
-rw-r--r-- | examples/opiecore/onotifytest/main.cpp | 18 | ||||
-rw-r--r-- | examples/opiecore/onotifytest/main.h | 10 |
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 | |||
@@ -22,39 +22,49 @@ App::App( int argc, char** argv ) : QApplication( argc, argv ) | |||
22 | #if 0 | 22 | #if 0 |
23 | tmpfoo = new OFile( "/tmp/foo" ); | 23 | tmpfoo = new OFile( "/tmp/foo" ); |
24 | if ( tmpfoo->open( IO_ReadWrite ) ) | 24 | if ( tmpfoo->open( IO_ReadWrite ) ) |
25 | { | 25 | { |
26 | QTextStream stream( tmpfoo ); | 26 | QTextStream stream( tmpfoo ); |
27 | stream << "This is my content"; | 27 | stream << "This is my content"; |
28 | } | 28 | } |
29 | 29 | ||
30 | QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) ); | 30 | QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) ); |
31 | 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 | 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 | ||
41 | App::~App() | 49 | App::~App() |
42 | { | 50 | { |
43 | odebug << "~App()" << oendl; | 51 | odebug << "~App()" << oendl; |
52 | delete tmpfoo; | ||
44 | } | 53 | } |
45 | 54 | ||
46 | void App::triggered( const QString& str1, unsigned int id, const QString& str2 ) | 55 | void 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 | ||
51 | int main( int argc, char** argv ) | 61 | int main( int argc, char** argv ) |
52 | { | 62 | { |
53 | App* app = new App( argc, argv ); | 63 | App* app = new App( argc, argv ); |
54 | QPushButton* b = new QPushButton( "Click me to close", 0 ); | 64 | QPushButton* b = new QPushButton( "Click me to close", 0 ); |
55 | QObject::connect( b, SIGNAL(clicked()), qApp, SLOT(quit()) ); | 65 | QObject::connect( b, SIGNAL(clicked()), qApp, SLOT(quit()) ); |
56 | b->resize( 200, 200 ); | 66 | b->resize( 200, 200 ); |
57 | b->move( 150, 150 ); | 67 | b->move( 150, 150 ); |
58 | b->show(); | 68 | b->show(); |
59 | app->setMainWidget( b ); | 69 | app->setMainWidget( b ); |
60 | app->exec(); | 70 | app->exec(); |
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 | |||
@@ -1,23 +1,29 @@ | |||
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 | #ifndef MAIN_H | 4 | #ifndef MAIN_H |
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> |
9 | #include <qpushbutton.h> | 12 | #include <qpushbutton.h> |
10 | #include <qtextstream.h> | 13 | #include <qtextstream.h> |
11 | 14 | ||
12 | class App : public QApplication | 15 | class App : public QApplication |
13 | { | 16 | { |
14 | Q_OBJECT | 17 | Q_OBJECT |
15 | public: | 18 | public: |
16 | App( int argc, char** argv ); | 19 | App( int argc, char** argv ); |
17 | ~App(); | 20 | ~App(); |
18 | 21 | ||
19 | public 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 | ||
23 | #endif | 29 | #endif |