mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <dirk@hohndel.org>
This commit is contained in:
parent
899427079e
commit
06d6ca94f3
1 changed files with 9 additions and 0 deletions
|
@ -1414,6 +1414,15 @@ int MainWindow::file_save_as(void)
|
||||||
QString filename;
|
QString filename;
|
||||||
const char *default_filename = existing_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
|
// create a file dialog that allows us to save to a new file
|
||||||
QFileDialog selection_dialog(this, tr("Save file as"), default_filename,
|
QFileDialog selection_dialog(this, tr("Save file as"), default_filename,
|
||||||
tr("Subsurface XML files (*.ssrf *.xml *.XML)"));
|
tr("Subsurface XML files (*.ssrf *.xml *.XML)"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue