summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-14 08:32:47 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-14 08:32:47 -0700
commit782d5b36892b720cbe0b6d78310ee3a52094d295 (patch)
treeb3f9c47195e82f1b24bb25f0ec2f6801e7b31524 /main.cpp
parent10b9202757b1db7f34af5f80c6aafe1ef2fcee88 (diff)
downloadsubsurface-782d5b36892b720cbe0b6d78310ee3a52094d295.tar.gz
Make default file behavior work as expected
Subsurface will now start with the no default file, the local default file or cloud storage as chosen in the preferences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index bc7419211..d46e72984 100644
--- a/main.cpp
+++ b/main.cpp
@@ -11,6 +11,7 @@
#include "qt-ui/mainwindow.h"
#include "qt-ui/diveplanner.h"
#include "qt-ui/graphicsview-common.h"
+#include "qthelper.h"
#include <QStringList>
#include <git2.h>
@@ -56,9 +57,15 @@ int main(int argc, char **argv)
taglist_init_global();
init_ui();
if (no_filenames) {
- QString defaultFile(prefs.default_filename);
- if (!defaultFile.isEmpty())
- files.push_back(QString(prefs.default_filename));
+ if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE) {
+ QString defaultFile(prefs.default_filename);
+ if (!defaultFile.isEmpty())
+ files.push_back(QString(prefs.default_filename));
+ } else if (prefs.default_file_behavior == CLOUD_DEFAULT_FILE) {
+ QString cloudURL;
+ if (getCloudURL(cloudURL) == 0)
+ files.push_back(cloudURL);
+ }
}
MainWindow *m = MainWindow::instance();