1.1 --- a/settings.cpp Tue Jun 13 08:49:12 2006 +0000
1.2 +++ b/settings.cpp Wed Aug 30 12:16:25 2006 +0000
1.3 @@ -61,6 +61,7 @@
1.4 qWarning ("SimpleSettings::writeSettings() Couldn't write "+path);
1.5 }
1.6
1.7 +/*
1.8 QString SimpleSettings::readEntry (const QString &key)
1.9 {
1.10 QStringList::Iterator itk=keylist.begin();
1.11 @@ -77,6 +78,46 @@
1.12 qWarning ("SimpleSettings::readEntry() Couldn't find key "+key);
1.13 return "";
1.14 }
1.15 +*/
1.16 +
1.17 +QString SimpleSettings::readEntry (const QString &key, const QString &def)
1.18 +{
1.19 + QStringList::Iterator itk=keylist.begin();
1.20 + QStringList::Iterator itv=valuelist.begin();
1.21 +
1.22 + // First search for value in settings saved in map
1.23 + while (itk !=keylist.end() )
1.24 + {
1.25 + if (*itk == key)
1.26 + return *itv;
1.27 + itk++;
1.28 + itv++;
1.29 + }
1.30 + return def;
1.31 +}
1.32 +
1.33 +int SimpleSettings::readNumEntry (const QString &key, int def)
1.34 +{
1.35 + QStringList::Iterator itk=keylist.begin();
1.36 + QStringList::Iterator itv=valuelist.begin();
1.37 +
1.38 + // First search for value in settings saved in map
1.39 + while (itk !=keylist.end() )
1.40 + {
1.41 + if (*itk == key)
1.42 + {
1.43 + bool ok;
1.44 + int i=(*itv).toInt(&ok,10);
1.45 + if (ok)
1.46 + return i;
1.47 + else
1.48 + return def;
1.49 + }
1.50 + itk++;
1.51 + itv++;
1.52 + }
1.53 + return def;
1.54 +}
1.55
1.56 void SimpleSettings::setEntry (const QString &key, const QString &value)
1.57 {