[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/kdecore/config
From:       David Faure <faure () kde ! org>
Date:       2008-01-03 11:37:33
Message-ID: 200801031237.34088.faure () kde ! org
[Download RAW message or body]

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).
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic