Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

oconfigdemo.cpp

Go to the documentation of this file.
00001 #include <opie2/oapplication.h>
00002 #include <opie2/oconfig.h>
00003 #include <qpe/config.h>
00004 
00005 using namespace Opie::Core;
00006 
00007 int main( int argc, char** argv )
00008 {
00009     OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" );
00010 
00011     OConfigGroupSaver c1( app->config(), "MyGroup" );
00012     app->config()->writeEntry( "AnEntry", "InMyGroup" );
00013     {
00014         OConfigGroupSaver c2( c1.config(), "AnotherGroup" );
00015         app->config()->writeEntry( "AnEntry", "InAnotherGroup" );
00016     }   // closing the scope returns to the last group
00017 
00018     app->config()->writeEntry( "AnotherEntry", "InMyGroup" );
00019 
00020     // do more stuff ...
00021 
00022     // in this (special) case it is necessary to manually call OConfig::write() (see below)
00023     app->config()->write();
00024 
00025     // can't delete the app when using the OConfigGroupSaver on top level scope,
00026     // because the destructor of the OConfigGroupSaver needs an application object
00027     //delete app; // destructor deletes config which writes changes back to disk
00028 
00029     return 0;
00030 
00031 }
00032 

Generated on Sat Nov 5 16:15:59 2005 for OPIE by  doxygen 1.4.2