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>
This commit is contained in:
Gehad elrobey 2015-07-07 03:14:43 +02:00 committed by Lubomir I. Ivanov
parent c56b1c1114
commit c90d5b891d

View file

@ -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())) {
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());
}
}
}