aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-15 21:33:05 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-09 12:41:57 -0700
commitca911e6916a5598c7558cabc2f695fceee3d5143 (patch)
tree0cc1a5613d70a12003194141cb7eae17f98b5f41 /mobile-widgets/qmlmanager.cpp
parent0f390183e21095e29c75b60fb0f74d8f85d232cb (diff)
downloadsubsurface-ca911e6916a5598c7558cabc2f695fceee3d5143.tar.gz
mobile: correctly reset model instead of disconnecting it
This is a much better workaround for the invalid accesses to the underlying data while transitioning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index f12f78895..6243bc3ea 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -300,6 +300,7 @@ void QMLManager::applicationStateChanged(Qt::ApplicationState state)
void QMLManager::openLocalThenRemote(QString url)
{
DiveListModel::instance()->clear();
+ MobileListModel::instance()->resetModel();
setNotificationText(tr("Open local dive data file"));
QByteArray fileNamePrt = QFile::encodeName(url);
/* if this is a cloud storage repo and we have no local cache (i.e., it's the first time
@@ -337,6 +338,7 @@ void QMLManager::openLocalThenRemote(QString url)
qPrefPartialPressureGas::set_po2(git_prefs.pp_graphs.po2);
process_loaded_dives();
DiveListModel::instance()->reload();
+ MobileListModel::instance()->resetModel();
appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(dive_table.nr));
setNotificationText(tr("%1 dives loaded from local dive data file").arg(dive_table.nr));
}
@@ -560,6 +562,7 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
manager()->clearAccessCache(); // remove any chached credentials
clear_git_id(); // invalidate our remembered GIT SHA
DiveListModel::instance()->reload();
+ MobileListModel::instance()->resetModel();
GpsListModel::instance()->clear();
setStartPageText(tr("Attempting to open cloud storage with new credentials"));
// we therefore know that no one else is already accessing THIS git repo;