mobile-widgets: remove m_cloudCredentialStatus in qmlpref

Remove m_credentialStatus in qmlpref, but let the setter/getter
stay, using qPrefCloudStorage::cloud_verification_status()
instead.

This change ensures that qmlPrefs:credentialStatus() returns the
same as qPrefCloudStorage::cloud_verification_status(), and the
setter/getter of credentialStatus can later be removed safely.

This is a "checkpoint" to ensure everything works without a temporary
credentialStatus. No code part depend on the difference between
qmlPrefs::credentialStatus() and
qPrefCloudStorage::cloud_verification_status(), but the code reference
both.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
jan Iversen 2019-12-28 17:11:17 +01:00 committed by Dirk Hohndel
parent b7730d3813
commit beacc00f2d
2 changed files with 5 additions and 7 deletions

View file

@ -11,7 +11,6 @@
QMLPrefs *QMLPrefs::m_instance = NULL;
QMLPrefs::QMLPrefs() :
m_credentialStatus(qPrefCloudStorage::CS_UNKNOWN),
m_oldStatus(qPrefCloudStorage::CS_UNKNOWN),
m_showPin(false)
{
@ -36,13 +35,13 @@ QMLPrefs *QMLPrefs::instance()
qPrefCloudStorage::cloud_status QMLPrefs::credentialStatus() const
{
return m_credentialStatus;
return (qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status();
}
void QMLPrefs::setCredentialStatus(const qPrefCloudStorage::cloud_status value)
{
if (m_credentialStatus != value) {
setOldStatus(m_credentialStatus);
if ((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status() != value) {
setOldStatus((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status());
if (value == qPrefCloudStorage::CS_NOCLOUD) {
QMLManager::instance()->appendTextToLog("Switching to no cloud mode");
set_filename(NOCLOUD_LOCALSTORAGE);
@ -53,7 +52,7 @@ void QMLPrefs::setCredentialStatus(const qPrefCloudStorage::cloud_status value)
else if (qPrefUnits::unit_system() == "metric")
prefs.units = SI_units;
}
m_credentialStatus = value;
qPrefCloudStorage::set_cloud_verification_status(value);
emit credentialStatusChanged();
}
}

View file

@ -10,7 +10,7 @@
class QMLPrefs : public QObject {
Q_OBJECT
Q_PROPERTY(qPrefCloudStorage::cloud_status credentialStatus
MEMBER m_credentialStatus
READ credentialStatus
WRITE setCredentialStatus
NOTIFY credentialStatusChanged)
Q_PROPERTY(bool showPin
@ -37,7 +37,6 @@ public:
void setShowPin(bool enable);
private:
qPrefCloudStorage::cloud_status m_credentialStatus;
static QMLPrefs *m_instance;
qPrefCloudStorage::cloud_status m_oldStatus;
bool m_showPin;