author | ulf69 <ulf69> | 2004-09-15 17:48:36 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-15 17:48:36 (UTC) |
commit | 0af70ae5fee7b71aecf5ac742fdd65e31237eb5a (patch) (unidiff) | |
tree | 08a51756744591056fd74f3658afe940f5823265 /microkde/kconfig.cpp | |
parent | c151151ccaffe54510e58731dc6d8f9d441bd31c (diff) | |
download | kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.zip kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.gz kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.bz2 |
small changes to accommodate pwManager
-rw-r--r-- | microkde/kconfig.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp index 4cbec94..ba41f6c 100644 --- a/microkde/kconfig.cpp +++ b/microkde/kconfig.cpp | |||
@@ -96,32 +96,51 @@ int KConfig::readNumEntry( const QString & key, int def ) | |||
96 | if ( ok ) | 96 | if ( ok ) |
97 | return result; | 97 | return result; |
98 | return def; | 98 | return def; |
99 | } | 99 | } |
100 | 100 | ||
101 | QString KConfig::readEntry( const QString &key, const QString &def ) | 101 | QString KConfig::readEntry( const QString &key, const QString &def ) |
102 | { | 102 | { |
103 | QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); | 103 | QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); |
104 | 104 | ||
105 | if ( it == mStringMap.end() ) { | 105 | if ( it == mStringMap.end() ) { |
106 | return def; | 106 | return def; |
107 | } | 107 | } |
108 | 108 | ||
109 | return *it; | 109 | return *it; |
110 | } | 110 | } |
111 | 111 | ||
112 | QSize KConfig::readSizeEntry( const QString &key, QSize* def ) | ||
113 | { | ||
114 | QValueList<int> intlist = readIntListEntry(key); | ||
115 | |||
116 | if (intlist.count() < 2) | ||
117 | { | ||
118 | if (def) | ||
119 | return *def; | ||
120 | else | ||
121 | return QSize(); | ||
122 | } | ||
123 | |||
124 | QSize ret; | ||
125 | ret.setWidth(intlist[0]); | ||
126 | ret.setHeight(intlist[1]); | ||
127 | |||
128 | return ret; | ||
129 | } | ||
130 | |||
112 | QStringList KConfig::readListEntry( const QString &key ) | 131 | QStringList KConfig::readListEntry( const QString &key ) |
113 | { | 132 | { |
114 | QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); | 133 | QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); |
115 | 134 | ||
116 | if ( it == mStringMap.end() ) { | 135 | if ( it == mStringMap.end() ) { |
117 | return QStringList(); | 136 | return QStringList(); |
118 | } | 137 | } |
119 | return QStringList::split(":", *it ); | 138 | return QStringList::split(":", *it ); |
120 | 139 | ||
121 | } | 140 | } |
122 | 141 | ||
123 | bool KConfig::readBoolEntry( const QString &key, bool def ) | 142 | bool KConfig::readBoolEntry( const QString &key, bool def ) |
124 | { | 143 | { |
125 | QMap<QString,bool>::ConstIterator it = mBoolMap.find( mGroup + key ); | 144 | QMap<QString,bool>::ConstIterator it = mBoolMap.find( mGroup + key ); |
126 | 145 | ||
127 | if ( it == mBoolMap.end() ) { | 146 | if ( it == mBoolMap.end() ) { |
@@ -209,32 +228,39 @@ void KConfig::writeEntry( const QString &key, const QStringList &value ) | |||
209 | void KConfig::writeEntry( const QString &key, bool value) | 228 | void KConfig::writeEntry( const QString &key, bool value) |
210 | { | 229 | { |
211 | mBoolMap.insert( mGroup + key, value ); | 230 | mBoolMap.insert( mGroup + key, value ); |
212 | 231 | ||
213 | mDirty = true; | 232 | mDirty = true; |
214 | } | 233 | } |
215 | 234 | ||
216 | void KConfig::writeEntry( const QString & e, const QColor & c ) | 235 | void KConfig::writeEntry( const QString & e, const QColor & c ) |
217 | { | 236 | { |
218 | QStringList l; | 237 | QStringList l; |
219 | l.append( QString::number ( c.red() ) ); | 238 | l.append( QString::number ( c.red() ) ); |
220 | l.append( QString::number ( c.green() ) ); | 239 | l.append( QString::number ( c.green() ) ); |
221 | l.append( QString::number ( c.blue() ) ); | 240 | l.append( QString::number ( c.blue() ) ); |
222 | writeEntry( e, l ); | 241 | writeEntry( e, l ); |
223 | } | 242 | } |
224 | 243 | ||
244 | void KConfig::writeEntry( const QString & e, const QSize & s ) | ||
245 | { | ||
246 | QValueList<int> intlist; | ||
247 | intlist << s.width() << s.height(); | ||
248 | writeEntry( e, intlist ); | ||
249 | } | ||
250 | |||
225 | void KConfig::writeEntry( const QString & e , const QFont & f ) | 251 | void KConfig::writeEntry( const QString & e , const QFont & f ) |
226 | { | 252 | { |
227 | QStringList font; | 253 | QStringList font; |
228 | font.append( f.family()); | 254 | font.append( f.family()); |
229 | font.append( (!f.bold ()?"nonbold":"bold") ); | 255 | font.append( (!f.bold ()?"nonbold":"bold") ); |
230 | font.append( QString::number ( f.pointSize () ) ); | 256 | font.append( QString::number ( f.pointSize () ) ); |
231 | font.append( !f.italic ()?"nonitalic":"italic" ); | 257 | font.append( !f.italic ()?"nonitalic":"italic" ); |
232 | writeEntry( e, font ); | 258 | writeEntry( e, font ); |
233 | } | 259 | } |
234 | 260 | ||
235 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) | 261 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) |
236 | { | 262 | { |
237 | mDateTimeMap.insert( mGroup + key, dt ); | 263 | mDateTimeMap.insert( mGroup + key, dt ); |
238 | } | 264 | } |
239 | 265 | ||
240 | void KConfig::load() | 266 | void KConfig::load() |