From 67742856b2d8b3659505fd094cd0c6b86785da26 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 14 Apr 2016 11:48:04 -0700 Subject: 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 --- mobile-widgets/qmlmanager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mobile-widgets/qmlmanager.cpp') 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::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.")); -- cgit v1.2.3-70-g09d2