Hi, I am Patrick Majewski, a German developer and diver. I like what you all did with Subsurface. Especially after the switch to Qt. This enables me to give some value back. Cause this is my first time I send a patch to an oss, please be kind if I'm doing it wrong ;)
If I click in the Preferences Dialog on the 3 dots to choose a default File to load and cancel the opening File Dialog an empty string is returned and set to the corresponding QLineEdit. The new behavior (and mostly expected) is to update the QLineEdit only if there is a filename returned from QFileDialog. Patrick -- https://twitter.com/theKizoku http://www.patrick-majewski.de https://www.xing.com/profiles/Patrick_Majewski4
>From 97aa2eb55b5b94d3a1df8abfccd536e77259c63a Mon Sep 17 00:00:00 2001 From: Patrick Majewski <[email protected]> Date: Tue, 11 Feb 2014 13:18:54 +0100 Subject: [PATCH] handle cancle in PreferencesDialog::on_chooseFile_clicked If I click in the Preferences Dialog on the 3 dots to choose a default File to load and cancel the opening FileDialog an empty string is returned and set to the coresponding QLineEdit. The new behavior (and mostly expected) is to update the QLineEdit only if there is a filename returned from QFileDialog. Signed-off-by: Patrick Majewski <[email protected]> --- qt-ui/preferences.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index 5969a2d..f3a88fc 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -307,7 +307,10 @@ void PreferencesDialog::buttonClicked(QAbstractButton* button) void PreferencesDialog::on_chooseFile_clicked() { QFileInfo fi(system_default_filename()); - ui.defaultfilename->setText(QFileDialog::getOpenFileName(this, tr("Open Default Log File"), fi.absolutePath(), tr("Subsurface XML files (*.ssrf *.xml *.XML)"))); + QString choosenFileName = QFileDialog::getOpenFileName(this, tr("Open Default Log File"), fi.absolutePath(), tr("Subsurface XML files (*.ssrf *.xml *.XML)")); + + if(!choosenFileName.isEmpty()) + ui.defaultfilename->setText(choosenFileName); } void PreferencesDialog::emitSettingsChanged() -- 1.7.10.4
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
