28 #include <tqtextstream.h>
30 #include <kapplication.h>
33 #include <kcharsets.h>
35 #include "kconfigbase.h"
36 #include "kconfigbackend.h"
38 #include "kstandarddirs.h"
39 #include "kstringhandler.h"
41 class KConfigBase::KConfigBasePrivate
51 : backEnd(0L), bDirty(false), bLocaleInitialized(false),
52 bReadOnly(false), bExpand(false), d(0)
64 bLocaleInitialized =
true;
81 if ( group.isEmpty() )
94 if ( group.isEmpty() )
101 return TQString::fromUtf8(
mGroup);
111 return hasKey(key.utf8().data());
117 aEntryKey.c_key = pKey;
122 aEntryKey.bLocal =
true;
124 if (!entry.mValue.isNull())
126 aEntryKey.bLocal =
false;
131 return !entry.mValue.isNull();
134 bool KConfigBase::hasTranslatedKey(
const char* pKey)
const
137 aEntryKey.c_key = pKey;
142 aEntryKey.bLocal =
true;
144 if (!entry.mValue.isNull())
146 aEntryKey.bLocal =
false;
154 return internalHasGroup( group.utf8());
159 return internalHasGroup( TQCString(_pGroup));
164 return internalHasGroup( _pGroup);
179 return entry.bImmutable;
192 TQCString utf8_key = key.utf8();
193 entryKey.c_key = utf8_key.data();
205 const TQString& aDefault )
const
212 const TQString& aDefault )
const
214 TQCString result = readEntryUtf8(pKey);
217 return TQString::fromUtf8(result);
222 const TQString& aDefault )
const
228 const TQString& aDefault )
const
234 if (!bLocaleInitialized && KGlobal::_locale) {
247 entryKey.c_key = pKey;
251 if (!aEntryData.mValue.isNull()) {
258 if (!aEntryData.mValue.isNull()) {
259 aValue = TQString::fromUtf8(aEntryData.mValue.data());
263 aValue = emptyString;
272 if( expand || bExpand )
275 int nDollarPos = aValue.find(
'$' );
277 while( nDollarPos != -1 && nDollarPos+1 < static_cast<int>(aValue.length())) {
279 if( (aValue)[nDollarPos+1] ==
'(' ) {
280 uint nEndPos = nDollarPos+1;
282 while ( (nEndPos <= aValue.length()) && (aValue[nEndPos]!=
')') )
285 TQString cmd = aValue.mid( nDollarPos+2, nEndPos-nDollarPos-3 );
288 FILE *fs = popen(TQFile::encodeName(cmd).data(),
"r");
292 TQTextStream ts(fs, IO_ReadOnly);
293 result = ts.read().stripWhiteSpace();
297 aValue.replace( nDollarPos, nEndPos-nDollarPos, result );
298 }
else if( (aValue)[nDollarPos+1] !=
'$' ) {
299 uint nEndPos = nDollarPos+1;
302 if (aValue[nEndPos]==
'{')
304 while ( (nEndPos <= aValue.length()) && (aValue[nEndPos]!=
'}') )
307 aVarName = aValue.mid( nDollarPos+2, nEndPos-nDollarPos-3 );
311 while ( nEndPos <= aValue.length() && (aValue[nEndPos].isNumber()
312 || aValue[nEndPos].isLetter() || aValue[nEndPos]==
'_' ) )
314 aVarName = aValue.mid( nDollarPos+1, nEndPos-nDollarPos-1 );
316 const char* pEnv = 0;
317 if (!aVarName.isEmpty())
318 pEnv = getenv( aVarName.ascii() );
325 aValue.remove( nDollarPos, nEndPos-nDollarPos );
328 aValue.remove( nDollarPos, 1 );
331 nDollarPos = aValue.find(
'$', nDollarPos );
338 TQCString KConfigBase::readEntryUtf8(
const char *pKey)
const
343 entryKey.c_key = pKey;
348 return readEntry(pKey, TQString::null).utf8();
350 return aEntryData.mValue;
354 TQVariant::Type type )
const
360 TQVariant::Type type )
const
363 if ( !
hasKey( pKey ) )
return va;
369 const TQVariant &aDefault )
const
375 const TQVariant &aDefault )
const
377 if ( !
hasKey( pKey ) )
return aDefault;
379 TQVariant tmp = aDefault;
381 switch( aDefault.type() )
383 case TQVariant::Invalid:
385 case TQVariant::String:
386 return TQVariant(
readEntry( pKey, aDefault.toString() ) );
387 case TQVariant::StringList:
389 case TQVariant::List: {
391 TQStringList::ConstIterator it = strList.begin();
392 TQStringList::ConstIterator end = strList.end();
393 TQValueList<TQVariant> list;
395 for (; it != end; ++it ) {
399 return TQVariant( list );
401 case TQVariant::Font:
403 case TQVariant::Point:
405 case TQVariant::Rect:
407 case TQVariant::Size:
409 case TQVariant::Color:
412 return TQVariant(
readNumEntry( pKey, aDefault.toInt() ) );
413 case TQVariant::UInt:
415 case TQVariant::LongLong:
416 return TQVariant(
readNum64Entry( pKey, aDefault.toLongLong() ) );
417 case TQVariant::ULongLong:
419 case TQVariant::Bool:
420 return TQVariant(
readBoolEntry( pKey, aDefault.toBool() ), 0 );
421 case TQVariant::Double:
423 case TQVariant::DateTime:
425 case TQVariant::Date:
426 return TQVariant(TQT_TQDATE_OBJECT(
readDateTimeEntry( pKey, &tmp.asDateTime() ).date()));
428 case TQVariant::Pixmap:
429 case TQVariant::Image:
430 case TQVariant::Brush:
431 case TQVariant::Palette:
432 case TQVariant::ColorGroup:
434 case TQVariant::IconSet:
435 case TQVariant::CString:
436 case TQVariant::PointArray:
437 case TQVariant::Region:
438 case TQVariant::Bitmap:
439 case TQVariant::Cursor:
440 case TQVariant::SizePolicy:
441 case TQVariant::Time:
443 case TQVariant::ByteArray:
445 case TQVariant::BitArray:
446 case TQVariant::KeySequence:
449 case TQVariant::Char:
451 case TQVariant::Locale:
452 case TQVariant::RectF:
453 case TQVariant::SizeF:
454 case TQVariant::Line:
455 case TQVariant::LineF:
456 case TQVariant::PointF:
457 case TQVariant::RegExp:
458 case TQVariant::Hash:
459 case TQVariant::TextLength:
460 case QVariant::TextFormat:
461 case TQVariant::Matrix:
462 case TQVariant::Transform:
463 case TQVariant::Matrix4x4:
464 case TQVariant::Vector2D:
465 case TQVariant::Vector3D:
466 case TQVariant::Vector4D:
467 case TQVariant::Quaternion:
468 case TQVariant::UserType:
478 TQStrList &list,
char sep )
const
484 TQStrList &list,
char sep )
const
489 TQCString str_list = readEntryUtf8( pKey );
490 if (str_list.isEmpty())
494 TQCString value =
"";
495 int len = str_list.length();
497 for (
int i = 0; i < len; i++) {
498 if (str_list[i] != sep && str_list[i] !=
'\\') {
499 value += str_list[i];
502 if (str_list[i] ==
'\\') {
505 value += str_list[i];
513 list.append( value );
517 if ( str_list[len-1] != sep || ( len > 1 && str_list[len-2] ==
'\\' ) )
518 list.append( value );
535 if( str_list.isEmpty() )
537 TQString value(emptyString);
538 int len = str_list.length();
540 value.reserve( len );
541 for(
int i = 0; i < len; i++ )
543 if( str_list[i] != sep && str_list[i] !=
'\\' )
545 value += str_list[i];
548 if( str_list[i] ==
'\\' )
552 value += str_list[i];
555 TQString finalvalue( value );
556 finalvalue.squeeze();
557 list.append( finalvalue );
560 if ( str_list[len-1] != sep || ( len > 1 && str_list[len-2] ==
'\\' ) )
563 list.append( value );
585 TQValueList<int> list;
586 TQStringList::ConstIterator end(strlist.end());
587 for (TQStringList::ConstIterator it = strlist.begin(); it != end; ++it)
590 list << (*it).toInt();
602 const bool bExpandSave = bExpand;
604 TQString aValue =
readEntry( pKey, pDefault );
605 bExpand = bExpandSave;
616 const bool bExpandSave = bExpand;
619 bExpand = bExpandSave;
630 TQCString aValue = readEntryUtf8( pKey );
631 if( aValue.isNull() )
633 else if( aValue ==
"true" || aValue ==
"on" || aValue ==
"yes" )
638 int rc = aValue.toInt( &ok );
639 return( ok ? rc : nDefault );
651 TQCString aValue = readEntryUtf8( pKey );
652 if( aValue.isNull() )
657 unsigned int rc = aValue.toUInt( &ok );
658 return( ok ? rc : nDefault );
670 TQCString aValue = readEntryUtf8( pKey );
671 if( aValue.isNull() )
676 long rc = aValue.toLong( &ok );
677 return( ok ? rc : nDefault );
689 TQCString aValue = readEntryUtf8( pKey );
690 if( aValue.isNull() )
695 unsigned long rc = aValue.toULong( &ok );
696 return( ok ? rc : nDefault );
709 if( aValue.isNull() )
714 TQ_INT64 rc = aValue.toLongLong( &ok );
715 return( ok ? rc : nDefault );
729 if( aValue.isNull() )
734 TQ_UINT64 rc = aValue.toULongLong( &ok );
735 return( ok ? rc : nDefault );
746 TQCString aValue = readEntryUtf8( pKey );
747 if( aValue.isNull() )
752 double rc = aValue.toDouble( &ok );
753 return( ok ? rc : nDefault );
765 TQCString aValue = readEntryUtf8( pKey );
767 if( aValue.isNull() )
771 if( aValue ==
"true" || aValue ==
"on" || aValue ==
"yes" || aValue ==
"1" )
776 int val = aValue.toInt( &bOK );
777 if( bOK && val != 0 )
795 if( !aValue.isNull() ) {
796 if ( aValue.contains(
',' ) > 5 ) {
798 if ( !aRetFont.fromString( aValue ) && pDefault )
799 aRetFont = *pDefault;
805 int nIndex = aValue.find(
',' );
808 aRetFont = *pDefault;
811 aRetFont.setFamily( aValue.left( nIndex ) );
814 int nOldIndex = nIndex;
815 nIndex = aValue.find(
',', nOldIndex+1 );
818 aRetFont = *pDefault;
822 aRetFont.setPointSize( aValue.mid( nOldIndex+1,
823 nIndex-nOldIndex-1 ).toInt() );
827 nIndex = aValue.find(
',', nOldIndex+1 );
831 aRetFont = *pDefault;
835 aRetFont.setStyleHint( (TQFont::StyleHint)aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() );
839 nIndex = aValue.find(
',', nOldIndex+1 );
843 aRetFont = *pDefault;
847 TQString chStr=aValue.mid( nOldIndex+1,
848 nIndex-nOldIndex-1 );
851 nIndex = aValue.find(
',', nOldIndex+1 );
855 aRetFont = *pDefault;
859 aRetFont.setWeight( aValue.mid( nOldIndex+1,
860 nIndex-nOldIndex-1 ).toUInt() );
863 uint nFontBits = aValue.right( aValue.length()-nIndex-1 ).toUInt();
865 aRetFont.setItalic( nFontBits & 0x01 );
866 aRetFont.setUnderline( nFontBits & 0x02 );
867 aRetFont.setStrikeOut( nFontBits & 0x04 );
868 aRetFont.setFixedPitch( nFontBits & 0x08 );
869 aRetFont.setRawMode( nFontBits & 0x20 );
875 aRetFont = *pDefault;
889 TQCString aValue = readEntryUtf8(pKey);
891 if (!aValue.isEmpty())
893 int left, top, width, height;
895 if (sscanf(aValue.data(),
"%d,%d,%d,%d", &left, &top, &width, &height) == 4)
897 return TQRect(left, top, width, height);
907 const TQPoint* pDefault )
const
913 const TQPoint* pDefault )
const
915 TQCString aValue = readEntryUtf8(pKey);
917 if (!aValue.isEmpty())
921 if (sscanf(aValue.data(),
"%d,%d", &x, &y) == 2)
932 const TQSize* pDefault )
const
938 const TQSize* pDefault )
const
940 TQCString aValue = readEntryUtf8(pKey);
942 if (!aValue.isEmpty())
946 if (sscanf(aValue.data(),
"%d,%d", &width, &height) == 2)
948 return TQSize(width, height);
958 const TQColor* pDefault )
const
964 const TQColor* pDefault )
const
967 int nRed = 0, nGreen = 0, nBlue = 0;
970 if( !aValue.isEmpty() )
972 if ( aValue.at(0) == (QChar)
'#' )
974 aRetColor.setNamedColor(aValue);
982 int nIndex = aValue.find(
',' );
987 aRetColor = *pDefault;
991 nRed = aValue.left( nIndex ).toInt( &bOK );
994 int nOldIndex = nIndex;
995 nIndex = aValue.find(
',', nOldIndex+1 );
1000 aRetColor = *pDefault;
1003 nGreen = aValue.mid( nOldIndex+1,
1004 nIndex-nOldIndex-1 ).toInt( &bOK );
1007 nBlue = aValue.right( aValue.length()-nIndex-1 ).toInt( &bOK );
1009 aRetColor.setRgb( nRed, nGreen, nBlue );
1015 aRetColor = *pDefault;
1023 const TQDateTime* pDefault )
const
1030 const TQDateTime* pDefault )
const
1037 return TQDateTime::currentDateTime();
1043 TQDate date( atoi( list.at( 0 ) ), atoi( list.at( 1 ) ),
1044 atoi( list.at( 2 ) ) );
1045 TQTime time( atoi( list.at( 3 ) ), atoi( list.at( 4 ) ),
1046 atoi( list.at( 5 ) ) );
1048 return TQDateTime( date, time );
1051 return TQDateTime::currentDateTime();
1059 writeEntry(pKey.utf8().data(), value, bPersistent, bGlobal, bNLS);
1067 writeEntry(pKey, value, bPersistent, bGlobal, bNLS,
false);
1088 entryKey.bLocal = bNLS;
1091 aEntryData.mValue = value.utf8();
1093 aEntryData.
bNLS = bNLS;
1097 aEntryData.
bDirty =
true;
1100 putData(entryKey, aEntryData,
true);
1104 bool bPersistent,
bool bGlobal,
1107 writePathEntry(pKey.utf8().data(), path, bPersistent, bGlobal, bNLS);
1111 static bool cleanHomeDirPath( TQString &path,
const TQString &homeDir )
1113 #ifdef Q_WS_WIN //safer
1114 if (!TQDir::convertSeparators(path).startsWith(TQDir::convertSeparators(homeDir)))
1117 if (!path.startsWith(homeDir))
1121 unsigned int len = homeDir.length();
1123 if (len && (path.length() == len || path[len] ==
'/')) {
1124 path.replace(0, len, TQString::fromLatin1(
"$HOME"));
1130 static TQString translatePath( TQString path )
1136 path.replace(
'$',
"$$");
1138 bool startsWithFile = path.startsWith(
"file:",
false);
1142 if (((!startsWithFile) && (path[0] !=
'/')) || (startsWithFile && (path[5] !=
'/'))) {
1146 if (startsWithFile) {
1151 while (path[0] ==
'/' && path[1] ==
'/') {
1159 TQString homeDir0 = TQFile::decodeName(getenv(
"HOME"));
1160 TQString homeDir1 = TQDir::homeDirPath();
1161 TQString homeDir2 = TQDir(homeDir1).canonicalPath();
1162 if (cleanHomeDirPath(path, homeDir0) ||
1163 cleanHomeDirPath(path, homeDir1) ||
1164 cleanHomeDirPath(path, homeDir2) ) {
1169 path.prepend(
"file://" );
1175 bool bPersistent,
bool bGlobal,
1178 writeEntry(pKey, translatePath(path), bPersistent, bGlobal, bNLS,
true);
1182 char sep ,
bool bPersistent,
1183 bool bGlobal,
bool bNLS )
1185 writePathEntry(pKey.utf8().data(), list, sep, bPersistent, bGlobal, bNLS);
1189 char sep ,
bool bPersistent,
1190 bool bGlobal,
bool bNLS )
1192 if( list.isEmpty() )
1194 writeEntry( pKey, TQString::fromLatin1(
""), bPersistent );
1197 TQStringList new_list;
1198 TQStringList::ConstIterator it = list.begin();
1199 for( ; it != list.end(); ++it )
1201 TQString value = *it;
1202 new_list.append( translatePath(value) );
1204 writeEntry( pKey, new_list, sep, bPersistent, bGlobal, bNLS,
true );
1232 aEntryData.
bNLS = bNLS;
1233 aEntryData.
bDirty =
true;
1237 putData(entryKey, aEntryData,
true);
1246 return aEntryMap.isEmpty();
1250 bool checkGroup =
true;
1252 KEntryMapIterator aIt;
1253 for (aIt = aEntryMap.begin(); aIt != aEntryMap.end(); ++aIt)
1255 if (!aIt.key().mKey.isEmpty() && !aIt.key().bDefault && !(*aIt).bDeleted)
1257 (*aIt).bDeleted =
true;
1258 (*aIt).bDirty =
true;
1259 (*aIt).bGlobal = bGlobal;
1261 putData(aIt.key(), *aIt, checkGroup);
1273 bool bGlobal,
bool bNLS )
1275 writeEntry(pKey.utf8().data(), prop, bPersistent, bGlobal, bNLS);
1280 bool bGlobal,
bool bNLS )
1282 switch( prop.type() )
1284 case TQVariant::Invalid:
1285 writeEntry( pKey,
"", bPersistent, bGlobal, bNLS );
1287 case TQVariant::String:
1288 writeEntry( pKey, prop.toString(), bPersistent, bGlobal, bNLS );
1290 case TQVariant::StringList:
1291 writeEntry( pKey, prop.toStringList(),
',', bPersistent, bGlobal, bNLS );
1293 case TQVariant::List: {
1294 TQValueList<TQVariant> list = prop.toList();
1295 TQValueList<TQVariant>::ConstIterator it = list.begin();
1296 TQValueList<TQVariant>::ConstIterator end = list.end();
1297 TQStringList strList;
1299 for (; it != end; ++it )
1300 strList.append( (*it).toString() );
1302 writeEntry( pKey, strList,
',', bPersistent, bGlobal, bNLS );
1306 case TQVariant::Font:
1307 writeEntry( pKey, prop.toFont(), bPersistent, bGlobal, bNLS );
1309 case TQVariant::Point:
1310 writeEntry( pKey, prop.toPoint(), bPersistent, bGlobal, bNLS );
1312 case TQVariant::Rect:
1313 writeEntry( pKey, prop.toRect(), bPersistent, bGlobal, bNLS );
1315 case TQVariant::Size:
1316 writeEntry( pKey, prop.toSize(), bPersistent, bGlobal, bNLS );
1318 case TQVariant::Color:
1319 writeEntry( pKey, prop.toColor(), bPersistent, bGlobal, bNLS );
1321 case TQVariant::Int:
1322 writeEntry( pKey, prop.toInt(), bPersistent, bGlobal, bNLS );
1324 case TQVariant::UInt:
1325 writeEntry( pKey, prop.toUInt(), bPersistent, bGlobal, bNLS );
1327 case TQVariant::LongLong:
1328 writeEntry( pKey, prop.toLongLong(), bPersistent, bGlobal, bNLS );
1330 case TQVariant::ULongLong:
1331 writeEntry( pKey, prop.toULongLong(), bPersistent, bGlobal, bNLS );
1333 case TQVariant::Bool:
1334 writeEntry( pKey, prop.toBool(), bPersistent, bGlobal, bNLS );
1336 case TQVariant::Double:
1337 writeEntry( pKey, prop.toDouble(), bPersistent, bGlobal,
'g', 6, bNLS );
1339 case TQVariant::DateTime:
1340 writeEntry( pKey, prop.toDateTime(), bPersistent, bGlobal, bNLS);
1342 case TQVariant::Date:
1343 writeEntry( pKey, TQDateTime(prop.toDate()), bPersistent, bGlobal, bNLS);
1346 case TQVariant::Pixmap:
1347 case TQVariant::Image:
1348 case TQVariant::Brush:
1349 case TQVariant::Palette:
1350 case TQVariant::ColorGroup:
1351 case TQVariant::Map:
1352 case TQVariant::IconSet:
1353 case TQVariant::CString:
1354 case TQVariant::PointArray:
1355 case TQVariant::Region:
1356 case TQVariant::Bitmap:
1357 case TQVariant::Cursor:
1358 case TQVariant::SizePolicy:
1359 case TQVariant::Time:
1361 case TQVariant::ByteArray:
1363 case TQVariant::BitArray:
1364 case TQVariant::KeySequence:
1365 case TQVariant::Pen:
1367 case TQVariant::Char:
1368 case TQVariant::Url:
1369 case TQVariant::Locale:
1370 case TQVariant::RectF:
1371 case TQVariant::SizeF:
1372 case TQVariant::Line:
1373 case TQVariant::LineF:
1374 case TQVariant::PointF:
1375 case TQVariant::RegExp:
1376 case TQVariant::Hash:
1377 case TQVariant::TextLength:
1378 case QVariant::TextFormat:
1379 case TQVariant::Matrix:
1380 case TQVariant::Transform:
1381 case TQVariant::Matrix4x4:
1382 case TQVariant::Vector2D:
1383 case TQVariant::Vector3D:
1384 case TQVariant::Vector4D:
1385 case TQVariant::Quaternion:
1386 case TQVariant::UserType:
1395 char sep ,
bool bPersistent,
1396 bool bGlobal,
bool bNLS )
1398 writeEntry(pKey.utf8().data(), list, sep, bPersistent, bGlobal, bNLS);
1402 char sep ,
bool bPersistent,
1403 bool bGlobal,
bool bNLS )
1405 if( list.isEmpty() )
1407 writeEntry( pKey, TQString::fromLatin1(
""), bPersistent );
1411 TQStrListIterator it( list );
1412 for( ; it.current(); ++it )
1420 uint strLengh(value.length());
1421 for( i = 0; i < strLengh; i++ )
1423 if( value[i] == sep || value[i] ==
'\\' )
1425 str_list += value[i];
1429 if( str_list.at(str_list.length() - 1) == (QChar)sep )
1430 str_list.truncate( str_list.length() -1 );
1431 writeEntry( pKey, str_list, bPersistent, bGlobal, bNLS );
1435 char sep ,
bool bPersistent,
1436 bool bGlobal,
bool bNLS )
1438 writeEntry(pKey.utf8().data(), list, sep, bPersistent, bGlobal, bNLS);
1442 char sep ,
bool bPersistent,
1443 bool bGlobal,
bool bNLS )
1445 writeEntry(pKey, list, sep, bPersistent, bGlobal, bNLS,
false);
1449 char sep,
bool bPersistent,
1450 bool bGlobal,
bool bNLS,
bool bExpand )
1452 if( list.isEmpty() )
1454 writeEntry( pKey, TQString::fromLatin1(
""), bPersistent );
1458 str_list.reserve( 4096 );
1459 TQStringList::ConstIterator it = list.begin();
1460 for( ; it != list.end(); ++it )
1462 TQString value = *it;
1464 uint strLength(value.length());
1465 for( i = 0; i < strLength; i++ )
1467 if( value[i] == sep || value[i] ==
'\\' )
1469 str_list += value[i];
1473 if( str_list.at(str_list.length() - 1) == (QChar)sep )
1474 str_list.truncate( str_list.length() -1 );
1475 writeEntry( pKey, str_list, bPersistent, bGlobal, bNLS, bExpand );
1479 bool bPersistent,
bool bGlobal,
bool bNLS )
1481 writeEntry(pKey.utf8().data(), list, bPersistent, bGlobal, bNLS);
1485 bool bPersistent,
bool bGlobal,
bool bNLS )
1487 TQStringList strlist;
1488 TQValueList<int>::ConstIterator end = list.end();
1489 for (TQValueList<int>::ConstIterator it = list.begin(); it != end; it++)
1490 strlist << TQString::number(*it);
1491 writeEntry(pKey, strlist,
',', bPersistent, bGlobal, bNLS );
1495 bool bPersistent,
bool bGlobal,
1498 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1502 bool bPersistent,
bool bGlobal,
1505 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1510 bool bPersistent,
bool bGlobal,
1513 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1517 bool bPersistent,
bool bGlobal,
1520 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1525 bool bPersistent,
bool bGlobal,
1528 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1532 bool bPersistent,
bool bGlobal,
1535 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1540 bool bPersistent,
bool bGlobal,
1543 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1547 bool bPersistent,
bool bGlobal,
1550 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1554 bool bPersistent,
bool bGlobal,
1557 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1561 bool bPersistent,
bool bGlobal,
1564 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1569 bool bPersistent,
bool bGlobal,
1572 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1576 bool bPersistent,
bool bGlobal,
1579 writeEntry( pKey, TQString::number(nValue), bPersistent, bGlobal, bNLS );
1583 bool bPersistent,
bool bGlobal,
1584 char format,
int precision,
1587 writeEntry( pKey, TQString::number(nValue, format, precision),
1588 bPersistent, bGlobal, bNLS );
1592 bool bPersistent,
bool bGlobal,
1593 char format,
int precision,
1596 writeEntry( pKey, TQString::number(nValue, format, precision),
1597 bPersistent, bGlobal, bNLS );
1606 writeEntry(pKey.utf8().data(), bValue, bPersistent, bGlobal, bNLS);
1621 writeEntry( pKey, aValue, bPersistent, bGlobal, bNLS );
1626 bool bPersistent,
bool bGlobal,
1629 writeEntry(pKey.utf8().data(), rFont, bPersistent, bGlobal, bNLS);
1633 bool bPersistent,
bool bGlobal,
1636 writeEntry( pKey, TQString(rFont.toString()), bPersistent, bGlobal, bNLS );
1641 bool bPersistent,
bool bGlobal,
1644 writeEntry(pKey.utf8().data(), rRect, bPersistent, bGlobal, bNLS);
1648 bool bPersistent,
bool bGlobal,
1653 list.insert( 0, tempstr.setNum( rRect.left() ) );
1654 list.insert( 1, tempstr.setNum( rRect.top() ) );
1655 list.insert( 2, tempstr.setNum( rRect.width() ) );
1656 list.insert( 3, tempstr.setNum( rRect.height() ) );
1658 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1663 bool bPersistent,
bool bGlobal,
1666 writeEntry(pKey.utf8().data(), rPoint, bPersistent, bGlobal, bNLS);
1670 bool bPersistent,
bool bGlobal,
1675 list.insert( 0, tempstr.setNum( rPoint.x() ) );
1676 list.insert( 1, tempstr.setNum( rPoint.y() ) );
1678 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1683 bool bPersistent,
bool bGlobal,
1686 writeEntry(pKey.utf8().data(), rSize, bPersistent, bGlobal, bNLS);
1690 bool bPersistent,
bool bGlobal,
1695 list.insert( 0, tempstr.setNum( rSize.width() ) );
1696 list.insert( 1, tempstr.setNum( rSize.height() ) );
1698 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1706 writeEntry( pKey.utf8().data(), rColor, bPersistent, bGlobal, bNLS);
1715 if (rColor.isValid())
1716 aValue.sprintf(
"%d,%d,%d", rColor.red(), rColor.green(), rColor.blue() );
1720 writeEntry( pKey, aValue, bPersistent, bGlobal, bNLS );
1724 bool bPersistent,
bool bGlobal,
1727 writeEntry(pKey.utf8().data(), rDateTime, bPersistent, bGlobal, bNLS);
1731 bool bPersistent,
bool bGlobal,
1737 TQTime time = TQT_TQTIME_OBJECT(rDateTime.time());
1738 TQDate date = TQT_TQDATE_OBJECT(rDateTime.date());
1740 list.insert( 0, tempstr.setNum( date.year() ) );
1741 list.insert( 1, tempstr.setNum( date.month() ) );
1742 list.insert( 2, tempstr.setNum( date.day() ) );
1744 list.insert( 3, tempstr.setNum( time.hour() ) );
1745 list.insert( 4, tempstr.setNum( time.minute() ) );
1746 list.insert( 5, tempstr.setNum( time.second() ) );
1748 writeEntry( pKey, list,
',', bPersistent, bGlobal, bNLS );
1753 if (!bLocaleInitialized && KGlobal::_locale) {
1791 d =
new KConfigBasePrivate();
1794 d->readDefaults = b;
1799 return (d && d->readDefaults);
1809 if (!
locale().isNull()) {
1811 aEntryKey.bLocal =
true;
1813 if (entry.mValue.isNull())
1817 putData(aEntryKey, entry,
true);
1818 aEntryKey.bLocal =
false;
1823 if (entry.mValue.isNull())
1826 putData(aEntryKey, entry,
true);
1834 if (!
locale().isNull()) {
1836 aEntryKey.bLocal =
true;
1838 if (!entry.mValue.isNull())
1841 aEntryKey.bLocal =
false;
1846 if (!entry.mValue.isNull())
1858 bLocaleInitialized =
true;
1859 bReadOnly = mMaster->bReadOnly;
1871 bLocaleInitialized =
true;
1872 bReadOnly = mMaster->bReadOnly;
1884 bLocaleInitialized =
true;
1885 bReadOnly = mMaster->bReadOnly;
1910 mMaster->
putData(_key, _data, _checkGroup);
1923 void KConfigBase::virtual_hook(
int,
void* )
1926 void KConfigGroup::virtual_hook(
int id,
void* data )
1927 { KConfigBase::virtual_hook(
id, data ); }
1937 #include "kconfigbase.moc"