author | mickeyl <mickeyl> | 2005-01-29 14:18:51 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-29 14:18:51 (UTC) |
commit | 555b999359a5aad999eaaf48632ce85f25125b85 (patch) (side-by-side diff) | |
tree | 7414362241e49e06f49486e93a8f504113961b1c /examples/opiecore/oconfigdemo | |
parent | 7b06e36fe27adc6a4fde2004eac13aaf8c0f0f02 (diff) | |
download | opie-555b999359a5aad999eaaf48632ce85f25125b85.zip opie-555b999359a5aad999eaaf48632ce85f25125b85.tar.gz opie-555b999359a5aad999eaaf48632ce85f25125b85.tar.bz2 |
examples appear here
Diffstat (limited to 'examples/opiecore/oconfigdemo') (more/less context) (ignore whitespace changes)
-rw-r--r-- | examples/opiecore/oconfigdemo/.cvsignore | 8 | ||||
-rw-r--r-- | examples/opiecore/oconfigdemo/oconfigdemo.cpp | 32 | ||||
-rw-r--r-- | examples/opiecore/oconfigdemo/oconfigdemo.pro | 18 |
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 @@ +oconfigdemo +Makefile* +obj +moc* +*moc +*.o +~* + 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 @@ +#include <opie2/oapplication.h> +#include <opie2/oconfig.h> +#include <qpe/config.h> + +using namespace Opie::Core; + +int main( int argc, char** argv ) +{ + OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); + + OConfigGroupSaver c1( app->config(), "MyGroup" ); + app->config()->writeEntry( "AnEntry", "InMyGroup" ); + { + OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); + app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); + } // closing the scope returns to the last group + + app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); + + // do more stuff ... + + // in this (special) case it is necessary to manually call OConfig::write() (see below) + app->config()->write(); + + // can't delete the app when using the OConfigGroupSaver on top level scope, + // because the destructor of the OConfigGroupSaver needs an application object + //delete app; // destructor deletes config which writes changes back to disk + + return 0; + +} + 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 @@ +TEMPLATE = app +CONFIG = qt warn_on +HEADERS = +SOURCES = oconfigdemo.cpp + +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lopiecore2 +TARGET = oconfigdemo + +!contains( platform, x11 ) { + include( $(OPIEDIR)/include.pro ) +} + +contains( platform, x11 ) { + LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib +} + |