From 9ca0f7334b241fca133e7c2e22242c77d3071833 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 27 Apr 2016 06:14:13 -0700 Subject: QML UI: handle failure to read local dive data Signed-off-by: Dirk Hohndel --- mobile-widgets/qmlmanager.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 301dd22dc..2149d5c86 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -182,9 +182,17 @@ void QMLManager::finishSetup() } else if (!same_string(existing_filename, "")) { setCredentialStatus(NOCLOUD); appendTextToLog(tr("working in no-cloud mode")); - parse_file(existing_filename); - consumeFinishedLoad(0); - qDebug() << "working in no-cloud mode, finished loading" << dive_table.nr << "dives"; + int error = parse_file(existing_filename); + if (error) { + // we got an error loading the local file + appendTextToLog(QString("got error %2 when parsing file %1").arg(existing_filename, get_error_string())); + set_filename(NULL, ""); + } else { + // successfully opened the local file, now add thigs to the dive list + consumeFinishedLoad(0); + setAccessingCloud(-1); + appendTextToLog(QString("working in no-cloud mode, finished loading %1 dives from %2").arg(dive_table.nr).arg(existing_filename)); + } } else { setCredentialStatus(INCOMPLETE); appendTextToLog(tr("no cloud credentials")); -- cgit v1.2.3-70-g09d2