Skip to content

Commit 3874b10

Browse files
committed
fix overriding of locale in options
1 parent d1cb3f3 commit 3874b10

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/app/qgsoptions.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,12 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
417417
foreach( QString l, myI18nList )
418418
{
419419
#if QT_VERSION >= 0x040800
420-
cboLocale->addItem( QIcon( QString( ":/images/flags/%1.png" ).arg( l ) ), QLocale( l ).nativeLanguageName() );
420+
cboLocale->addItem( QIcon( QString( ":/images/flags/%1.png" ).arg( l ) ), QLocale( l ).nativeLanguageName(), l );
421421
#else
422-
cboLocale->addItem( QIcon( QString( ":/images/flags/%1.png" ).arg( l ) ), l );
422+
cboLocale->addItem( QIcon( QString( ":/images/flags/%1.png" ).arg( l ) ), l, l );
423423
#endif
424424
}
425-
if ( myI18nList.contains( myUserLocale ) )
426-
{
427-
cboLocale->setCurrentIndex( myI18nList.indexOf( myUserLocale ) );
428-
}
425+
cboLocale->setCurrentIndex( cboLocale->findData( myUserLocale ) );
429426
bool myLocaleOverrideFlag = settings.value( "locale/overrideFlag", false ).toBool();
430427
grpLocale->setChecked( myLocaleOverrideFlag );
431428

@@ -909,7 +906,7 @@ void QgsOptions::saveOptions()
909906
//
910907
// Locale settings
911908
//
912-
settings.setValue( "locale/userLocale", cboLocale->currentText() );
909+
settings.setValue( "locale/userLocale", cboLocale->itemData( cboLocale->currentIndex() ).toString() );
913910
settings.setValue( "locale/overrideFlag", grpLocale->isChecked() );
914911

915912

0 commit comments

Comments
 (0)