From 7c156f3ba1c1b2129453836f9c99de97621acb2b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 22 Apr 2016 07:08:23 -0700 Subject: QML UI: in no cloud mode, save to a default local repo And set that up as the default file to load at start. Signed-off-by: Dirk Hohndel --- mobile-widgets/qmlmanager.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index c2c60ce5c..9aae67f33 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -19,6 +19,7 @@ #include "core/qt-gui.h" #include "core/git-access.h" #include "core/cloudstorage.h" +#include "core/subsurface-qt/SettingsObjectWrapper.h" QMLManager *QMLManager::m_instance = NULL; @@ -794,7 +795,20 @@ void QMLManager::saveChangesLocal() { if (unsaved_changes()) { git_storage_update_progress(true, "saving dives locally"); // reset the timers - if (!loadFromCloud()) { + if (credentialStatus() == NOCLOUD) { + if (same_string(existing_filename, "")) { + QString filename(system_default_directory()); + filename += "/cloudstorage/localrepo"; + if (git_create_local_repo(qPrintable(filename))) + appendTextToLog(get_error_string()); + filename += "[master]"; + set_filename(qPrintable(filename), true); + GeneralSettingsObjectWrapper s(this); + s.setDefaultFilename(filename); + s.setDefaultFileBehavior(LOCAL_DEFAULT_FILE); + qDebug() << "setting default file to" << filename; + } + } else if (!loadFromCloud()) { // this seems silly, but you need a common ancestor in the repository in // order to be able to merge che changes later appendTextToLog("Don't save dives without loading from the cloud, first."); @@ -809,6 +823,7 @@ void QMLManager::saveChangesLocal() prefs.git_local_only = true; if (save_dives(existing_filename)) { appendTextToLog(get_error_string()); + set_filename(NULL, true); setAccessingCloud(-1); prefs.git_local_only = glo; alreadySaving = false; -- cgit v1.2.3-70-g09d2