summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-14 11:48:04 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-14 11:49:25 -0700
commit67742856b2d8b3659505fd094cd0c6b86785da26 (patch)
tree40d636bce1b1f9b3c910274623bc3f946b1ba087 /mobile-widgets/qmlmanager.cpp
parent95292ac560bac1365f022ba85b19520ce787ca5b (diff)
downloadsubsurface-67742856b2d8b3659505fd094cd0c6b86785da26.tar.gz
QML UI: don't try to scroll to dive at time 0
If no timestamp is available, just start at dive 0. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 51a06f0a6..2303af3e5 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -74,7 +74,9 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
deletedTrip(0),
m_credentialStatus(UNKNOWN),
m_lastDevicePixelRatio(1.0),
- alreadySaving(false)
+ alreadySaving(false),
+ m_selectedDiveTimestamp(0),
+ m_updateSelectedDive(-1)
{
m_instance = this;
connect(qobject_cast<QApplication *>(QApplication::instance()), &QApplication::applicationStateChanged, this, &QMLManager::applicationStateChanged);
@@ -416,7 +418,10 @@ void QMLManager::loadDivesWithValidCredentials()
DiveListModel::instance()->clear();
process_dives(false, false);
DiveListModel::instance()->addAllDives();
- setUpdateSelectedDive(dlSortModel->getIdxForId(get_dive_id_closest_to(currentDiveTimestamp)));
+ if (currentDiveTimestamp)
+ setUpdateSelectedDive(dlSortModel->getIdxForId(get_dive_id_closest_to(currentDiveTimestamp)));
+ else
+ setUpdateSelectedDive(0);
appendTextToLog(QStringLiteral("%1 dives loaded").arg(dive_table.nr));
if (dive_table.nr == 0)
setStartPageText(tr("Cloud storage open successfully. No dives in dive list."));