28 #include <tqtextstream.h>
30 #include <kapplication.h>
31 #include <kglobalsettings.h>
34 #include <kcharsets.h>
36 #include "kconfigbase.h"
37 #include "kconfigbackend.h"
39 #include "kstandarddirs.h"
40 #include "kstringhandler.h"
42 class KConfigBase::KConfigBasePrivate
52 : backEnd(0L), bDirty(false), bLocaleInitialized(false),
53 bReadOnly(false), bExpand(false), d(0)
65 bLocaleInitialized =
true;
82 if ( group.isEmpty() )
95 if ( group.isEmpty() )
102 return TQString::fromUtf8(
mGroup);
112 return hasKey(key.utf8().data());
118 aEntryKey.c_key = pKey;
123 aEntryKey.bLocal =
true;
125 if (!entry.mValue.isNull())
127 aEntryKey.bLocal =
false;
132 return !entry.mValue.isNull();
135 bool KConfigBase::hasTranslatedKey(
const char* pKey)
const
138 aEntryKey.c_key = pKey;
143 aEntryKey.bLocal =
true;
145 if (!entry.mValue.isNull())
147 aEntryKey.bLocal =
false;
155 return internalHasGroup( group.utf8());
160 return internalHasGroup( TQCString(_pGroup));
165 return internalHasGroup( _pGroup);
180 return entry.bImmutable;
193 TQCString utf8_key = key.utf8();
194 entryKey.c_key = utf8_key.data();
206 const TQString& aDefault )
const
213 const TQString& aDefault )
const
215 TQCString result = readEntryUtf8(pKey);
218 return TQString::fromUtf8(result);
223 const TQString& aDefault )
const
229 const TQString& aDefault )
const
235 if (!bLocaleInitialized && KGlobal::_locale) {
248 entryKey.c_key = pKey;
252 if (!aEntryData.mValue.isNull()) {
259 if (!aEntryData.mValue.isNull()) {
260 aValue = TQString::fromUtf8(aEntryData.mValue.data());
264 aValue = emptyString;
273 if( expand || bExpand )
276 int nDollarPos = aValue.find(
'$' );
278 while( nDollarPos != -1 && (nDollarPos + 1) < static_cast<int>(aValue.length())) {
280 if( aValue[nDollarPos+1] !=
'$' ) {
281 uint nEndPos = nDollarPos+1;
284 if (aValue[nEndPos]==
'{')
286 while ( (nEndPos <= aValue.length()) && (aValue[nEndPos]!=
'}') )
289 aVarName = aValue.mid( nDollarPos+2, nEndPos-nDollarPos-3 );
293 while ( nEndPos <= aValue.length() && (aValue[nEndPos].isNumber()
294 || aValue[nEndPos].isLetter() || aValue[nEndPos]==
'_' ) )
296 aVarName = aValue.mid( nDollarPos+1, nEndPos-nDollarPos-1 );
298 const char *pEnv = 0;
299 if (!aVarName.isEmpty())
300 pEnv = getenv( aVarName.ascii() );
307 else if (aVarName.length() > 8 && aVarName.startsWith(
"XDG_") && aVarName.endsWith(
"_DIR")) {
309 if (aVarName ==
"XDG_DESKTOP_DIR") {
312 else if (aVarName ==
"XDG_DOCUMENTS_DIR") {
315 else if (aVarName ==
"XDG_DOWNLOAD_DIR") {
318 else if (aVarName ==
"XDG_MUSIC_DIR") {
321 else if (aVarName ==
"XDG_PICTURES_DIR") {
324 else if (aVarName ==
"XDG_PUBLICSHARE_DIR") {
327 else if (aVarName ==
"XDG_TEMPLATES_DIR") {
330 else if (aVarName ==
"XDG_VIDEOS_DIR") {
333 aValue.replace( nDollarPos, nEndPos-nDollarPos, result );
336 aValue.remove( nDollarPos, nEndPos-nDollarPos );
341 aValue.remove( nDollarPos, 1 );
344 nDollarPos = aValue.find(
'$', nDollarPos );
351 TQCString KConfigBase::readEntryUtf8(
const char *pKey)
const
356 entryKey.c_key = pKey;
361 return readEntry(pKey, TQString::null).utf8();
363 return aEntryData.mValue;
367 TQVariant::Type type )
const
373 TQVariant::Type type )
const
376 if ( !
hasKey( pKey ) )
return va;
382 const TQVariant &aDefault )
const
388 const TQVariant &aDefault )
const
390 if ( !
hasKey( pKey ) )
return aDefault;
392 TQVariant tmp = aDefault;
394 switch( aDefault.type() )
396 case TQVariant::Invalid:
398 case TQVariant::String:
399 return TQVariant(
readEntry( pKey, aDefault.toString() ) );
400 case TQVariant::StringList:
402 case TQVariant::List: {
404 TQStringList::ConstIterator it = strList.begin();
405 TQStringList::ConstIterator end = strList.end();
406 TQValueList<TQVariant> list;
408 for (; it != end; ++it ) {
412 return TQVariant( list );
414 case TQVariant::Font:
416 case TQVariant::Point:
418 case TQVariant::Rect:
420 case TQVariant::Size:
422 case TQVariant::Color:
425 return TQVariant(
readNumEntry( pKey, aDefault.toInt() ) );
426 case TQVariant::UInt:
428 case TQVariant::LongLong:
429 return TQVariant(
readNum64Entry( pKey, aDefault.toLongLong() ) );
430 case TQVariant::ULongLong:
432 case TQVariant::Bool:
433 return TQVariant(
readBoolEntry( pKey, aDefault.toBool() ), 0 );
434 case TQVariant::Double:
436 case TQVariant::DateTime:
438 case TQVariant::Date:
439 return TQVariant(TQT_TQDATE_OBJECT(
readDateTimeEntry( pKey, &tmp.asDateTime() ).date()));
441 case TQVariant::Pixmap:
442 case TQVariant::Image:
443 case TQVariant::Brush:
444 case TQVariant::Palette:
445 case TQVariant::ColorGroup:
447 case TQVariant::IconSet:
448 case TQVariant::CString:
449 case TQVariant::PointArray:
450 case TQVariant::Region:
451 case TQVariant::Bitmap:
452 case TQVariant::Cursor:
453 case TQVariant::SizePolicy:
454 case TQVariant::Time:
456 case TQVariant::ByteArray:
458 case TQVariant::BitArray:
459 case TQVariant::KeySequence:
462 case TQVariant::Char:
464 case TQVariant::Locale:
465 case TQVariant::RectF:
466 case TQVariant::SizeF:
467 case TQVariant::Line:
468 case TQVariant::LineF:
469 case TQVariant::PointF:
470 case TQVariant::RegExp:
471 case TQVariant::Hash:
472 case TQVariant::TextLength:
473 case QVariant::TextFormat:
474 case TQVariant::Matrix:
475 case TQVariant::Transform:
476 case TQVariant::Matrix4x4:
477 case TQVariant::Vector2D:
478 case TQVariant::Vector3D:
479 case TQVariant::Vector4D:
480 case TQVariant::Quaternion:
481 case TQVariant::UserType:
491 TQStrList &list,
char sep )
const
497 TQStrList &list,
char sep )
const
502 TQCString str_list = readEntryUtf8( pKey );
503 if (str_list.isEmpty())
507 TQCString value =
"";
508 int len = str_list.length();
510 for (
int i = 0; i < len; i++) {
511 if (str_list[i] != sep && str_list[i] !=
'\\') {
512 value += str_list[i];
515 if (str_list[i] ==
'\\') {
518 value += str_list[i];
526 list.append( value );
530 if ( str_list[len-1] != sep || ( len > 1 && str_list[len-2] ==
'\\' ) )
531 list.append( value );
548 if( str_list.isEmpty() )
550 TQString value(emptyString);
551 int len = str_list.length();
553 value.reserve( len );
554 for(
int i = 0; i < len; i++ )
556 if( str_list[i] != sep && str_list[i] !=
'\\' )
558 value += str_list[i];
561 if( str_list[i] ==
'\\' )
565 value += str_list[i];
568 TQString finalvalue( value );
569 finalvalue.squeeze();
570 list.append( finalvalue );
573 if ( str_list[len-1] != sep || ( len > 1 && str_list[len-2] ==
'\\' ) )
576 list.append( value );
598 TQValueList<int> list;
599 TQStringList::ConstIterator end(strlist.end());
600 for (TQStringList::ConstIterator it = strlist.begin(); it != end; ++it)
603 list << (*it).toInt();
615 const bool bExpandSave = bExpand;
617 TQString aValue =
readEntry( pKey, pDefault );
618 bExpand = bExpandSave;
629 const bool bExpandSave = bExpand;
632 bExpand = bExpandSave;
643 TQCString aValue = readEntryUtf8( pKey );
644 if( aValue.isNull() )
646 else if( aValue ==
"true" || aValue ==
"on" || aValue ==
"yes" )
651 int rc = aValue.toInt( &ok );
652 return( ok ? rc : nDefault );
664 TQCString aValue = readEntryUtf8( pKey );
665 if( aValue.isNull() )
670 unsigned int rc = aValue.toUInt( &ok );
671 return( ok ? rc : nDefault );
683 TQCString aValue = readEntryUtf8( pKey );
684 if( aValue.isNull() )
689 long rc = aValue.toLong( &ok );
690 return( ok ? rc : nDefault );
702 TQCString aValue = readEntryUtf8( pKey );
703 if( aValue.isNull() )
708 unsigned long rc = aValue.toULong( &ok );
709 return( ok ? rc : nDefault );
722 if( aValue.isNull() )
727 TQ_INT64 rc = aValue.toLongLong( &ok );
728 return( ok ? rc : nDefault );
742 if( aValue.isNull() )
747 TQ_UINT64 rc = aValue.toULongLong( &ok );
748 return( ok ? rc : nDefault );
759 TQCString aValue = readEntryUtf8( pKey );
760 if( aValue.isNull() )
765 double rc = aValue.toDouble( &ok );
766 return( ok ? rc : nDefault );
778 TQCString aValue = readEntryUtf8( pKey );
780 if( aValue.isNull() )
784 if( aValue ==
"true" || aValue ==
"on" || aValue ==
"yes" || aValue ==
"1" )
789 int val = aValue.toInt( &bOK );
790 if( bOK && val != 0 )
808 if( !aValue.isNull() ) {
809 if ( aValue.contains(
',' ) > 5 ) {
811 if ( !aRetFont.fromString( aValue ) && pDefault )
812 aRetFont = *pDefault;
818 int nIndex = aValue.find(
',' );
821 aRetFont = *pDefault;
824 aRetFont.setFamily( aValue.left( nIndex ) );
827 int nOldIndex = nIndex;
828 nIndex = aValue.find(
',', nOldIndex+1 );
831 aRetFont = *pDefault;
835 aRetFont.setPointSize( aValue.mid( nOldIndex+1,
836 nIndex-nOldIndex-1 ).toInt() );
840 nIndex = aValue.find(
',', nOldIndex+1 );
844 aRetFont = *pDefault;
848 aRetFont.setStyleHint( (TQFont::StyleHint)aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() );
852 nIndex = aValue.find(
',', nOldIndex+1 );
856 aRetFont = *pDefault;
860 TQString chStr=aValue.mid( nOldIndex+1,
861 nIndex-nOldIndex-1 );
864 nIndex = aValue.find(
',', nOldIndex+1 );
868 aRetFont = *pDefault;
872 aRetFont.setWeight( aValue.mid( nOldIndex+1,
873 nIndex-nOldIndex-1 ).toUInt() );
876 uint nFontBits = aValue.right( aValue.length()-nIndex-1 ).toUInt();
878 aRetFont.setItalic( nFontBits & 0x01 );
879 aRetFont.setUnderline( nFontBits & 0x02 );
880 aRetFont.setStrikeOut( nFontBits & 0x04 );
881 aRetFont.setFixedPitch( nFontBits & 0x08 );
882 aRetFont.setRawMode( nFontBits & 0x20 );
888 aRetFont = *pDefault;
902 TQCString aValue = readEntryUtf8(pKey);
904 if (!aValue.isEmpty())
906 int left, top, width, height;
908 if (sscanf(aValue.data(),
"%d,%d,%d,%d", &left, &top, &width, &height) == 4)
910 return TQRect(left, top, width, height);
920 const TQPoint* pDefault )
const
926 const TQPoint* pDefault )
const
928 TQCString aValue = readEntryUtf8(pKey);
930 if (!aValue.isEmpty())
934 if (sscanf(aValue.data(),
"%d,%d", &x, &y) == 2)
945 const TQSize* pDefault )
const
951 const TQSize* pDefault )
const
953 TQCString aValue = readEntryUtf8(pKey);
955 if (!aValue.isEmpty())
959 if (sscanf(aValue.data(),
"%d,%d", &width, &height) == 2)
961 return TQSize(width, height);
971 const TQColor* pDefault )
const
977 const TQColor* pDefault )
const
980 int nRed = 0, nGreen = 0, nBlue = 0;
983 if( !aValue.isEmpty() )
985 if ( aValue.at(0) == (QChar)
'#' )
987 aRetColor.setNamedColor(aValue);
995 int nIndex = aValue.find(
',' );
1000 aRetColor = *pDefault;
1004 nRed = aValue.left( nIndex ).toInt( &bOK );
1007 int nOldIndex = nIndex;
1008 nIndex = aValue.find(
',', nOldIndex+1 );
1013 aRetColor = *pDefault;
1016 nGreen = aValue.mid( nOldIndex+1,
1017 nIndex-nOldIndex-1 ).toInt( &bOK );
1020 nBlue = aValue.right( aValue.length()-nIndex-1 ).toInt( &bOK );
1022 aRetColor.setRgb( nRed, nGreen, nBlue );
1028 aRetColor = *pDefault;
1036 const TQDateTime* pDefault )
const
1043 const TQDateTime* pDefault )
const
1050 return TQDateTime::currentDateTime();
1056 TQDate date( atoi( list.at( 0 ) ), atoi( list.at( 1 ) ),
1057 atoi( list.at( 2 ) ) );
1058 TQTime time( atoi( list.at( 3 ) ), atoi( list.at( 4 ) ),
1059 atoi( list.at( 5 ) ) );
1061 return TQDateTime( date, time );
1064 return TQDateTime::currentDateTime();
1072 writeEntry(pKey.utf8().data(), value, bPersistent, bGlobal, bNLS);
1080 writeEntry(pKey, value, bPersistent, bGlobal, bNLS,
false);
1101 entryKey.bLocal = bNLS;
1104 aEntryData.mValue = value.utf8();
1106 aEntryData.
bNLS = bNLS;
1110 aEntryData.
bDirty =
true;
1113 putData(entryKey, aEntryData,
true);
1117 bool bPersistent,
bool bGlobal,
1120 writePathEntry(pKey.utf8().data(), path, bPersistent, bGlobal, bNLS);
1124 static bool cleanHomeDirPath( TQString &path,
const TQString &homeDir )
1126 #ifdef Q_WS_WIN //safer
1127 if (!TQDir::convertSeparators(path).startsWith(TQDir::convertSeparators(homeDir)))
1130 if (!path.startsWith(homeDir))
1134 unsigned int len = homeDir.length();
1136 if (len && (path.length() == len || path[len] ==
'/')) {
1137 path.replace(0, len, TQString::fromLatin1(
"$HOME"));
1143 static TQString translatePath( TQString path )
1149 path.replace(
'$',
"$$");
1151 bool startsWithFile = path.startsWith(
"file:",
false);
1155 if (((!startsWithFile) && (path[0] !=
'/')) || (startsWithFile && (path[5] !=
'/'))) {
1159 if (startsWithFile) {
1164 while (path[0] ==
'/' && path[1] ==
'/') {
1172 TQString homeDir0 = TQFile::decodeName(getenv(
"HOME"));
1173 TQString homeDir1 = TQDir::homeDirPath();
1174 TQString homeDir2 = TQDir(homeDir1).canonicalPath();
1175 if (cleanHomeDirPath(path, homeDir0) ||
1176 cleanHomeDirPath(path, homeDir1) ||
1177 cleanHomeDirPath(path, homeDir2) ) {
1182 path.prepend(
"file://" );
1188 bool bPersistent,
bool bGlobal,
1191 writeEntry(pKey, translatePath(path), bPersistent, bGlobal, bNLS,
true);
1195 char sep ,
bool bPersistent,
1196 bool bGlobal,
bool bNLS )
1198 writePathEntry(pKey.utf8().data(), list, sep, bPersistent, bGlobal, bNLS);
1202 char sep ,
bool bPersistent,
1203 bool bGlobal,
bool bNLS )
1205 if( list.isEmpty() )
1207 writeEntry( pKey, TQString::fromLatin1(
""), bPersistent );
1210 TQStringList new_list;
1211 TQStringList::ConstIterator it = list.begin();
1212 for( ; it != list.end(); ++it )
1214 TQString value = *it;
1215 new_list.append( translatePath(value) );
1217 writeEntry( pKey, new_list, sep, bPersistent, bGlobal, bNLS,
true );
1245 aEntryData.
bNLS = bNLS;
1246 aEntryData.
bDirty =
true;
1250 putData(entryKey, aEntryData,
true);
1259 return aEntryMap.isEmpty();
1263 bool checkGroup =
true;
1265 KEntryMapIterator aIt;
1266 for (aIt = aEntryMap.begin(); aIt != aEntryMap.end(); ++aIt)
1268 if (!aIt.key().mKey.isEmpty() && !aIt.key().bDefault && !(*aIt).bDeleted)
1270 (*aIt).bDeleted =
true;
1271 (*aIt).bDirty =
true;
1272 (*aIt).bGlobal = bGlobal;
1274 putData(aIt.key(), *aIt, checkGroup);
1286 bool bGlobal,
bool bNLS )
1288 writeEntry(pKey.utf8().data(), prop, bPersistent, bGlobal, bNLS);
1293 bool bGlobal,
bool bNLS )
1295 switch( prop.type() )
1297 case TQVariant::Invalid:
1298 writeEntry( pKey,
"", bPersistent, bGlobal, bNLS );
1300 case TQVariant::String:
1301 writeEntry( pKey, prop.toString(), bPersistent, bGlobal, bNLS );
1303 case TQVariant::StringList:
1304 writeEntry( pKey, prop.toStringList(),
',', bPersistent, bGlobal, bNLS );
1306 case TQVariant::List: {
1307 TQValueList<TQVariant> list = prop.toList();
1308 TQValueList<TQVariant>::ConstIterator it = list.begin();
1309 TQValueList<TQVariant>::ConstIterator end = list.end();
1310 TQStringList strList;
1312 for (; it != end; ++it )
1313 strList.
append( (*it).toString() );
1315 writeEntry( pKey, strList,
',', bPersistent, bGlobal, bNLS );
1319 case TQVariant::Font:
1320 writeEntry( pKey, prop.toFont(), bPersistent, bGlobal, bNLS );
1322 case TQVariant::Point:
1323 writeEntry( pKey, prop.toPoint(), bPersistent, bGlobal, bNLS );
1325 case TQVariant::Rect:
1326 writeEntry( pKey, prop.toRect(), bPersistent, bGlobal, bNLS );
1328 case TQVariant::Size:
1329 writeEntry( pKey, prop.toSize(), bPersistent, bGlobal, bNLS );
1331 case TQVariant::Color:
1332 writeEntry( pKey, prop.toColor(), bPersistent, bGlobal, bNLS );
1334 case TQVariant::Int:
1335 writeEntry( pKey, prop.toInt(), bPersistent, bGlobal, bNLS );
1337 case TQVariant::UInt:
1338 writeEntry( pKey, prop.toUInt(), bPersistent, bGlobal, bNLS );
1340 case TQVariant::LongLong:
1341 writeEntry( pKey, prop.toLongLong(), bPersistent, bGlobal, bNLS );
1343 case TQVariant::ULongLong:
1344 writeEntry( pKey, prop.toULongLong(), bPersistent, bGlobal, bNLS );
1346 case TQVariant::Bool:
1347 writeEntry( pKey, prop.toBool(), bPersistent, bGlobal, bNLS );
1349 case TQVariant::Double:
1350 writeEntry( pKey, prop.toDouble(), bPersistent, bGlobal,
'g', 6, bNLS );
1352 case TQVariant::DateTime:
1353 writeEntry( pKey, prop.toDateTime(), bPersistent, bGlobal, bNLS);
1355 case TQVariant::Date:
1356 writeEntry( pKey, TQDateTime(prop.toDate()), bPersistent, bGlobal, bNLS);
1359 case TQVariant::Pixmap:
1360 case TQVariant::Image:
1361 case TQVariant::Brush:
1362 case TQVariant::Palette:
1363 case TQVariant::ColorGroup:
1364 case TQVariant::Map:
1365 case TQVariant::IconSet:
1366 case TQVariant::CString:
1367 case TQVariant::PointArray:
1368 case TQVariant::Region:
1369 case TQVariant::Bitmap:
1370 case TQVariant::Cursor:
1371 case TQVariant::SizePolicy:
1372 case TQVariant::Time:
1374 case TQVariant::ByteArray:
1376 case TQVariant::BitArray:
1377 case TQVariant::KeySequence:
1378 case TQVariant::Pen:
1380 case TQVariant::Char:
1381 case TQVariant::Url:
1382 case TQVariant::Locale:
1383 case TQVariant::RectF:
1384 case TQVariant::SizeF:
1385 case TQVariant::Line:
1386 case TQVariant::LineF:
1387 case TQVariant::PointF:
1388 case TQVariant::RegExp:
1389 case TQVariant::Hash:
1390 case TQVariant::TextLength:
1391 case QVariant::TextFormat:
1392 case TQVariant::Matrix:
1393 case TQVariant::Transform:
1394 case TQVariant::Matrix4x4:
1395 case TQVariant::Vector2D:
1396 case TQVariant::Vector3D:
1397 case TQVariant::Vector4D:
1398 case TQVariant::Quaternion:
1399 case TQVariant::UserType:
1408 char sep ,
bool bPersistent,
1409 bool bGlobal,
bool bNLS )
1411 writeEntry(pKey.utf8().data(), list, sep, bPersistent, bGlobal, bNLS);
1415 char sep ,
bool bPersistent,
1416 bool bGlobal,
bool bNLS )
1418 if( list.isEmpty() )
1420 writeEntry( pKey, TQString::fromLatin1(
""), bPersistent );
1424 TQStrListIterator it( list );
1425 for( ; it.current(); ++it )
1433 uint strLengh(value.length());
1434 for( i = 0; i < strLengh; i++ )
1436 if( value[i] == sep || value[i] ==
'\\' )
1438 str_list += value[i];
1442 if( str_list.at(str_list.length() - 1) == (QChar)sep )
1443 str_list.truncate( str_list.length() -1 );
1444 writeEntry( pKey, str_list, bPersistent, bGlobal, bNLS );
1448 char sep ,
bool bPersistent,
1449 bool bGlobal,
bool bNLS )
1451 writeEntry(pKey.utf8().data(), list, sep, bPersistent, bGlobal, bNLS);
1455 char sep ,
bool bPersistent,
1456 bool bGlobal,
bool bNLS )
1458 writeEntry(pKey, list, sep, bPersistent, bGlobal, bNLS,
false);
1462 char sep,
bool bPersistent,
1463 bool bGlobal,
bool bNLS,
bool bExpand )
1465 if( list.isEmpty() )
1467 writeEntry( pKey, TQString::fromLatin1(
""), bPersistent );
1471 str_list.reserve( 4096 );
1472 TQStringList::ConstIterator it = list.begin();
1473 for( ; it != list.end(); ++it )
1475 TQString value = *it;
1477 uint strLength(value.length());
1478 for( i = 0; i < strLength; i++ )
1480 if( value[i] == sep || value[i] ==
'\\' )
1482 str_list += value[i];
1486 if( str_list.at(str_list.length() - 1) == (QChar)sep )
1487 str_list.truncate( str_list.length() -1 );
1488 writeEntry( pKey, str_list, bPersistent, bGlobal, bNLS, bExpand );
1492 bool bPersistent,
bool bGlobal,
bool bNLS )
1494 writeEntry(pKey.utf8().data(), list, bPersistent, bGlobal, bNLS);
1498 bool bPersistent,
bool bGlobal,
bool bNLS )
1500 TQStringList strlist;
1501 TQValueList<int>::ConstIterator end = list.end();
1502 for (TQValueList<int>::ConstIterator it = list.begin(); it != end; it++)
1503 strlist << TQString::number(*it);
1504 writeEntry(pKey, strlist,
',', bPersistent, bGlobal, bNLS );
1508 bool bPersistent,
bool bGlobal,
1511 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1515 bool bPersistent,
bool bGlobal,
1518 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1523 bool bPersistent,
bool bGlobal,
1526 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1530 bool bPersistent,
bool bGlobal,
1533 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1538 bool bPersistent,
bool bGlobal,
1541 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1545 bool bPersistent,
bool bGlobal,
1548 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1553 bool bPersistent,
bool bGlobal,
1556 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1560 bool bPersistent,
bool bGlobal,
1563 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1567 bool bPersistent,
bool bGlobal,
1570 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1574 bool bPersistent,
bool bGlobal,
1577 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1582 bool bPersistent,
bool bGlobal,
1585 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1589 bool bPersistent,
bool bGlobal,
1592 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1596 bool bPersistent,
bool bGlobal,
1597 char format,
int precision,
1600 writeEntry( pKey, TQString::number(nValue, format, precision),
1601 bPersistent, bGlobal, bNLS );
1605 bool bPersistent,
bool bGlobal,
1606 char format,
int precision,
1609 writeEntry( pKey, TQString::number(nValue, format, precision),
1610 bPersistent, bGlobal, bNLS );
1619 writeEntry(pKey.utf8().data(), bValue, bPersistent, bGlobal, bNLS);
1634 writeEntry( pKey, aValue, bPersistent, bGlobal, bNLS );
1639 bool bPersistent,
bool bGlobal,
1642 writeEntry(pKey.utf8().data(), rFont, bPersistent, bGlobal, bNLS);
1646 bool bPersistent,
bool bGlobal,
1649 writeEntry( pKey, TQString(rFont.toString()), bPersistent, bGlobal, bNLS );
1654 bool bPersistent,
bool bGlobal,
1657 writeEntry(pKey.utf8().data(), rRect, bPersistent, bGlobal, bNLS);
1661 bool bPersistent,
bool bGlobal,
1666 list.insert( 0, tempstr.setNum( rRect.left() ) );
1667 list.insert( 1, tempstr.setNum( rRect.top() ) );
1668 list.insert( 2, tempstr.setNum( rRect.width() ) );
1669 list.insert( 3, tempstr.setNum( rRect.height() ) );
1671 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1676 bool bPersistent,
bool bGlobal,
1679 writeEntry(pKey.utf8().data(), rPoint, bPersistent, bGlobal, bNLS);
1683 bool bPersistent,
bool bGlobal,
1688 list.insert( 0, tempstr.setNum( rPoint.x() ) );
1689 list.insert( 1, tempstr.setNum( rPoint.y() ) );
1691 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1696 bool bPersistent,
bool bGlobal,
1699 writeEntry(pKey.utf8().data(), rSize, bPersistent, bGlobal, bNLS);
1703 bool bPersistent,
bool bGlobal,
1708 list.insert( 0, tempstr.setNum( rSize.width() ) );
1709 list.insert( 1, tempstr.setNum( rSize.height() ) );
1711 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1719 writeEntry( pKey.utf8().data(), rColor, bPersistent, bGlobal, bNLS);
1728 if (rColor.isValid())
1729 aValue.sprintf(
"%d,%d,%d", rColor.red(), rColor.green(), rColor.blue() );
1733 writeEntry( pKey, aValue, bPersistent, bGlobal, bNLS );
1737 bool bPersistent,
bool bGlobal,
1740 writeEntry(pKey.utf8().data(), rDateTime, bPersistent, bGlobal, bNLS);
1744 bool bPersistent,
bool bGlobal,
1750 TQTime time = TQT_TQTIME_OBJECT(rDateTime.time());
1751 TQDate date = TQT_TQDATE_OBJECT(rDateTime.date());
1753 list.insert( 0, tempstr.setNum( date.year() ) );
1754 list.insert( 1, tempstr.setNum( date.month() ) );
1755 list.insert( 2, tempstr.setNum( date.day() ) );
1757 list.insert( 3, tempstr.setNum( time.hour() ) );
1758 list.insert( 4, tempstr.setNum( time.minute() ) );
1759 list.insert( 5, tempstr.setNum( time.second() ) );
1761 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1766 if (!bLocaleInitialized && KGlobal::_locale) {
1804 d =
new KConfigBasePrivate();
1807 d->readDefaults = b;
1812 return (d && d->readDefaults);
1822 if (!
locale().isNull()) {
1824 aEntryKey.bLocal =
true;
1826 if (entry.mValue.isNull())
1830 putData(aEntryKey, entry,
true);
1831 aEntryKey.bLocal =
false;
1836 if (entry.mValue.isNull())
1839 putData(aEntryKey, entry,
true);
1847 if (!
locale().isNull()) {
1849 aEntryKey.bLocal =
true;
1851 if (!entry.mValue.isNull())
1854 aEntryKey.bLocal =
false;
1859 if (!entry.mValue.isNull())
1871 bLocaleInitialized =
true;
1872 bReadOnly = mMaster->bReadOnly;
1884 bLocaleInitialized =
true;
1885 bReadOnly = mMaster->bReadOnly;
1897 bLocaleInitialized =
true;
1898 bReadOnly = mMaster->bReadOnly;
1923 mMaster->
putData(_key, _data, _checkGroup);
1936 void KConfigBase::virtual_hook(
int,
void* )
1939 void KConfigGroup::virtual_hook(
int id,
void* data )
1940 { KConfigBase::virtual_hook(
id, data ); }
1950 #include "kconfigbase.moc"