Ok, I removed that line too. I thought that is more readable in that way, but you are right: it is better to keep all the declarations in the same block.
Thanks again for your time, Claudiu On Sat, Mar 21, 2015 at 4:50 PM, Lubomir I. Ivanov <[email protected]> wrote: > On 21 March 2015 at 16:44, Claudiu Olteanu > <[email protected]> wrote: > > Oh, thanks. I usually insert more tabs and finally align with a number > > of spaces less than the size of a tab. > > > > Hope that the last patch (attached to this e-mail) is good :-). > > > > yeah, the patch is good now. > line 31 adds a line that is not needed, but a line separating the > variable declaration and the function body is fine... > > we just try to keep the whitespace of the source code very sanitized. > just browse the file tree and you can see the generics. > also refer to CodingStyle and the Linux Kernel coding style. > > thanks > lubomir > -- >
From 3cecf5040cc9603893d6c33964f27ba6212f9acd Mon Sep 17 00:00:00 2001 From: Claudiu Olteanu <[email protected]> Date: Sat, 21 Mar 2015 17:10:55 +0200 Subject: [PATCH] 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 <[email protected]> --- qt-ui/mainwindow.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 54c0ce7..2c17648 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -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, - tr("Subsurface XML files (*.ssrf *.xml *.XML)")); + 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"); -- 2.1.4
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
