From d815e0c9476ef62e6b84fb28ce48ab7cddefe77e Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 18 Aug 2018 15:06:15 +0200 Subject: Parse: pass dive_table argument to parse_file() To enable undo of divelog-importing it is crucial that parse_file() can parse into arbitrary dive tables. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 093f30eae..eb29061f5 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -255,7 +255,7 @@ void QMLManager::openLocalThenRemote(QString url) QByteArray fileNamePrt = QFile::encodeName(url); bool glo = qPrefCloudStorage::git_local_only(); prefs.git_local_only = true; - int error = parse_file(fileNamePrt.data()); + int error = parse_file(fileNamePrt.data(), &dive_table); qPrefCloudStorage::set_git_local_only(glo); if (error) { appendTextToLog(QStringLiteral("loading dives from cache failed %1").arg(error)); @@ -324,7 +324,7 @@ void QMLManager::updateAllGlobalLists() void QMLManager::mergeLocalRepo() { char *filename = NOCLOUD_LOCALSTORAGE; - parse_file(filename); + parse_file(filename, &dive_table); process_dives(true, false); } @@ -389,7 +389,7 @@ void QMLManager::finishSetup() QMLPrefs::instance()->setCredentialStatus(qPref::CS_NOCLOUD); saveCloudCredentials(); appendTextToLog(tr("working in no-cloud mode")); - int error = parse_file(existing_filename); + int error = parse_file(existing_filename, &dive_table); if (error) { // we got an error loading the local file setNotificationText(tr("Error parsing local storage, giving up")); @@ -678,7 +678,7 @@ void QMLManager::loadDivesWithValidCredentials() error = git_load_dives(git, branch); } else { appendTextToLog(QString("didn't receive valid git repo, try again")); - error = parse_file(fileNamePrt.data()); + error = parse_file(fileNamePrt.data(), &dive_table); } if (!error) { report_error("filename is now %s", fileNamePrt.data()); -- cgit v1.2.3-70-g09d2