|
Lines 20-31
Link Here
|
| 20 |
Boston, MA 02110-1301, USA. |
20 |
Boston, MA 02110-1301, USA. |
| 21 |
*/ |
21 |
*/ |
| 22 |
|
22 |
|
| 23 |
#include <stdlib.h> |
23 |
#include <cstdio> |
| 24 |
#include <string.h> |
24 |
#include <cstdlib> |
| 25 |
|
25 |
|
| 26 |
#include <qfile.h> |
26 |
#include <qfile.h> |
| 27 |
#include <qdir.h> |
27 |
#include <qdir.h> |
| 28 |
#include <qtextstream.h> |
28 |
#include <qtextstream.h> |
|
|
29 |
#include <qtextcodec.h> |
| 30 |
#include <qdom.h> |
| 29 |
|
31 |
|
| 30 |
#include <kapplication.h> |
32 |
#include <kapplication.h> |
| 31 |
#include <kglobal.h> |
33 |
#include <kglobal.h> |
|
Lines 38-62
Link Here
|
| 38 |
#include "kstandarddirs.h" |
40 |
#include "kstandarddirs.h" |
| 39 |
#include "kstringhandler.h" |
41 |
#include "kstringhandler.h" |
| 40 |
|
42 |
|
| 41 |
class KConfigBase::KConfigBasePrivate |
43 |
void KConfigBase::dumpConfig( const QString& ent, const QString& val, const QString& type ) const |
| 42 |
{ |
44 |
{ |
| 43 |
public: |
45 |
bool dumpEnabled = getenv( "DUMPCONFIG" ) ? true : false; |
| 44 |
KConfigBasePrivate() : readDefaults(false) { }; |
|
|
| 45 |
|
46 |
|
| 46 |
public: |
47 |
if( backEnd == 0 ) |
| 47 |
bool readDefaults; |
48 |
{ |
| 48 |
}; |
49 |
dumpEnabled = false; |
|
|
50 |
return; |
| 51 |
} |
| 52 |
else if( !dumpEnabled ) |
| 53 |
return; |
| 54 |
|
| 55 |
QString filename; |
| 56 |
filename = backEnd->fileName(); |
| 57 |
|
| 58 |
// blacklists some entries to avoid uselless queries |
| 59 |
if ( filename == "kdebugrc" |
| 60 |
|| filename == "kconf_updaterc" |
| 61 |
|| filename == "kdedrc" |
| 62 |
|| filename == "klauncherrc" |
| 63 |
|| filename == "kdeinitrc" |
| 64 |
|| filename == "kbuildsycocarc" |
| 65 |
|| filename == "drkonqirc" |
| 66 |
|| filename.startsWith( "/" ) |
| 67 |
|| filename.endsWith( ".desktop" ) |
| 68 |
) |
| 69 |
return; |
| 70 |
|
| 71 |
QDomDocument *xmldoc; |
| 72 |
QDomDocument *globalxmldoc; |
| 73 |
|
| 74 |
bool globalgroup = false; |
| 75 |
|
| 76 |
if ( mGroup == "KDE" || mGroup == "General" ) |
| 77 |
globalgroup = true; |
| 78 |
|
| 79 |
QDomElement root; |
| 80 |
QDir bd( getenv( "KCONFIGXMLDIR" ) ); |
| 81 |
|
| 82 |
QString data = bd.exists() ? bd.absPath() : "/tmp"; |
| 83 |
QString localfile = data + '/' + filename + ".xml"; |
| 84 |
QFile file( localfile ); |
| 85 |
if ( !file.open( IO_ReadOnly ) ) |
| 86 |
{ |
| 87 |
xmldoc = new QDomDocument( filename ); |
| 88 |
root = xmldoc->createElement( filename ); |
| 89 |
xmldoc->appendChild( root ); |
| 90 |
} |
| 91 |
else |
| 92 |
{ |
| 93 |
xmldoc = new QDomDocument(); |
| 94 |
if ( !xmldoc->setContent( &file ) ) |
| 95 |
{ |
| 96 |
file.close(); |
| 97 |
return; |
| 98 |
} |
| 99 |
root = xmldoc->documentElement(); |
| 100 |
} |
| 101 |
file.close(); |
| 102 |
|
| 103 |
QDomElement globalroot; |
| 104 |
localfile = data + "/kdeglobals.xml"; |
| 105 |
file.setName( localfile ); |
| 106 |
if ( !file.open( IO_ReadOnly ) ) |
| 107 |
{ |
| 108 |
globalxmldoc = new QDomDocument( "kdeglobals" ); |
| 109 |
globalroot = globalxmldoc->createElement( "kdeglobals" ); |
| 110 |
globalxmldoc->appendChild( globalroot ); |
| 111 |
} |
| 112 |
else |
| 113 |
{ |
| 114 |
globalxmldoc = new QDomDocument(); |
| 115 |
if ( !globalxmldoc->setContent( &file ) ) |
| 116 |
{ |
| 117 |
file.close(); |
| 118 |
return; |
| 119 |
} |
| 120 |
globalroot = globalxmldoc->documentElement(); |
| 121 |
} |
| 122 |
file.close(); |
| 123 |
|
| 124 |
|
| 125 |
bool exists = false; |
| 126 |
|
| 127 |
QDomNode node; |
| 128 |
QDomElement grp; |
| 129 |
|
| 130 |
if( ! globalgroup ) |
| 131 |
{ |
| 132 |
node = xmldoc->documentElement().namedItem( "group" ); |
| 133 |
while ( !node.isNull() ) |
| 134 |
{ |
| 135 |
QString current = node.attributes().item( 0 ).nodeValue(); |
| 136 |
if ( node.attributes().item( 0 ).nodeValue() == QString( mGroup ) ) |
| 137 |
{ |
| 138 |
grp = node.toElement(); |
| 139 |
exists = true; |
| 140 |
break; |
| 141 |
} |
| 142 |
node = node.nextSibling(); |
| 143 |
} |
| 144 |
|
| 145 |
if ( ! exists ) |
| 146 |
{ |
| 147 |
grp = xmldoc->createElement( "group" ); |
| 148 |
grp.setAttribute( "name", mGroup ); |
| 149 |
root.appendChild( grp ); |
| 150 |
} |
| 151 |
} |
| 152 |
else |
| 153 |
{ |
| 154 |
node = globalxmldoc->documentElement().namedItem( "group" ); |
| 155 |
while ( !node.isNull() ) |
| 156 |
{ |
| 157 |
QString current = node.attributes().item( 0 ).nodeValue(); |
| 158 |
if ( node.attributes().item( 0 ).nodeValue() == QString( mGroup ) ) |
| 159 |
{ |
| 160 |
grp = node.toElement(); |
| 161 |
exists = true; |
| 162 |
break; |
| 163 |
} |
| 164 |
node = node.nextSibling(); |
| 165 |
} |
| 166 |
|
| 167 |
if ( ! exists ) |
| 168 |
{ |
| 169 |
grp = globalxmldoc->createElement( "group" ); |
| 170 |
grp.setAttribute( "name", mGroup ); |
| 171 |
globalroot.appendChild( grp ); |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
exists = false; |
| 177 |
QDomElement entry; |
| 178 |
QDomText t; |
| 179 |
if ( ! globalgroup ) |
| 180 |
t = xmldoc->createTextNode( val ); |
| 181 |
else |
| 182 |
t = globalxmldoc->createTextNode( val ); |
| 183 |
node = grp.namedItem( "property" ); |
| 184 |
|
| 185 |
while ( !node.isNull() ) |
| 186 |
{ |
| 187 |
QString current = node.attributes().item( 0 ).nodeValue(); |
| 188 |
if ( node.attributes().namedItem( "name" ).nodeValue() == ent ) |
| 189 |
{ |
| 190 |
entry = node.toElement(); |
| 191 |
exists = true; |
| 192 |
break; |
| 193 |
} |
| 194 |
node = node.nextSibling(); |
| 195 |
} |
| 196 |
|
| 197 |
if ( ! exists ) |
| 198 |
{ |
| 199 |
|
| 200 |
if ( ! globalgroup ) |
| 201 |
entry = xmldoc->createElement( "property" ); |
| 202 |
else |
| 203 |
entry = globalxmldoc->createElement( "property" ); |
| 204 |
entry.setAttribute( "name", ent ); |
| 205 |
entry.setAttribute( "type", type ); |
| 206 |
grp.appendChild( entry ); |
| 207 |
entry.appendChild( t ); |
| 208 |
} |
| 209 |
|
| 210 |
// Save every time to avoid duplicated root elements |
| 211 |
filename = data + '/' + backEnd->fileName() + ".xml"; |
| 212 |
file.setName( filename ); |
| 213 |
if ( file.open( IO_WriteOnly ) ) |
| 214 |
{ |
| 215 |
QTextStream qualquer( &file ); |
| 216 |
qualquer << xmldoc->toString() << endl; |
| 217 |
file.close(); |
| 218 |
} |
| 219 |
|
| 220 |
filename = data + "/kdeglobals.xml"; |
| 221 |
file.setName( filename ); |
| 222 |
if ( file.open( IO_WriteOnly ) ) |
| 223 |
{ |
| 224 |
QTextStream qualquer( &file ); |
| 225 |
qualquer << globalxmldoc->toString() << endl; |
| 226 |
file.close(); |
| 227 |
} |
| 228 |
|
| 229 |
} |
| 49 |
|
230 |
|
| 50 |
KConfigBase::KConfigBase() |
231 |
KConfigBase::KConfigBase() |
| 51 |
: backEnd(0L), bDirty(false), bLocaleInitialized(false), |
232 |
: backEnd(0L), bDirty(false), bLocaleInitialized(false), |
| 52 |
bReadOnly(false), bExpand(false), d(0) |
233 |
bReadOnly(false), bExpand(false), m_Private(0) |
| 53 |
{ |
234 |
{ |
|
|
235 |
m_Private = m_Private = new KConfigBasePrivate(); |
| 236 |
m_Private->backEnds.setAutoDelete(true); |
| 54 |
setGroup(QString::null); |
237 |
setGroup(QString::null); |
| 55 |
} |
238 |
} |
| 56 |
|
239 |
|
| 57 |
KConfigBase::~KConfigBase() |
240 |
KConfigBase::~KConfigBase() |
| 58 |
{ |
241 |
{ |
| 59 |
delete d; |
242 |
|
|
|
243 |
delete m_Private; |
| 60 |
} |
244 |
} |
| 61 |
|
245 |
|
| 62 |
void KConfigBase::setLocale() |
246 |
void KConfigBase::setLocale() |
|
Lines 203-209
Link Here
|
| 203 |
QString KConfigBase::readEntry( const QString& pKey, |
387 |
QString KConfigBase::readEntry( const QString& pKey, |
| 204 |
const QString& aDefault ) const |
388 |
const QString& aDefault ) const |
| 205 |
{ |
389 |
{ |
| 206 |
return KConfigBase::readEntry(pKey.utf8().data(), aDefault); |
390 |
QString aValue = KConfigBase::readEntry(pKey.utf8().data(), aDefault); |
|
|
391 |
if ( ! aValue.isNull() ) |
| 392 |
dumpConfig( pKey, aValue, "String" ); |
| 393 |
return aValue; |
| 207 |
} |
394 |
} |
| 208 |
|
395 |
|
| 209 |
QString KConfigBase::readEntry( const char *pKey, |
396 |
QString KConfigBase::readEntry( const char *pKey, |
|
Lines 313-319
Link Here
|
| 313 |
nDollarPos = aValue.find( '$', nDollarPos ); |
500 |
nDollarPos = aValue.find( '$', nDollarPos ); |
| 314 |
} |
501 |
} |
| 315 |
} |
502 |
} |
| 316 |
|
503 |
|
| 317 |
return aValue; |
504 |
return aValue; |
| 318 |
} |
505 |
} |
| 319 |
|
506 |
|
|
Lines 442-448
Link Here
|
| 442 |
QStrList &list, char sep ) const |
629 |
QStrList &list, char sep ) const |
| 443 |
{ |
630 |
{ |
| 444 |
if( !hasKey( pKey ) ) |
631 |
if( !hasKey( pKey ) ) |
|
|
632 |
{ |
| 445 |
return 0; |
633 |
return 0; |
|
|
634 |
} |
| 446 |
|
635 |
|
| 447 |
QCString str_list = readEntryUtf8( pKey ); |
636 |
QCString str_list = readEntryUtf8( pKey ); |
| 448 |
if (str_list.isEmpty()) |
637 |
if (str_list.isEmpty()) |
|
Lines 488-494
Link Here
|
| 488 |
|
677 |
|
| 489 |
QStringList list; |
678 |
QStringList list; |
| 490 |
if( !hasKey( pKey ) ) |
679 |
if( !hasKey( pKey ) ) |
|
|
680 |
{ |
| 491 |
return list; |
681 |
return list; |
|
|
682 |
} |
| 492 |
QString str_list = readEntry( pKey ); |
683 |
QString str_list = readEntry( pKey ); |
| 493 |
if( str_list.isEmpty() ) |
684 |
if( str_list.isEmpty() ) |
| 494 |
return list; |
685 |
return list; |
|
Lines 520-525
Link Here
|
| 520 |
value.squeeze(); |
711 |
value.squeeze(); |
| 521 |
list.append( value ); |
712 |
list.append( value ); |
| 522 |
} |
713 |
} |
|
|
714 |
dumpConfig( pKey, list.join( "," ), "List" ); |
| 523 |
return list; |
715 |
return list; |
| 524 |
} |
716 |
} |
| 525 |
|
717 |
|
|
Lines 527-533
Link Here
|
| 527 |
char sep ) const |
719 |
char sep ) const |
| 528 |
{ |
720 |
{ |
| 529 |
if ( !hasKey( pKey ) ) |
721 |
if ( !hasKey( pKey ) ) |
|
|
722 |
{ |
| 530 |
return aDefault; |
723 |
return aDefault; |
|
|
724 |
} |
| 531 |
else |
725 |
else |
| 532 |
return readListEntry( pKey, sep ); |
726 |
return readListEntry( pKey, sep ); |
| 533 |
} |
727 |
} |
|
Lines 540-545
Link Here
|
| 540 |
QValueList<int> KConfigBase::readIntListEntry( const char *pKey ) const |
734 |
QValueList<int> KConfigBase::readIntListEntry( const char *pKey ) const |
| 541 |
{ |
735 |
{ |
| 542 |
QStringList strlist = readListEntry(pKey); |
736 |
QStringList strlist = readListEntry(pKey); |
|
|
737 |
dumpConfig( pKey, strlist.join( "," ), "IntList" ); |
| 738 |
|
| 543 |
QValueList<int> list; |
739 |
QValueList<int> list; |
| 544 |
QStringList::ConstIterator end(strlist.end()); |
740 |
QStringList::ConstIterator end(strlist.end()); |
| 545 |
for (QStringList::ConstIterator it = strlist.begin(); it != end; ++it) |
741 |
for (QStringList::ConstIterator it = strlist.begin(); it != end; ++it) |
|
Lines 560-565
Link Here
|
| 560 |
const bool bExpandSave = bExpand; |
756 |
const bool bExpandSave = bExpand; |
| 561 |
bExpand = true; |
757 |
bExpand = true; |
| 562 |
QString aValue = readEntry( pKey, pDefault ); |
758 |
QString aValue = readEntry( pKey, pDefault ); |
|
|
759 |
dumpConfig( pKey, aValue, "Path" ); |
| 563 |
bExpand = bExpandSave; |
760 |
bExpand = bExpandSave; |
| 564 |
return aValue; |
761 |
return aValue; |
| 565 |
} |
762 |
} |
|
Lines 574-579
Link Here
|
| 574 |
const bool bExpandSave = bExpand; |
771 |
const bool bExpandSave = bExpand; |
| 575 |
bExpand = true; |
772 |
bExpand = true; |
| 576 |
QStringList aValue = readListEntry( pKey, sep ); |
773 |
QStringList aValue = readListEntry( pKey, sep ); |
|
|
774 |
|
| 775 |
dumpConfig( pKey, aValue.join( "," ), "PathList" ); |
| 577 |
bExpand = bExpandSave; |
776 |
bExpand = bExpandSave; |
| 578 |
return aValue; |
777 |
return aValue; |
| 579 |
} |
778 |
} |
|
Lines 585-590
Link Here
|
| 585 |
|
784 |
|
| 586 |
int KConfigBase::readNumEntry( const char *pKey, int nDefault) const |
785 |
int KConfigBase::readNumEntry( const char *pKey, int nDefault) const |
| 587 |
{ |
786 |
{ |
|
|
787 |
dumpConfig( pKey, QString::number( nDefault ), "Num" ); |
| 588 |
QCString aValue = readEntryUtf8( pKey ); |
788 |
QCString aValue = readEntryUtf8( pKey ); |
| 589 |
if( aValue.isNull() ) |
789 |
if( aValue.isNull() ) |
| 590 |
return nDefault; |
790 |
return nDefault; |
|
Lines 606-611
Link Here
|
| 606 |
|
806 |
|
| 607 |
unsigned int KConfigBase::readUnsignedNumEntry( const char *pKey, unsigned int nDefault) const |
807 |
unsigned int KConfigBase::readUnsignedNumEntry( const char *pKey, unsigned int nDefault) const |
| 608 |
{ |
808 |
{ |
|
|
809 |
dumpConfig( pKey, QString::number( nDefault ), "UnsignedNum" ); |
| 609 |
QCString aValue = readEntryUtf8( pKey ); |
810 |
QCString aValue = readEntryUtf8( pKey ); |
| 610 |
if( aValue.isNull() ) |
811 |
if( aValue.isNull() ) |
| 611 |
return nDefault; |
812 |
return nDefault; |
|
Lines 625-630
Link Here
|
| 625 |
|
826 |
|
| 626 |
long KConfigBase::readLongNumEntry( const char *pKey, long nDefault) const |
827 |
long KConfigBase::readLongNumEntry( const char *pKey, long nDefault) const |
| 627 |
{ |
828 |
{ |
|
|
829 |
dumpConfig( pKey, QString::number( nDefault ), "LongNum" ); |
| 628 |
QCString aValue = readEntryUtf8( pKey ); |
830 |
QCString aValue = readEntryUtf8( pKey ); |
| 629 |
if( aValue.isNull() ) |
831 |
if( aValue.isNull() ) |
| 630 |
return nDefault; |
832 |
return nDefault; |
|
Lines 644-649
Link Here
|
| 644 |
|
846 |
|
| 645 |
unsigned long KConfigBase::readUnsignedLongNumEntry( const char *pKey, unsigned long nDefault) const |
847 |
unsigned long KConfigBase::readUnsignedLongNumEntry( const char *pKey, unsigned long nDefault) const |
| 646 |
{ |
848 |
{ |
|
|
849 |
dumpConfig( pKey, QString::number( nDefault ), "UnsignedLongNum" ); |
| 647 |
QCString aValue = readEntryUtf8( pKey ); |
850 |
QCString aValue = readEntryUtf8( pKey ); |
| 648 |
if( aValue.isNull() ) |
851 |
if( aValue.isNull() ) |
| 649 |
return nDefault; |
852 |
return nDefault; |
|
Lines 662-667
Link Here
|
| 662 |
|
865 |
|
| 663 |
Q_INT64 KConfigBase::readNum64Entry( const char *pKey, Q_INT64 nDefault) const |
866 |
Q_INT64 KConfigBase::readNum64Entry( const char *pKey, Q_INT64 nDefault) const |
| 664 |
{ |
867 |
{ |
|
|
868 |
dumpConfig( pKey, QString::number( nDefault ), "Num64" ); |
| 665 |
// Note that QCString::toLongLong() is missing, we muse use a QString instead. |
869 |
// Note that QCString::toLongLong() is missing, we muse use a QString instead. |
| 666 |
QString aValue = readEntry( pKey ); |
870 |
QString aValue = readEntry( pKey ); |
| 667 |
if( aValue.isNull() ) |
871 |
if( aValue.isNull() ) |
|
Lines 682-687
Link Here
|
| 682 |
|
886 |
|
| 683 |
Q_UINT64 KConfigBase::readUnsignedNum64Entry( const char *pKey, Q_UINT64 nDefault) const |
887 |
Q_UINT64 KConfigBase::readUnsignedNum64Entry( const char *pKey, Q_UINT64 nDefault) const |
| 684 |
{ |
888 |
{ |
|
|
889 |
dumpConfig( pKey, QString::number( nDefault ), "UnsignedNum64" ); |
| 685 |
// Note that QCString::toULongLong() is missing, we muse use a QString instead. |
890 |
// Note that QCString::toULongLong() is missing, we muse use a QString instead. |
| 686 |
QString aValue = readEntry( pKey ); |
891 |
QString aValue = readEntry( pKey ); |
| 687 |
if( aValue.isNull() ) |
892 |
if( aValue.isNull() ) |
|
Lines 701-706
Link Here
|
| 701 |
|
906 |
|
| 702 |
double KConfigBase::readDoubleNumEntry( const char *pKey, double nDefault) const |
907 |
double KConfigBase::readDoubleNumEntry( const char *pKey, double nDefault) const |
| 703 |
{ |
908 |
{ |
|
|
909 |
dumpConfig( pKey, QString::number( nDefault ), "Double" ); |
| 910 |
|
| 704 |
QCString aValue = readEntryUtf8( pKey ); |
911 |
QCString aValue = readEntryUtf8( pKey ); |
| 705 |
if( aValue.isNull() ) |
912 |
if( aValue.isNull() ) |
| 706 |
return nDefault; |
913 |
return nDefault; |
|
Lines 720-725
Link Here
|
| 720 |
|
927 |
|
| 721 |
bool KConfigBase::readBoolEntry( const char *pKey, bool bDefault ) const |
928 |
bool KConfigBase::readBoolEntry( const char *pKey, bool bDefault ) const |
| 722 |
{ |
929 |
{ |
|
|
930 |
dumpConfig( pKey, QString::number( bDefault ), "Bool" ); |
| 931 |
|
| 723 |
QCString aValue = readEntryUtf8( pKey ); |
932 |
QCString aValue = readEntryUtf8( pKey ); |
| 724 |
|
933 |
|
| 725 |
if( aValue.isNull() ) |
934 |
if( aValue.isNull() ) |
|
Lines 747-752
Link Here
|
| 747 |
|
956 |
|
| 748 |
QFont KConfigBase::readFontEntry( const char *pKey, const QFont* pDefault ) const |
957 |
QFont KConfigBase::readFontEntry( const char *pKey, const QFont* pDefault ) const |
| 749 |
{ |
958 |
{ |
|
|
959 |
if ( pDefault ) |
| 960 |
dumpConfig( pKey, pDefault->toString(), "Font" ); |
| 961 |
else |
| 962 |
dumpConfig( pKey, "", "Font" ); |
| 963 |
|
| 750 |
QFont aRetFont; |
964 |
QFont aRetFont; |
| 751 |
|
965 |
|
| 752 |
QString aValue = readEntry( pKey ); |
966 |
QString aValue = readEntry( pKey ); |
|
Lines 844-850
Link Here
|
| 844 |
|
1058 |
|
| 845 |
QRect KConfigBase::readRectEntry( const char *pKey, const QRect* pDefault ) const |
1059 |
QRect KConfigBase::readRectEntry( const char *pKey, const QRect* pDefault ) const |
| 846 |
{ |
1060 |
{ |
| 847 |
QCString aValue = readEntryUtf8(pKey); |
1061 |
if ( pDefault ) |
|
|
1062 |
dumpConfig( pKey, QString::number( pDefault->left() ) + "," + |
| 1063 |
QString::number( pDefault->top() ) + "," + |
| 1064 |
QString::number( pDefault->right() ) + "," + |
| 1065 |
QString::number( pDefault->bottom() ), |
| 1066 |
"Rect" ); |
| 1067 |
else |
| 1068 |
dumpConfig( pKey, "", "Rect" ); |
| 1069 |
|
| 1070 |
QCString aValue = readEntryUtf8(pKey); |
| 848 |
|
1071 |
|
| 849 |
if (!aValue.isEmpty()) |
1072 |
if (!aValue.isEmpty()) |
| 850 |
{ |
1073 |
{ |
|
Lines 870-875
Link Here
|
| 870 |
QPoint KConfigBase::readPointEntry( const char *pKey, |
1093 |
QPoint KConfigBase::readPointEntry( const char *pKey, |
| 871 |
const QPoint* pDefault ) const |
1094 |
const QPoint* pDefault ) const |
| 872 |
{ |
1095 |
{ |
|
|
1096 |
if ( pDefault ) |
| 1097 |
dumpConfig( pKey, QString::number( pDefault->x() ) + "," + QString::number( pDefault->y() ), "Point" ); |
| 1098 |
else |
| 1099 |
dumpConfig( pKey, "", "Point" ); |
| 1100 |
|
| 873 |
QCString aValue = readEntryUtf8(pKey); |
1101 |
QCString aValue = readEntryUtf8(pKey); |
| 874 |
|
1102 |
|
| 875 |
if (!aValue.isEmpty()) |
1103 |
if (!aValue.isEmpty()) |
|
Lines 895-900
Link Here
|
| 895 |
QSize KConfigBase::readSizeEntry( const char *pKey, |
1123 |
QSize KConfigBase::readSizeEntry( const char *pKey, |
| 896 |
const QSize* pDefault ) const |
1124 |
const QSize* pDefault ) const |
| 897 |
{ |
1125 |
{ |
|
|
1126 |
if ( pDefault ) |
| 1127 |
dumpConfig( pKey, QString::number( pDefault->width() ) + "x" + QString::number( pDefault->height() ), "Size" ); |
| 1128 |
else |
| 1129 |
dumpConfig( pKey, "", "Size" ); |
| 898 |
QCString aValue = readEntryUtf8(pKey); |
1130 |
QCString aValue = readEntryUtf8(pKey); |
| 899 |
|
1131 |
|
| 900 |
if (!aValue.isEmpty()) |
1132 |
if (!aValue.isEmpty()) |
|
Lines 914-926
Link Here
|
| 914 |
|
1146 |
|
| 915 |
QColor KConfigBase::readColorEntry( const QString& pKey, |
1147 |
QColor KConfigBase::readColorEntry( const QString& pKey, |
| 916 |
const QColor* pDefault ) const |
1148 |
const QColor* pDefault ) const |
| 917 |
{ |
1149 |
{ |
| 918 |
return readColorEntry(pKey.utf8().data(), pDefault); |
1150 |
return readColorEntry(pKey.utf8().data(), pDefault); |
| 919 |
} |
1151 |
} |
| 920 |
|
1152 |
|
| 921 |
QColor KConfigBase::readColorEntry( const char *pKey, |
1153 |
QColor KConfigBase::readColorEntry( const char *pKey, |
| 922 |
const QColor* pDefault ) const |
1154 |
const QColor* pDefault ) const |
| 923 |
{ |
1155 |
{ |
|
|
1156 |
if ( pDefault ) |
| 1157 |
dumpConfig( pKey, pDefault->name(), "Color" ); |
| 1158 |
else |
| 1159 |
dumpConfig( pKey, "", "Color" ); |
| 924 |
QColor aRetColor; |
1160 |
QColor aRetColor; |
| 925 |
int nRed = 0, nGreen = 0, nBlue = 0; |
1161 |
int nRed = 0, nGreen = 0, nBlue = 0; |
| 926 |
|
1162 |
|
|
Lines 987-992
Link Here
|
| 987 |
QDateTime KConfigBase::readDateTimeEntry( const char *pKey, |
1223 |
QDateTime KConfigBase::readDateTimeEntry( const char *pKey, |
| 988 |
const QDateTime* pDefault ) const |
1224 |
const QDateTime* pDefault ) const |
| 989 |
{ |
1225 |
{ |
|
|
1226 |
if ( pDefault ) |
| 1227 |
dumpConfig( pKey, pDefault->toString(), "DateTime" ); |
| 1228 |
else |
| 1229 |
dumpConfig( pKey, "", "DateTime" ); |
| 1230 |
|
| 990 |
if( !hasKey( pKey ) ) |
1231 |
if( !hasKey( pKey ) ) |
| 991 |
{ |
1232 |
{ |
| 992 |
if( pDefault ) |
1233 |
if( pDefault ) |
|
Lines 1665-1678
Link Here
|
| 1665 |
|
1906 |
|
| 1666 |
void KConfigBase::parseConfigFiles() |
1907 |
void KConfigBase::parseConfigFiles() |
| 1667 |
{ |
1908 |
{ |
|
|
1909 |
|
| 1668 |
if (!bLocaleInitialized && KGlobal::_locale) { |
1910 |
if (!bLocaleInitialized && KGlobal::_locale) { |
| 1669 |
setLocale(); |
1911 |
setLocale(); |
| 1670 |
} |
1912 |
} |
|
|
1913 |
|
| 1914 |
for ( KConfigBackEnd* backend = m_Private->backEnds.first(); |
| 1915 |
backend; |
| 1916 |
backend = m_Private->backEnds.next() ) |
| 1917 |
{ |
| 1918 |
backend->parseConfigFiles(); |
| 1919 |
} |
| 1920 |
|
| 1671 |
if (backEnd) |
1921 |
if (backEnd) |
| 1672 |
{ |
1922 |
{ |
| 1673 |
backEnd->parseConfigFiles(); |
1923 |
bReadOnly = (backEnd->getConfigState() == ReadOnly); |
| 1674 |
bReadOnly = (backEnd->getConfigState() == ReadOnly); |
|
|
| 1675 |
} |
1924 |
} |
|
|
1925 |
|
| 1676 |
} |
1926 |
} |
| 1677 |
|
1927 |
|
| 1678 |
void KConfigBase::sync() |
1928 |
void KConfigBase::sync() |
|
Lines 1700-1717
Link Here
|
| 1700 |
|
1950 |
|
| 1701 |
void KConfigBase::setReadDefaults(bool b) |
1951 |
void KConfigBase::setReadDefaults(bool b) |
| 1702 |
{ |
1952 |
{ |
| 1703 |
if (!d) |
1953 |
m_Private->readDefaults = b; |
| 1704 |
{ |
|
|
| 1705 |
if (!b) return; |
| 1706 |
d = new KConfigBasePrivate(); |
| 1707 |
} |
| 1708 |
|
| 1709 |
d->readDefaults = b; |
| 1710 |
} |
1954 |
} |
| 1711 |
|
1955 |
|
| 1712 |
bool KConfigBase::readDefaults() const |
1956 |
bool KConfigBase::readDefaults() const |
| 1713 |
{ |
1957 |
{ |
| 1714 |
return (d && d->readDefaults); |
1958 |
return (m_Private && m_Private->readDefaults); |
| 1715 |
} |
1959 |
} |
| 1716 |
|
1960 |
|
| 1717 |
void KConfigBase::revertToDefault(const QString &key) |
1961 |
void KConfigBase::revertToDefault(const QString &key) |