kdf
kconftest.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <iostream>
00033
00034 #include <Qt3Support/Q3Dict>
00035 #include <kconfig.h>
00036 #include <kdebug.h>
00037 #include <kapplication.h>
00038 #include <klocale.h>
00039 #include <kcmdlineargs.h>
00040 #include <kglobal.h>
00041
00042 static const char description[] =
00043 I18N_NOOP("A test application");
00044
00045 static const char version[] = "v0.0.1";
00046
00047 main(int argc, char ** argv)
00048 {
00049 KCmdLineArgs::init(argc, argv, "test", description, version);
00050
00051 KApplication app;
00052 KSharedConfig::Ptr cfg = KGlobal::config();
00053
00054 Q3Dict<char> dict;
00055
00056 dict.insert("Blah", "Arse");
00057 dict.insert("Blah", "Smack");
00058 dict.insert("Blah", "Monkey");
00059
00060 Q3DictIterator<char> it(dict);
00061
00062 QString key = "TestConfigItem";
00063
00064 for (; it.current(); ++it) {
00065
00066 cerr << "Before saving: " << endl;
00067 cerr << "key : \"" << key << "\"" << endl;
00068 cerr << "val : \"" << it.current() << "\"" << endl;
00069
00070 debug("got back [%s]",cfg->writeEntry(key, it.current()));
00071
00072
00073 cerr << "After saving: " << endl;
00074 cerr << "key : \"" << key << "\"" << endl;
00075 cerr << "val : \"" << it.current() << "\"" << endl;
00076
00077 cerr << endl;
00078 }
00079 }