aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Patrick Majewski <dive@patrick-majewski.de>2014-02-11 19:49:56 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-11 12:36:28 -0800
commit936ac958ede81de4042a5e50a8e73997d1d29232 (patch)
treeed3437d279955c69b88abccc6f4a7dd8d4c37f48
parentb839cd4cb01d952b0cd7f6d4d16b6a0555d865ff (diff)
downloadsubsurface-936ac958ede81de4042a5e50a8e73997d1d29232.tar.gz
Handle cancel 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 <dive@patrick-majewski.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/preferences.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 5969a2d47..f3a88fcd3 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()