Diffstat (limited to 'libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp index a3f8e10..6712870 100644 --- a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp | |||
@@ -1,28 +1,30 @@ | |||
1 | #include <opie2/oapplication.h> | 1 | #include <opie2/oapplication.h> |
2 | #include <opie2/oconfig.h> | 2 | #include <opie2/oconfig.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | 4 | ||
5 | using namespace Opie::Core; | ||
6 | |||
5 | int main( int argc, char** argv ) | 7 | int main( int argc, char** argv ) |
6 | { | 8 | { |
7 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); | 9 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); |
8 | 10 | ||
9 | OConfigGroupSaver c1( app->config(), "MyGroup" ); | 11 | OConfigGroupSaver c1( app->config(), "MyGroup" ); |
10 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); | 12 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); |
11 | { | 13 | { |
12 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); | 14 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); |
13 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); | 15 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); |
14 | } // closing the scope returns to the last group | 16 | } // closing the scope returns to the last group |
15 | 17 | ||
16 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); | 18 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); |
17 | 19 | ||
18 | // do more stuff ... | 20 | // do more stuff ... |
19 | 21 | ||
20 | // in this (special) case it is necessary to manually call OConfig::write() (see below) | 22 | // in this (special) case it is necessary to manually call OConfig::write() (see below) |
21 | app->config()->write(); | 23 | app->config()->write(); |
22 | 24 | ||
23 | // can't delete the app when using the OConfigGroupSaver on top level scope, | 25 | // can't delete the app when using the OConfigGroupSaver on top level scope, |
24 | // because the destructor of the OConfigGroupSaver needs an application object | 26 | // because the destructor of the OConfigGroupSaver needs an application object |
25 | //delete app; // destructor deletes config which writes changes back to disk | 27 | //delete app; // destructor deletes config which writes changes back to disk |
26 | 28 | ||
27 | return 0; | 29 | return 0; |
28 | 30 | ||