author | zautrix <zautrix> | 2005-04-15 08:09:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-15 08:09:42 (UTC) |
commit | acb5803cdda97ef1369388eb15eb669e2835c06a (patch) (unidiff) | |
tree | 2fa7fa8e4392b7675a03209207470639c2187ca8 | |
parent | 6a16de9a18235d2ddd771c97a4bb4512b43d181a (diff) | |
download | kdepimpi-acb5803cdda97ef1369388eb15eb669e2835c06a.zip kdepimpi-acb5803cdda97ef1369388eb15eb669e2835c06a.tar.gz kdepimpi-acb5803cdda97ef1369388eb15eb669e2835c06a.tar.bz2 |
utf8 fix
-rw-r--r-- | microkde/kconfig.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp index b9cf2f1..9598274 100644 --- a/microkde/kconfig.cpp +++ b/microkde/kconfig.cpp | |||
@@ -248,57 +248,57 @@ void KConfig::writeEntry( const QString & e, const QSize & s ) | |||
248 | writeEntry( e, intlist ); | 248 | writeEntry( e, intlist ); |
249 | } | 249 | } |
250 | 250 | ||
251 | void KConfig::writeEntry( const QString & e , const QFont & f ) | 251 | void 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 | ||
261 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) | 261 | void 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 | ||
266 | void KConfig::load() | 266 | void 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 | t.setEncoding( QTextStream::Latin1 ); | |
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(); |
@@ -307,49 +307,49 @@ void KConfig::load() | |||
307 | 307 | ||
308 | void KConfig::sync() | 308 | void 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 | ||
322 | QFile f( mFileName ); | 322 | QFile f( mFileName ); |
323 | if ( !f.open( IO_WriteOnly ) ) { | 323 | if ( !f.open( IO_WriteOnly ) ) { |
324 | 324 | ||
325 | qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); | 325 | qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); |
326 | 326 | ||
327 | return; | 327 | return; |
328 | } | 328 | } |
329 | 329 | ||
330 | QTextStream t( &f ); | 330 | QTextStream t( &f ); |
331 | 331 | t.setEncoding( QTextStream::Latin1 ); | |
332 | QMap<QString,bool>::ConstIterator itBool; | 332 | QMap<QString,bool>::ConstIterator itBool; |
333 | for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { | 333 | for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { |
334 | t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; | 334 | t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; |
335 | } | 335 | } |
336 | 336 | ||
337 | QMap<QString,QString>::ConstIterator itString; | 337 | QMap<QString,QString>::ConstIterator itString; |
338 | for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { | 338 | for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { |
339 | t << "QString," << itString.key() << "," << (*itString ) << endl; | 339 | t << "QString," << itString.key() << "," << (*itString ) << endl; |
340 | } | 340 | } |
341 | 341 | ||
342 | QMap<QString,QDateTime>::ConstIterator itDateTime; | 342 | QMap<QString,QDateTime>::ConstIterator itDateTime; |
343 | for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { | 343 | for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { |
344 | QDateTime dt = *itDateTime; | 344 | QDateTime dt = *itDateTime; |
345 | t << "QDateTime," << itDateTime.key() << "," | 345 | t << "QDateTime," << itDateTime.key() << "," |
346 | << dt.date().year() << "," | 346 | << dt.date().year() << "," |
347 | << dt.date().month() << "," | 347 | << dt.date().month() << "," |
348 | << dt.date().day() << "," | 348 | << dt.date().day() << "," |
349 | << dt.time().hour() << "," | 349 | << dt.time().hour() << "," |
350 | << dt.time().minute() << "," | 350 | << dt.time().minute() << "," |
351 | << dt.time().second() << endl; | 351 | << dt.time().second() << endl; |
352 | } | 352 | } |
353 | 353 | ||
354 | f.close(); | 354 | f.close(); |
355 | 355 | ||