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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-08-18 15:06:15 +02:00 committed by Dirk Hohndel
parent ecb64d7e3e
commit d815e0c947
15 changed files with 77 additions and 77 deletions

View file

@ -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());