From 06d6ca94f3b0a70242ea4b22fbb0668351896804 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 20 Sep 2015 08:39:15 -0700 Subject: When calling save-as with cloud storage as default, pick sane filename Passing the cloud URL to the file select box leaves "git syntax" in the filename which makes us look for a directory with a git repository in it and give non-sensical error messages to the user. With this we simply use the users email address as local filename with a .ssrf suffix. Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 43bc4d3fb..1678cd6d4 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -1414,6 +1414,15 @@ int MainWindow::file_save_as(void) QString filename; const char *default_filename = existing_filename; + // if the default is to save to cloud storage, pick something that will work as local file: + // simply extract the branch name which should be the users email address + if (default_filename && strstr(default_filename, prefs.cloud_git_url)) { + QString filename(default_filename); + filename.remove(prefs.cloud_git_url); + filename.remove(0, filename.indexOf("[") + 1); + filename.replace("]", ".ssrf"); + default_filename = strdup(qPrintable(filename)); + } // create a file dialog that allows us to save to a new file QFileDialog selection_dialog(this, tr("Save file as"), default_filename, tr("Subsurface XML files (*.ssrf *.xml *.XML)")); -- cgit v1.2.3-70-g09d2