Skip to content

Commit f0d2f6d

Browse files
committed
QgsSettings: pass all keys through the sanitizer (and lower())
1 parent d50930c commit f0d2f6d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/core/qgssettings.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ QgsSettings::~QgsSettings()
8484

8585
void QgsSettings::beginGroup( const QString &prefix )
8686
{
87-
mUserSettings->beginGroup( prefix.toLower() );
87+
mUserSettings->beginGroup( sanitizeKey( prefix ) );
8888
if ( mGlobalSettings )
8989
{
90-
mGlobalSettings->beginGroup( prefix.toLower() );
90+
mGlobalSettings->beginGroup( sanitizeKey( prefix ) );
9191
}
9292
}
9393

@@ -152,7 +152,7 @@ QStringList QgsSettings::childGroups() const
152152

153153
QVariant QgsSettings::value( const QString &key, const QVariant &defaultValue, const QgsSettings::Section section ) const
154154
{
155-
QString pKey = prefixedKey( key.toLower(), section );
155+
QString pKey = prefixedKey( key, section );
156156
if ( !mUserSettings->value( pKey ).isNull() )
157157
{
158158
return mUserSettings->value( pKey );
@@ -166,7 +166,7 @@ QVariant QgsSettings::value( const QString &key, const QVariant &defaultValue, c
166166

167167
bool QgsSettings::contains( const QString &key, const QgsSettings::Section section ) const
168168
{
169-
QString pKey = prefixedKey( key.toLower(), section );
169+
QString pKey = prefixedKey( key, section );
170170
return mUserSettings->contains( pKey ) ||
171171
( mGlobalSettings && mGlobalSettings->contains( pKey ) );
172172
}
@@ -183,7 +183,7 @@ void QgsSettings::sync()
183183

184184
void QgsSettings::remove( const QString &key )
185185
{
186-
mUserSettings->remove( key.toLower() );
186+
mUserSettings->remove( sanitizeKey( key ) );
187187
}
188188

189189
QString QgsSettings::prefixedKey( const QString &key, const Section section ) const
@@ -208,18 +208,18 @@ QString QgsSettings::prefixedKey( const QString &key, const Section section ) co
208208
break;
209209
case Section::NoSection:
210210
default:
211-
return sanitizeKey( key.toLower() );
211+
return sanitizeKey( key );
212212
}
213-
return prefix + "/" + sanitizeKey( key.toLower() );
213+
return prefix + "/" + sanitizeKey( key );
214214
}
215215

216216

217217
int QgsSettings::beginReadArray( const QString &prefix )
218218
{
219-
int size = mUserSettings->beginReadArray( prefix.toLower() );
219+
int size = mUserSettings->beginReadArray( sanitizeKey( prefix ) );
220220
if ( 0 == size && mGlobalSettings )
221221
{
222-
size = mGlobalSettings->beginReadArray( prefix.toLower() );
222+
size = mGlobalSettings->beginReadArray( sanitizeKey( prefix ) );
223223
mUsingGlobalArray = ( size > 0 );
224224
}
225225
return size;
@@ -250,7 +250,7 @@ void QgsSettings::setArrayIndex( int i )
250250
void QgsSettings::setValue( const QString &key, const QVariant &value, const QgsSettings::Section section )
251251
{
252252
// TODO: add valueChanged signal
253-
mUserSettings->setValue( prefixedKey( key.toLower(), section ), value );
253+
mUserSettings->setValue( prefixedKey( key, section ), value );
254254
}
255255

256256
// To lower case and clean the path

0 commit comments

Comments
 (0)