summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-27 06:14:13 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-27 15:05:37 -0700
commit9ca0f7334b241fca133e7c2e22242c77d3071833 (patch)
tree9f032c9865990f88affca2ef817621b1c8ac2b97 /mobile-widgets
parent93d21ceac74f7c6fdb5f025e9b65db420fdd5ce8 (diff)
downloadsubsurface-9ca0f7334b241fca133e7c2e22242c77d3071833.tar.gz
QML UI: handle failure to read local dive data
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlmanager.cpp14
1 files changed, 11 insertions, 3 deletions
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"));