summaryrefslogtreecommitdiffabout
path: root/microkde/kconfig.cpp
Unidiff
Diffstat (limited to 'microkde/kconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kconfig.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 737b3f2..4cbec94 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -5,39 +5,51 @@
5#include "kdebug.h" 5#include "kdebug.h"
6 6
7#include "kurl.h" 7#include "kurl.h"
8#include "kstandarddirs.h" 8#include "kstandarddirs.h"
9#include "kconfig.h" 9#include "kconfig.h"
10 10
11QString KConfig::mGroup = ""; 11QString KConfig::mGroup = "";
12//QString KConfig::mGroup = "General"; 12//QString KConfig::mGroup = "General";
13 13
14KConfig::KConfig( const QString &fileName ) 14KConfig::KConfig( const QString &fileName )
15 : mFileName( fileName ), mDirty( false ) 15 : mFileName( fileName ), mDirty( false )
16{ 16{
17 kdDebug() << "KConfig::KConfig(): '" << fileName << "'" << endl; 17
18 18 mTempGroup = "";
19 load(); 19 load();
20 20
21} 21}
22 22
23 23
24KConfig::~KConfig() 24KConfig::~KConfig()
25{ 25{
26 sync(); 26 sync();
27} 27}
28// we need the temp group for plugins on windows
29void KConfig::setTempGroup( const QString &group )
30{
31 mTempGroup = group;
32
33 if ( mTempGroup.right( 1 ) != "/" ) mTempGroup += "/";
34}
35
36
37QString KConfig::tempGroup() const {
38 return mTempGroup;
39}
28 40
29void KConfig::setGroup( const QString &group ) 41void KConfig::setGroup( const QString &group )
30{ 42{
31 kdDebug() << "KConfig::setGroup(): '" << group << "'" << endl; 43
32 44
33 mGroup = group; 45 mGroup = group;
34 46
35 if ( mGroup.right( 1 ) != "/" ) mGroup += "/"; 47 if ( mGroup.right( 1 ) != "/" ) mGroup += "/";
36} 48}
37 49
38//US 50//US
39QString KConfig::group() const { 51QString KConfig::group() const {
40 return mGroup; 52 return mGroup;
41} 53}
42 54
43//US added method 55//US added method
@@ -60,25 +72,25 @@ QValueList<int> KConfig::readIntListEntry( const QString & key)
60 72
61 for ( QStringList::Iterator sit = valuesAsStrings.begin(); sit != valuesAsStrings.end(); ++sit ) { 73 for ( QStringList::Iterator sit = valuesAsStrings.begin(); sit != valuesAsStrings.end(); ++sit ) {
62 val = (*sit).toInt(&ok); 74 val = (*sit).toInt(&ok);
63 result << val; 75 result << val;
64 if (ok == false) { 76 if (ok == false) {
65 qDebug("KConfig::readIntListEntry str=%s , int=%n:", (*sit).latin1(), &val); 77 qDebug("KConfig::readIntListEntry str=%s , int=%n:", (*sit).latin1(), &val);
66 ok2 = false; 78 ok2 = false;
67 } 79 }
68 } 80 }
69 81
70 if (ok2 == false) 82 if (ok2 == false)
71 { 83 {
72 kdDebug() << "KConfig::readIntListEntry: error while reading one of the intvalues." << endl; 84
73 qDebug("KConfig::readIntListEntry: error while reading one of the intvalues."); 85 qDebug("KConfig::readIntListEntry: error while reading one of the intvalues.");
74 } 86 }
75 87
76 return result; 88 return result;
77} 89}
78 90
79int KConfig::readNumEntry( const QString & key, int def ) 91int KConfig::readNumEntry( const QString & key, int def )
80{ 92{
81 QString res = readEntry(key, QString::number(def ) ); 93 QString res = readEntry(key, QString::number(def ) );
82 bool ok = false; 94 bool ok = false;
83 int result = res.toInt(&ok); 95 int result = res.toInt(&ok);
84 if ( ok ) 96 if ( ok )
@@ -218,25 +230,25 @@ void KConfig::writeEntry( const QString & e , const QFont & f )
218 font.append( QString::number ( f.pointSize () ) ); 230 font.append( QString::number ( f.pointSize () ) );
219 font.append( !f.italic ()?"nonitalic":"italic" ); 231 font.append( !f.italic ()?"nonitalic":"italic" );
220 writeEntry( e, font ); 232 writeEntry( e, font );
221} 233}
222 234
223void KConfig::writeEntry( const QString &key, const QDateTime &dt ) 235void KConfig::writeEntry( const QString &key, const QDateTime &dt )
224{ 236{
225 mDateTimeMap.insert( mGroup + key, dt ); 237 mDateTimeMap.insert( mGroup + key, dt );
226} 238}
227 239
228void KConfig::load() 240void KConfig::load()
229{ 241{
230 kdDebug() << "KConfig::load(): " << mFileName << endl; 242
231 243
232 QFile f( mFileName ); 244 QFile f( mFileName );
233 if ( !f.open( IO_ReadOnly ) ) { 245 if ( !f.open( IO_ReadOnly ) ) {
234 qDebug("KConfig: could not open file %s ",mFileName.latin1() ); 246 qDebug("KConfig: could not open file %s ",mFileName.latin1() );
235 return; 247 return;
236 } 248 }
237 249
238 mBoolMap.clear(); 250 mBoolMap.clear();
239 mStringMap.clear(); 251 mStringMap.clear();
240 252
241 QTextStream t( &f ); 253 QTextStream t( &f );
242 254