on xenial help sign in
detect country code from SIM, fix selecting the existing locale
commit2e9d5819a6f70ecf8902c9b04d53f5290935153f authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 2 Sep 2015, 12:55 (11 years ago) parent031c98f
2 files changed+5−6
qml/Wizard/Pages/10-language.qml+5−5 tests/mocks/Wizard/MockSystem.cpp−1
qml/Wizard/Pages/10-language.qml+5−5
@@ -49,14 +49,14 @@ LocalComponents.Page {
4949 var detectedLang = "";
5050 // try to detect the language from the SIM card
5151 if (simManager0.present && simManager0.preferredLanguages.length > 0) {
52− detectedLang = simManager0.preferredLanguages[0];
52+ detectedLang = simManager0.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(simManager0.mobileCountryCode);
5353 print("SIM 0 detected lang:", detectedLang);
5454 } else if (simManager1.present && simManager1.preferredLanguages.length > 0) {
55− detectedLang = simManager1.preferredLanguages[0];
55+ detectedLang = simManager1.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(simManager1.mobileCountryCode);
5656 print("SIM 1 detected lang:", detectedLang);
5757 } else if (plugin.currentLanguage != -1) {
58− detectedLang = plugin.currentLanguage;
59− print("Using current language", plugin.currentLanguage, "as default");
58+ detectedLang = plugin.languageCodes[plugin.currentLanguage];
59+ print("Using current language", detectedLang, "as default");
6060 } else {
6161 print("No lang detected, falling back to default (en_US)");
6262 detectedLang = "en_US"; // fallback to default lang
@@ -81,7 +81,7 @@ LocalComponents.Page {
8181 id: languagesListView
8282 boundsBehavior: Flickable.StopAtBounds
8383 clip: true
84− currentIndex: -1
84+ currentIndex: plugin.currentLanguage
8585 snapMode: ListView.SnapToItem
8686
8787 anchors {
tests/mocks/Wizard/MockSystem.cpp−1
@@ -37,6 +37,5 @@ void MockSystem::setWizardEnabled(bool enabled)
3737
3838void MockSystem::updateSessionLocale(const QString &locale)
3939{
40− qDebug() << Q_FUNC_INFO << locale;
4140 Q_EMIT updateSessionLocaleCalled(locale);
4241}