mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Implement handler for cancel button of Save As dialog
When an user opened the "Save as" dialog and pressed the cancel button a null string was returned. Therefore the file_save_as function returned an error which was lately shown when the file_save function was called. Now the function checks if the cancel/exit button was pressed and returns. Fixes #844 Reported-by: longjohnsilver Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
90905601c5
commit
1982bdb9fc
1 changed files with 9 additions and 2 deletions
|
@ -1259,8 +1259,15 @@ int MainWindow::file_save_as(void)
|
||||||
{
|
{
|
||||||
QString filename;
|
QString filename;
|
||||||
const char *default_filename = existing_filename;
|
const char *default_filename = existing_filename;
|
||||||
filename = QFileDialog::getSaveFileName(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)"));
|
||||||
|
|
||||||
|
/* if the exit/cancel button is pressed return */
|
||||||
|
if (!selection_dialog.exec())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* get the first selected file */
|
||||||
|
filename = selection_dialog.selectedFiles().at(0);
|
||||||
if (filename.isNull() || filename.isEmpty())
|
if (filename.isNull() || filename.isEmpty())
|
||||||
return report_error("No filename to save into");
|
return report_error("No filename to save into");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue