diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-28 11:26:41 +0300 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-28 11:39:49 +0300 |
commit | 01645d64b91b29878d6927dcf7cd5c2381e0bfaa (patch) | |
tree | 4e990b16b487f32f1d7cfdea4993586f1e8598e4 /qt-ui | |
parent | ccddcc3952fec5195690c154f736690093e544d2 (diff) | |
download | subsurface-01645d64b91b29878d6927dcf7cd5c2381e0bfaa.tar.gz |
Printing: safer Template->Import|Export handling
Check if the file string is empty and return, else process it.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/printoptions.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp index 48489bae5..1da95a94d 100644 --- a/qt-ui/printoptions.cpp +++ b/qt-ui/printoptions.cpp @@ -106,6 +106,8 @@ void PrintOptions::on_importButton_clicked() { QString filename = QFileDialog::getOpenFileName(this, tr("Import Template file"), "", tr("HTML files (*.html)")); + if (filename.isEmpty()) + return; QFileInfo fileInfo(filename); QFile::copy(filename, getSubsurfaceDataPath("printing_templates") + QDir::separator() + fileInfo.fileName()); printOptions->p_template = fileInfo.fileName(); @@ -117,6 +119,8 @@ void PrintOptions::on_exportButton_clicked() { QString filename = QFileDialog::getSaveFileName(this, tr("Export Template files as"), "", tr("HTML files (*.html)")); + if (filename.isEmpty()) + return; QFile::copy(getSubsurfaceDataPath("printing_templates") + QDir::separator() + getSelectedTemplate(), filename); } |