Reading of KConfig bool entries with default values does not work

Thomas Braxton kde.braxton at gmail.com
Tue Nov 11 19:34:27 GMT 2008


On Mon, Nov 10, 2008 at 4:34 AM, Oswald Buddenhagen <ossi at kde.org> wrote:
> On Mon, Nov 10, 2008 at 01:09:08AM +0100, Albert Astals Cid wrote:
>> To reproduce you need to have a langauge installed, in my case i'm
>> using ca
>>
> please make a proper kdecore/tests/kconfigtest autotest that runs in any
> locale (and complains if prerequisites are missing). also, is the
> problem really specific to bools?
>
no, only strings are locale-aware. that's the way it was in kde3:
from branches/KDE/3.5/kdelibs/kdecore/kconfigbase.cpp

QCString KConfigBase::readEntryUtf8( const char *pKey) const
{
  // We don't try the localized key
  KEntryKey entryKey(mGroup, 0);
  entryKey.bDefault = readDefaults();
  entryKey.c_key = pKey;
  KEntry aEntryData = lookupData(entryKey);
  if (aEntryData.bExpand)
  {
     // We need to do fancy, take the slow route.
     return readEntry(pKey, QString::null).utf8();
  }
  return aEntryData.mValue;
}

int KConfigBase::readNumEntry( const char *pKey, int nDefault) const
{
  QCString aValue = readEntryUtf8( pKey );
  if( aValue.isNull() )
    return nDefault;
  else if( aValue == "true" || aValue == "on" || aValue == "yes" )
    return 1;
  else
    {
      bool ok;
      int rc = aValue.toInt( &ok );
      return( ok ? rc : nDefault );
    }
}

i made kde4 do basically the same thing.

Thomas




More information about the kde-core-devel mailing list