From kde-commits Thu Jan 03 11:37:33 2008 From: David Faure Date: Thu, 03 Jan 2008 11:37:33 +0000 To: kde-commits Subject: Re: KDE/kdelibs/kdecore/config Message-Id: <200801031237.34088.faure () kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=119936029101872 On Thursday 27 December 2007, Thomas Braxton wrote: > SVN commit 753518 by braxton: > > fix KConfig::entryMap() to return the Localized value if there is one. Can you add a unit test? > --- trunk/KDE/kdelibs/kdecore/config/kconfig.cpp #753517:753518 > @@ -216,9 +216,13 @@ > > for (; it != theEnd && it.key().mGroup == theGroup; ++it) { > // leave the default values and deleted entries out > - if (!it->bDeleted && !it.key().bDefault) > - theMap.insert(QString::fromUtf8(it.key().mKey.constData()), > - QString::fromUtf8(it->mValue.constData())); > + if (!it->bDeleted && !it.key().bDefault) { > + const QString key = QString::fromUtf8(it.key().mKey.constData()); > + // the localized entry should come first, so don't overwrite it > + // with the non-localized entry > + if (!theMap.contains(key)) > + theMap.insert(key,QString::fromUtf8(it->mValue.constData())); The call to contains() seems unnecessary: QMap::insert() says: "If there is already an item with the key key, that item's value is replaced with value." -- David Faure, faure@kde.org, sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).