1
0
Fork 0
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 

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:
Claudiu Olteanu 2015-03-21 17:10:55 +02:00 committed by Dirk Hohndel
parent 90905601c5
commit 1982bdb9fc

View file

@ -1259,8 +1259,15 @@ int MainWindow::file_save_as(void)
{
QString 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)"));
/* 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())
return report_error("No filename to save into");