summaryrefslogtreecommitdiffabout
path: root/microkde/kconfig.cpp
authorzautrix <zautrix>2004-10-09 15:58:52 (UTC)
committer zautrix <zautrix>2004-10-09 15:58:52 (UTC)
commitb80a099d9432bdc3d4eea778b1813b82b2680ecf (patch) (unidiff)
tree6327321f86070a13969b07e25b9cf84d4ad10d13 /microkde/kconfig.cpp
parented1eac5e36e675b030cb5a5aa90fb2d44eb40c73 (diff)
downloadkdepimpi-b80a099d9432bdc3d4eea778b1813b82b2680ecf.zip
kdepimpi-b80a099d9432bdc3d4eea778b1813b82b2680ecf.tar.gz
kdepimpi-b80a099d9432bdc3d4eea778b1813b82b2680ecf.tar.bz2
removed some debug output
Diffstat (limited to 'microkde/kconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kconfig.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index ba41f6c..5b685d3 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -224,98 +224,98 @@ void KConfig::writeEntry( const QString &key, const QStringList &value )
224 224
225 mDirty = true; 225 mDirty = true;
226} 226}
227 227
228void KConfig::writeEntry( const QString &key, bool value) 228void KConfig::writeEntry( const QString &key, bool value)
229{ 229{
230 mBoolMap.insert( mGroup + key, value ); 230 mBoolMap.insert( mGroup + key, value );
231 231
232 mDirty = true; 232 mDirty = true;
233} 233}
234 234
235void KConfig::writeEntry( const QString & e, const QColor & c ) 235void KConfig::writeEntry( const QString & e, const QColor & c )
236{ 236{
237 QStringList l; 237 QStringList l;
238 l.append( QString::number ( c.red() ) ); 238 l.append( QString::number ( c.red() ) );
239 l.append( QString::number ( c.green() ) ); 239 l.append( QString::number ( c.green() ) );
240 l.append( QString::number ( c.blue() ) ); 240 l.append( QString::number ( c.blue() ) );
241 writeEntry( e, l ); 241 writeEntry( e, l );
242} 242}
243 243
244void KConfig::writeEntry( const QString & e, const QSize & s ) 244void KConfig::writeEntry( const QString & e, const QSize & s )
245{ 245{
246 QValueList<int> intlist; 246 QValueList<int> intlist;
247 intlist << s.width() << s.height(); 247 intlist << s.width() << s.height();
248 writeEntry( e, intlist ); 248 writeEntry( e, intlist );
249} 249}
250 250
251void KConfig::writeEntry( const QString & e , const QFont & f ) 251void KConfig::writeEntry( const QString & e , const QFont & f )
252{ 252{
253 QStringList font; 253 QStringList font;
254 font.append( f.family()); 254 font.append( f.family());
255 font.append( (!f.bold ()?"nonbold":"bold") ); 255 font.append( (!f.bold ()?"nonbold":"bold") );
256 font.append( QString::number ( f.pointSize () ) ); 256 font.append( QString::number ( f.pointSize () ) );
257 font.append( !f.italic ()?"nonitalic":"italic" ); 257 font.append( !f.italic ()?"nonitalic":"italic" );
258 writeEntry( e, font ); 258 writeEntry( e, font );
259} 259}
260 260
261void KConfig::writeEntry( const QString &key, const QDateTime &dt ) 261void KConfig::writeEntry( const QString &key, const QDateTime &dt )
262{ 262{
263 mDateTimeMap.insert( mGroup + key, dt ); 263 mDateTimeMap.insert( mGroup + key, dt );
264} 264}
265 265
266void KConfig::load() 266void KConfig::load()
267{ 267{
268 268
269 269
270 QFile f( mFileName ); 270 QFile f( mFileName );
271 if ( !f.open( IO_ReadOnly ) ) { 271 if ( !f.open( IO_ReadOnly ) ) {
272 qDebug("KConfig: could not open file %s ",mFileName.latin1() ); 272 //qDebug("KConfig: could not open file %s ",mFileName.latin1() );
273 return; 273 return;
274 } 274 }
275 275
276 mBoolMap.clear(); 276 mBoolMap.clear();
277 mStringMap.clear(); 277 mStringMap.clear();
278 278
279 QTextStream t( &f ); 279 QTextStream t( &f );
280 280
281 QString line = t.readLine(); 281 QString line = t.readLine();
282 282
283 while ( !line.isNull() ) { 283 while ( !line.isNull() ) {
284 QStringList tokens = QStringList::split( ",", line ); 284 QStringList tokens = QStringList::split( ",", line );
285 if ( tokens[0] == "bool" ) { 285 if ( tokens[0] == "bool" ) {
286 bool value = false; 286 bool value = false;
287 if ( tokens[2] == "1" ) value = true; 287 if ( tokens[2] == "1" ) value = true;
288 mBoolMap.insert( tokens[1], value ); 288 mBoolMap.insert( tokens[1], value );
289 } else if ( tokens[0] == "QString" ) { 289 } else if ( tokens[0] == "QString" ) {
290 QString value = tokens[2]; 290 QString value = tokens[2];
291 mStringMap.insert( tokens[1], value ); 291 mStringMap.insert( tokens[1], value );
292 } else if ( tokens[0] == "QDateTime" ) { 292 } else if ( tokens[0] == "QDateTime" ) {
293#if 0 293#if 0
294 int year = tokens[2].toInt(); 294 int year = tokens[2].toInt();
295 QDateTime dt( QDate( year, 295 QDateTime dt( QDate( year,
296 tokens[3].toInt(), 296 tokens[3].toInt(),
297 tokens[4].toInt() ), 297 tokens[4].toInt() ),
298 QTime( tokens[5].toInt(), tokens[6].toInt(), 298 QTime( tokens[5].toInt(), tokens[6].toInt(),
299 tokens[7].toInt() ) ); 299 tokens[7].toInt() ) );
300 mDateTimeMap.insert( tokens[1], dt ); 300 mDateTimeMap.insert( tokens[1], dt );
301#endif 301#endif
302 } 302 }
303 303
304 line = t.readLine(); 304 line = t.readLine();
305 } 305 }
306} 306}
307 307
308void KConfig::sync() 308void KConfig::sync()
309{ 309{
310 310
311 if ( !mDirty ) return; 311 if ( !mDirty ) return;
312 //qDebug("KConfig::sync() %s ",mFileName.latin1() ); 312 //qDebug("KConfig::sync() %s ",mFileName.latin1() );
313 //kdDebug() << "KConfig::sync(): " << mFileName << endl; 313 //kdDebug() << "KConfig::sync(): " << mFileName << endl;
314 314
315//US I took the following code from a newer version of KDE 315//US I took the following code from a newer version of KDE
316 // Create the containing dir if needed 316 // Create the containing dir if needed
317 KURL path; 317 KURL path;
318 path.setPath(mFileName); 318 path.setPath(mFileName);
319 QString dir=path.directory(); 319 QString dir=path.directory();
320 KStandardDirs::makeDir(dir); 320 KStandardDirs::makeDir(dir);
321 321