mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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:
parent
c56b1c1114
commit
c90d5b891d
1 changed files with 10 additions and 2 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue