summaryrefslogtreecommitdiff
path: root/examples
authormickeyl <mickeyl>2005-05-10 13:30:51 (UTC)
committer mickeyl <mickeyl>2005-05-10 13:30:51 (UTC)
commite31f22952f47aeb54b206349f1e469704a6a6e8f (patch) (unidiff)
tree2aa06bf1ebd9850b1e987d1dcc94794699a0c9fe /examples
parent9bcf6a5112d31ffdc196ebcd22a584c68f9f7b1e (diff)
downloadopie-e31f22952f47aeb54b206349f1e469704a6a6e8f.zip
opie-e31f22952f47aeb54b206349f1e469704a6a6e8f.tar.gz
opie-e31f22952f47aeb54b206349f1e469704a6a6e8f.tar.bz2
add foundation for a much more intuitive API for file notifications
Diffstat (limited to 'examples') (more/less context) (show whitespace changes)
-rw-r--r--examples/opiecore/onotifytest/.cvsignore6
-rw-r--r--examples/opiecore/onotifytest/main.cpp59
-rw-r--r--examples/opiecore/onotifytest/onotifytest.pro16
-rw-r--r--examples/opiecore/opiecore.pro2
4 files changed, 82 insertions, 1 deletions
diff --git a/examples/opiecore/onotifytest/.cvsignore b/examples/opiecore/onotifytest/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/examples/opiecore/onotifytest/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/examples/opiecore/onotifytest/main.cpp b/examples/opiecore/onotifytest/main.cpp
new file mode 100644
index 0000000..467ebc9
--- a/dev/null
+++ b/examples/opiecore/onotifytest/main.cpp
@@ -0,0 +1,59 @@
1// (C) Michael 'Mickey' Lauer <mickey@Vanille.de>
2// LICENSE = "GPLv2"
3
4/* OPIE */
5#include <opie2/odebug.h>
6#include <opie2/oapplication.h>
7#include <opie2/ofilenotify.h>
8using namespace Opie::Core;
9
10/* QT */
11#include <qpushbutton.h>
12#include <qtextstream.h>
13
14class App : public OApplication
15{
16
17public:
18OFile* tmpfoo;
19
20App( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify test" )
21{
22 odebug << "App()" << oendl;
23
24 tmpfoo = new OFile( "/tmp/foo" );
25 if ( tmpfoo->open( IO_ReadWrite ) )
26 {
27 QTextStream stream( tmpfoo );
28 stream << "This is my content";
29 }
30
31 QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) );
32 QObject::connect( tmpfoo, SIGNAL(closed(const QString&,bool)), this, SLOT(quit()) );
33}
34
35~App()
36{
37 odebug << "~App()" << oendl;
38
39 delete tmpfoo;
40}
41
42};
43
44int main( int argc, char** argv )
45{
46 App* app = new App( argc, argv );
47 QPushButton* b = new QPushButton( "Click me to close", 0 );
48 QObject::connect( b, SIGNAL(clicked()), app, SLOT(quit()) );
49 b->resize( 200, 200 );
50 b->move( 150, 150 );
51 b->show();
52 app->setMainWidget( b );
53 app->exec();
54 delete app;
55
56 return 0;
57
58}
59
diff --git a/examples/opiecore/onotifytest/onotifytest.pro b/examples/opiecore/onotifytest/onotifytest.pro
new file mode 100644
index 0000000..4e0faec
--- a/dev/null
+++ b/examples/opiecore/onotifytest/onotifytest.pro
@@ -0,0 +1,16 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3SOURCES = main.cpp
4INCLUDEPATH += $(OPIEDIR)/include
5DEPENDPATH += $(OPIEDIR)/include
6LIBS += -lopiecore2
7TARGET = onotifytest
8
9!contains( platform, x11 ) {
10 include( $(OPIEDIR)/include.pro )
11}
12
13contains( platform, x11 ) {
14 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
15}
16
diff --git a/examples/opiecore/opiecore.pro b/examples/opiecore/opiecore.pro
index 1f86a40..3550055 100644
--- a/examples/opiecore/opiecore.pro
+++ b/examples/opiecore/opiecore.pro
@@ -1,2 +1,2 @@
1TEMPLATE = subdirs 1TEMPLATE = subdirs
2unix:SUBDIRS = odebugdemo oconfigdemo oglobalsettingsdemo onotifydemo oprocessdemo oplugins oinputsystemdemo 2unix:SUBDIRS = odebugdemo oconfigdemo oglobalsettingsdemo onotifydemo onotifytest oprocessdemo oplugins oinputsystemdemo