author | zautrix <zautrix> | 2005-04-15 08:09:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-15 08:09:42 (UTC) |
commit | acb5803cdda97ef1369388eb15eb669e2835c06a (patch) (side-by-side diff) | |
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 @@ -240,124 +240,124 @@ void KConfig::writeEntry( const QString & e, const QColor & c ) l.append( QString::number ( c.blue() ) ); writeEntry( e.utf8(), l ); } void KConfig::writeEntry( const QString & e, const QSize & s ) { QValueList<int> intlist; intlist << s.width() << s.height(); writeEntry( e, intlist ); } void KConfig::writeEntry( const QString & e , const QFont & f ) { QStringList font; font.append( f.family()); font.append( (!f.bold ()?"nonbold":"bold") ); font.append( QString::number ( f.pointSize () ) ); font.append( !f.italic ()?"nonitalic":"italic" ); writeEntry( e, font ); } void KConfig::writeEntry( const QString &key, const QDateTime &dt ) { mDateTimeMap.insert( mGroup + key, dt ); } void KConfig::load() { QFile f( mFileName ); if ( !f.open( IO_ReadOnly ) ) { - //qDebug("KConfig: could not open file %s ",mFileName.latin1() ); + qDebug("KConfig: could not open file %s ",mFileName.latin1() ); return; } mBoolMap.clear(); mStringMap.clear(); QTextStream t( &f ); - + t.setEncoding( QTextStream::Latin1 ); QString line = t.readLine(); while ( !line.isNull() ) { QStringList tokens = QStringList::split( ",", line ); if ( tokens[0] == "bool" ) { bool value = false; if ( tokens[2] == "1" ) value = true; mBoolMap.insert( tokens[1], value ); } else if ( tokens[0] == "QString" ) { QString value = tokens[2]; mStringMap.insert( tokens[1], value ); } else if ( tokens[0] == "QDateTime" ) { #if 0 int year = tokens[2].toInt(); QDateTime dt( QDate( year, tokens[3].toInt(), tokens[4].toInt() ), QTime( tokens[5].toInt(), tokens[6].toInt(), tokens[7].toInt() ) ); mDateTimeMap.insert( tokens[1], dt ); #endif } line = t.readLine(); } } void KConfig::sync() { if ( !mDirty ) return; //qDebug("KConfig::sync() %s ",mFileName.latin1() ); //kdDebug() << "KConfig::sync(): " << mFileName << endl; //US I took the following code from a newer version of KDE // Create the containing dir if needed KURL path; path.setPath(mFileName); QString dir=path.directory(); KStandardDirs::makeDir(dir); QFile f( mFileName ); if ( !f.open( IO_WriteOnly ) ) { qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); return; } QTextStream t( &f ); - + t.setEncoding( QTextStream::Latin1 ); QMap<QString,bool>::ConstIterator itBool; for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; } QMap<QString,QString>::ConstIterator itString; for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { t << "QString," << itString.key() << "," << (*itString ) << endl; } QMap<QString,QDateTime>::ConstIterator itDateTime; for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { QDateTime dt = *itDateTime; t << "QDateTime," << itDateTime.key() << "," << dt.date().year() << "," << dt.date().month() << "," << dt.date().day() << "," << dt.time().hour() << "," << dt.time().minute() << "," << dt.time().second() << endl; } f.close(); mDirty = false; } //US I took the following deleteGroup method from a newer version from KDE. /** * Deletes a configuration entry group * |