summaryrefslogtreecommitdiffstats
path: root/kdecore/tests/ksimpleconfigtest.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdecore/tests/ksimpleconfigtest.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/tests/ksimpleconfigtest.cpp')
-rw-r--r--kdecore/tests/ksimpleconfigtest.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/kdecore/tests/ksimpleconfigtest.cpp b/kdecore/tests/ksimpleconfigtest.cpp
new file mode 100644
index 000000000..6aa93c06d
--- /dev/null
+++ b/kdecore/tests/ksimpleconfigtest.cpp
@@ -0,0 +1,48 @@
+// $Id$
+
+//
+// configtest.cpp: libKDEcore example
+//
+// demonstrates use of KSimpleConfig class
+
+#include <ksimpleconfig.h>
+#include <kapplication.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+
+#ifndef _PATH_TMP
+#define _PATH_TMP "/tmp/"
+#endif
+
+int main( int argc, char **argv )
+{
+ KApplication a( argc, argv, "kconfigtest" );
+
+ KSimpleConfig aConfig( _PATH_TMP"/simpleconfig.cfg" );
+
+ aConfig.setGroup( "Test group" );
+ aConfig.writeEntry( "key1", "value1" );
+ aConfig.writeEntry( "key2", "value2" );
+
+ aConfig.setGroup( "Another Test group" );
+ aConfig.writeEntry( "akey1", "avalue1" );
+ aConfig.writeEntry( "akey2", "avalue2" );
+
+ fprintf( stderr, "entries written, sleeping for 10 seconds\n" );
+ aConfig.sync();
+ sleep( 10 );
+
+ aConfig.setGroup( "Test group" );
+ aConfig.deleteEntry( "key2", false );
+ fprintf( stderr, "Deleted on entry from Test group, sleeping\n" );
+ aConfig.sync();
+ sleep( 10 );
+
+ aConfig.deleteGroup( "Another Test group", true );
+ fprintf( stderr, "Deleted Another Test group\n" );
+}
+