summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-30 06:51:26 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-30 09:46:29 -0700
commit05a51f7984e62a8eaf02a8b8dc7269325fb26d9b (patch)
treeff0ea1af15d452b4830b6e8de0db8dab1d684ce4 /mobile-widgets/qmlmanager.cpp
parent78d420ac322507596f010fc639924f052c14ed82 (diff)
downloadsubsurface-05a51f7984e62a8eaf02a8b8dc7269325fb26d9b.tar.gz
Only create the path to no cloud local storage once
This required a small change to the helper function, but this seemed totally worth it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 8a09dc212..9b3471a7a 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -27,6 +27,8 @@ QMLManager *QMLManager::m_instance = NULL;
#define RED_FONT QLatin1Literal("<font color=\"red\">")
#define END_FONT QLatin1Literal("</font>")
+#define NOCLOUD_LOCALSTORAGE format_string("%s/cloudstorage/localrepo[master]", system_default_directory())
+
static void appendTextToLogStandalone(const char *text)
{
QMLManager *self = QMLManager::instance();
@@ -172,7 +174,7 @@ void QMLManager::openLocalThenRemote(QString url)
void QMLManager::mergeLocalRepo()
{
- char *filename = format_string("%s/cloudstorage/localrepo[master]", system_default_directory());
+ char *filename = NOCLOUD_LOCALSTORAGE;
parse_file(filename);
process_dives(true, false);
}
@@ -479,6 +481,7 @@ void QMLManager::revertToNoCloudIfNeeded()
setCloudUserName("");
setCloudPassword("");
setCredentialStatus(INCOMPLETE);
+ set_filename(NOCLOUD_LOCALSTORAGE, true);
setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT);
}
setAccessingCloud(-1);
@@ -868,12 +871,10 @@ void QMLManager::saveChangesLocal()
git_storage_update_progress(true, "saving dives locally"); // reset the timers
if (credentialStatus() == NOCLOUD) {
if (same_string(existing_filename, "")) {
- QString filename(system_default_directory());
- filename += "/cloudstorage/localrepo";
- if (git_create_local_repo(qPrintable(filename)))
+ char *filename = NOCLOUD_LOCALSTORAGE;
+ if (git_create_local_repo(filename))
appendTextToLog(get_error_string());
- filename += "[master]";
- set_filename(qPrintable(filename), true);
+ set_filename(filename, true);
GeneralSettingsObjectWrapper s(this);
s.setDefaultFilename(filename);
s.setDefaultFileBehavior(LOCAL_DEFAULT_FILE);