summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-22 07:08:23 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-27 15:05:37 -0700
commit7c156f3ba1c1b2129453836f9c99de97621acb2b (patch)
treeda21247620665e8a964bccb4f5181b1c268932e0 /mobile-widgets
parent9ba090c31fd87bdec71c4e14cae3d71c4bb07eac (diff)
downloadsubsurface-7c156f3ba1c1b2129453836f9c99de97621acb2b.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlmanager.cpp17
1 files changed, 16 insertions, 1 deletions
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;