1.1 --- a/settings.cpp Tue Jan 24 15:09:48 2006 +0000
1.2 +++ b/settings.cpp Tue Sep 05 10:03:29 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 {
1.58 @@ -117,6 +158,11 @@
1.59 clear();
1.60 }
1.61
1.62 +Settings::Settings(const QString & organization, const QString & application ):QSettings (organization,application)
1.63 +{
1.64 + clear();
1.65 +}
1.66 +
1.67 Settings::~Settings()
1.68 {
1.69 }