mobile-widgets: add oldStatus variable to qmlmanager

oldStatus() is kept in qmlPrefs during the login process to allow
for a couple of special cases:
- if a user have added dives in NO_CLOUD mode and changes to use the
  cloud these dives are copied to the Cloud, instead of being lost.
- if a user does a bailout from the login process (this should not
  happen anymore) the old status is restored.

The pure solution would be to have oldStatus at the top level (e.g.
a property in qml) and only change it when actually being in the
login process, however due to way the qmlmanager is written it proved
very difficult and not worth the effort.

In order to be able to remove qmlPrefs, oldStatus are moved to
qmlManager.

This commit only contain the creation of the variable and the supporting
code.

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-29 12:29:05 +01:00 committed by Dirk Hohndel
parent 25e17443f9
commit 3d6d71aa9f
2 changed files with 22 additions and 1 deletions

View file

@ -154,7 +154,8 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
m_selectedDiveTimestamp(0),
alreadySaving(false),
m_pluggedInDeviceName(""),
m_showNonDiveComputers(false)
m_showNonDiveComputers(false),
m_oldStatus(qPrefCloudStorage::CS_UNKNOWN)
{
m_instance = this;
m_lastDevicePixelRatio = qApp->devicePixelRatio();
@ -2196,3 +2197,15 @@ void QMLManager::uploadFinishSlot(bool success, const QString &text, const QByte
emit uploadFinish(success, text);
}
qPrefCloudStorage::cloud_status QMLManager::oldStatus() const
{
return m_oldStatus;
}
void QMLManager::setOldStatus(const qPrefCloudStorage::cloud_status value)
{
if (m_oldStatus != value) {
m_oldStatus = value;
emit oldStatusChanged();
}
}