Mobile: always update the preferences when set_unit_system is called

Unit_system is read from git storage but units are set from locale when the
app starts. To prevent a miss-match between unit and unit_system we have to
always update the preferences variable when set_unit_system is called so that
the user doesn't end up with imperial units when the preferences say metric.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Jocke 2018-09-18 17:22:01 +02:00 committed by Dirk Hohndel
parent 09e7fdc253
commit 148bc8fbf1

View file

@ -53,7 +53,6 @@ void qPrefUnits::set_unit_system(const QString& value)
short int v = value == QStringLiteral("metric") ? METRIC : short int v = value == QStringLiteral("metric") ? METRIC :
value == QStringLiteral("imperial")? IMPERIAL : value == QStringLiteral("imperial")? IMPERIAL :
PERSONALIZE; PERSONALIZE;
if (v != prefs.unit_system) {
if (v == METRIC) { if (v == METRIC) {
prefs.unit_system = METRIC; prefs.unit_system = METRIC;
prefs.units = SI_units; prefs.units = SI_units;
@ -65,7 +64,6 @@ void qPrefUnits::set_unit_system(const QString& value)
} }
disk_unit_system(true); disk_unit_system(true);
emit instance()->unit_systemChanged(value); emit instance()->unit_systemChanged(value);
}
} }
DISK_LOADSYNC_ENUM(Units, "unit_system", unit_system_values, unit_system); DISK_LOADSYNC_ENUM(Units, "unit_system", unit_system_values, unit_system);