summaryrefslogtreecommitdiff
path: root/examples/opiecore/oconfigdemo
Unidiff
Diffstat (limited to 'examples/opiecore/oconfigdemo') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opiecore/oconfigdemo/.cvsignore8
-rw-r--r--examples/opiecore/oconfigdemo/oconfigdemo.cpp32
-rw-r--r--examples/opiecore/oconfigdemo/oconfigdemo.pro18
3 files changed, 58 insertions, 0 deletions
diff --git a/examples/opiecore/oconfigdemo/.cvsignore b/examples/opiecore/oconfigdemo/.cvsignore
new file mode 100644
index 0000000..db3635b
--- a/dev/null
+++ b/examples/opiecore/oconfigdemo/.cvsignore
@@ -0,0 +1,8 @@
1oconfigdemo
2Makefile*
3obj
4moc*
5*moc
6*.o
7~*
8
diff --git a/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/examples/opiecore/oconfigdemo/oconfigdemo.cpp
new file mode 100644
index 0000000..2ee4a65
--- a/dev/null
+++ b/examples/opiecore/oconfigdemo/oconfigdemo.cpp
@@ -0,0 +1,32 @@
1#include <opie2/oapplication.h>
2#include <opie2/oconfig.h>
3#include <qpe/config.h>
4
5using namespace Opie::Core;
6
7int main( int argc, char** argv )
8{
9 OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" );
10
11 OConfigGroupSaver c1( app->config(), "MyGroup" );
12 app->config()->writeEntry( "AnEntry", "InMyGroup" );
13 {
14 OConfigGroupSaver c2( c1.config(), "AnotherGroup" );
15 app->config()->writeEntry( "AnEntry", "InAnotherGroup" );
16 } // closing the scope returns to the last group
17
18 app->config()->writeEntry( "AnotherEntry", "InMyGroup" );
19
20 // do more stuff ...
21
22 // in this (special) case it is necessary to manually call OConfig::write() (see below)
23 app->config()->write();
24
25 // can't delete the app when using the OConfigGroupSaver on top level scope,
26 // because the destructor of the OConfigGroupSaver needs an application object
27 //delete app; // destructor deletes config which writes changes back to disk
28
29 return 0;
30
31}
32
diff --git a/examples/opiecore/oconfigdemo/oconfigdemo.pro b/examples/opiecore/oconfigdemo/oconfigdemo.pro
new file mode 100644
index 0000000..b29c106
--- a/dev/null
+++ b/examples/opiecore/oconfigdemo/oconfigdemo.pro
@@ -0,0 +1,18 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = oconfigdemo.cpp
5
6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lopiecore2
9TARGET = oconfigdemo
10
11!contains( platform, x11 ) {
12 include( $(OPIEDIR)/include.pro )
13}
14
15contains( platform, x11 ) {
16 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
17}
18