diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-07-07 03:14:43 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-20 15:27:23 +0300 |
commit | c90d5b891df873a6a69f5da618d42af998b4620f (patch) | |
tree | a0c2224041e6634b9bfb7c5dae68ac6fcf111426 /qt-ui/templateedit.cpp | |
parent | c56b1c1114015c6b83852ecdcdb21b03f41e594b (diff) | |
download | subsurface-c90d5b891df873a6a69f5da618d42af998b4620f.tar.gz |
Printing: show confirmation message before overwriting the template
Before overwriting the new template show confirmation message.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/templateedit.cpp')
-rw-r--r-- | qt-ui/templateedit.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp index 82a71ea32..0a8c4ca92 100644 --- a/qt-ui/templateedit.cpp +++ b/qt-ui/templateedit.cpp @@ -2,6 +2,8 @@ #include "printoptions.h" #include "ui_templateedit.h" +#include <QMessageBox> + TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, struct template_options *templateOptions) : QDialog(parent), ui(new Ui::TemplateEdit) @@ -55,7 +57,13 @@ void TemplateEdit::on_colorpalette_currentIndexChanged(int index) void TemplateEdit::on_TemplateEdit_finished(int result) { if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) { - printOptions->p_template = print_options::CUSTOM; - TemplateLayout::writeTemplate("custom.html", ui->plainTextEdit->toPlainText()); + QMessageBox msgBox; + msgBox.setText("Do you want to save your changes?"); + msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard); + msgBox.setDefaultButton(QMessageBox::Discard); + if (msgBox.exec() == QMessageBox::Save) { + printOptions->p_template = print_options::CUSTOM; + TemplateLayout::writeTemplate("custom.html", ui->plainTextEdit->toPlainText()); + } } } |