Mobile: set units system in "No cloud mode"

When starting the app  in "No cloud mode" we need to make sure that the units
and unit_system match.

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-16 15:49:26 +02:00 committed by Dirk Hohndel
parent a63be142b5
commit 5cb31d6adb

View file

@ -4,6 +4,7 @@
#include "core/membuffer.h"
#include "core/gpslocation.h"
#include "core/settings/qPrefUnit.h"
/*** Global and constructors ***/
@ -78,6 +79,10 @@ void QMLPrefs::setCredentialStatus(const qPrefCloudStorage::cloud_status value)
QMLManager::instance()->appendTextToLog("Switching to no cloud mode");
set_filename(NOCLOUD_LOCALSTORAGE);
clearCredentials();
if (qPrefUnits::unit_system() == "imperial")
prefs.units = IMPERIAL_units;
else if (qPrefUnits::unit_system() == "metric")
prefs.units = SI_units;
}
m_credentialStatus = value;
emit credentialStatusChanged();