Skip to content

Commit

Permalink
QgsSettings: pass all keys through the sanitizer (and lower())
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Mar 4, 2017
1 parent d50930c commit f0d2f6d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/core/qgssettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ QgsSettings::~QgsSettings()

void QgsSettings::beginGroup( const QString &prefix )
{
mUserSettings->beginGroup( prefix.toLower() );
mUserSettings->beginGroup( sanitizeKey( prefix ) );
if ( mGlobalSettings )
{
mGlobalSettings->beginGroup( prefix.toLower() );
mGlobalSettings->beginGroup( sanitizeKey( prefix ) );
}
}

Expand Down Expand Up @@ -152,7 +152,7 @@ QStringList QgsSettings::childGroups() const

QVariant QgsSettings::value( const QString &key, const QVariant &defaultValue, const QgsSettings::Section section ) const
{
QString pKey = prefixedKey( key.toLower(), section );
QString pKey = prefixedKey( key, section );
if ( !mUserSettings->value( pKey ).isNull() )
{
return mUserSettings->value( pKey );
Expand All @@ -166,7 +166,7 @@ QVariant QgsSettings::value( const QString &key, const QVariant &defaultValue, c

bool QgsSettings::contains( const QString &key, const QgsSettings::Section section ) const
{
QString pKey = prefixedKey( key.toLower(), section );
QString pKey = prefixedKey( key, section );
return mUserSettings->contains( pKey ) ||
( mGlobalSettings && mGlobalSettings->contains( pKey ) );
}
Expand All @@ -183,7 +183,7 @@ void QgsSettings::sync()

void QgsSettings::remove( const QString &key )
{
mUserSettings->remove( key.toLower() );
mUserSettings->remove( sanitizeKey( key ) );
}

QString QgsSettings::prefixedKey( const QString &key, const Section section ) const
Expand All @@ -208,18 +208,18 @@ QString QgsSettings::prefixedKey( const QString &key, const Section section ) co
break;
case Section::NoSection:
default:
return sanitizeKey( key.toLower() );
return sanitizeKey( key );
}
return prefix + "/" + sanitizeKey( key.toLower() );
return prefix + "/" + sanitizeKey( key );
}


int QgsSettings::beginReadArray( const QString &prefix )
{
int size = mUserSettings->beginReadArray( prefix.toLower() );
int size = mUserSettings->beginReadArray( sanitizeKey( prefix ) );
if ( 0 == size && mGlobalSettings )
{
size = mGlobalSettings->beginReadArray( prefix.toLower() );
size = mGlobalSettings->beginReadArray( sanitizeKey( prefix ) );
mUsingGlobalArray = ( size > 0 );
}
return size;
Expand Down Expand Up @@ -250,7 +250,7 @@ void QgsSettings::setArrayIndex( int i )
void QgsSettings::setValue( const QString &key, const QVariant &value, const QgsSettings::Section section )
{
// TODO: add valueChanged signal
mUserSettings->setValue( prefixedKey( key.toLower(), section ), value );
mUserSettings->setValue( prefixedKey( key, section ), value );
}

// To lower case and clean the path
Expand Down

0 comments on commit f0d2f6d

Please sign in to comment.