on xenial help sign in
prevent unchecking a location method
commit4d8a9d7fd58bcc2266c52ee8a6b90f265ab6a134 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 8 Jul 2015, 13:25 (11 years ago) parentb49aebb
4 files changed+12−7
plugins/Wizard/LocalePlugin.cpp+4−2 plugins/Wizard/timezonemodel.cpp+1−1 qml/Wizard/Pages/15-country.qml+1−1 qml/Wizard/Pages/50-location.qml+6−3
plugins/Wizard/LocalePlugin.cpp+4−2
@@ -43,7 +43,9 @@ QJsonObject LocaleAttached::countriesForLanguage(const QString &code) const
4343 Q_FOREACH(const QLocale &loc, allLocales) {
4444 const QString countryCode = loc.name().section('_', 1, 1);
4545 //qDebug() << "Matching country:" << countryCode;
46− result.insert(countryCode, QLocale::countryToString(loc.country()));
46+ if (!countryCode.isEmpty()) {
47+ result.insert(countryCode, QLocale::countryToString(loc.country()));
48+ }
4749 }
4850 return result;
4951}
@@ -55,7 +57,7 @@ QJsonObject LocaleAttached::countries() const
5557
5658 Q_FOREACH(const QLocale &loc, allLocales) {
5759 const QString countryCode = loc.name().section('_', 1, 1);
58− if (!countryCode.isEmpty() && countryCode.length() == 2) {
60+ if (countryCode.length() == 2) {
5961 result.insert(countryCode, QLocale::countryToString(loc.country()));
6062 }
6163 }
plugins/Wizard/timezonemodel.cpp+1−1
@@ -67,7 +67,7 @@ QVariant TimeZoneModel::data(const QModelIndex &index, int role) const
6767 case Country:
6868 return QLocale::countryToString(tz.country());
6969 case City: {
70− const QString cityName = QString::fromUtf8(tzid.split('/').last().replace("_", " "));
70+ const QString cityName = QString::fromUtf8(tzid.split('/').last().replace("_", " ")); // take the last part, replace _ by a space
7171 return cityName;
7272 }
7373 case Comment:
qml/Wizard/Pages/15-country.qml+1−1
@@ -97,7 +97,7 @@ LocalComponents.Page {
9797 criteria: ViewSection.FullString;
9898 labelPositioning: ViewSection.InlineLabels | ViewSection.CurrentLabelAtStart
9999 delegate: Label {
100− fontSize: "large"
100+ fontSize: "x-large"
101101 }
102102 }
103103
qml/Wizard/Pages/50-location.qml+6−3
@@ -84,7 +84,8 @@ LocalComponents.Page {
8484 MouseArea {
8585 anchors.fill: parent
8686 onClicked: {
87− hereCheckLabel.checked = !hereCheckLabel.checked
87+ if (!hereCheckLabel.checked)
88+ hereCheckLabel.checked = true
8889 }
8990 }
9091 }
@@ -135,7 +136,8 @@ LocalComponents.Page {
135136 MouseArea {
136137 anchors.fill: parent
137138 onClicked: {
138− gpsCheckLabel.checked = !gpsCheckLabel.checked
139+ if (!gpsCheckLabel.checked)
140+ gpsCheckLabel.checked = true
139141 }
140142 }
141143 }
@@ -168,7 +170,8 @@ LocalComponents.Page {
168170 MouseArea {
169171 anchors.fill: parent
170172 onClicked: {
171− nopeCheckLabel.checked = !nopeCheckLabel.checked
173+ if (!nopeCheckLabel.checked)
174+ nopeCheckLabel.checked = true
172175 }
173176 }
174177 }