From d3c75f2c72ba635eae8ea1df45b6ee9b2f4bb872 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Wed, 16 Sep 2015 20:44:58 -0300 Subject: Printing: show warning message when editing bundled templates When editing a bundled template show warning message. Signed-off-by: Gehad elrobey Signed-off-by: Dirk Hohndel --- qt-ui/templateedit.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp index 7ca84c88a..0fa8b97ac 100644 --- a/qt-ui/templateedit.cpp +++ b/qt-ui/templateedit.cpp @@ -123,14 +123,24 @@ void TemplateEdit::on_colorpalette_currentIndexChanged(int index) void TemplateEdit::saveSettings() { + QStringList bundledTemplates; + bundledTemplates << "Flowlayout.html" << "One Dive.html" << "Six Dives.html" << "Table.html" << "Two Dives.html"; if ((*templateOptions) != newTemplateOptions || grantlee_template.compare(ui->plainTextEdit->toPlainText())) { QMessageBox msgBox; - msgBox.setText("Do you want to save your changes?"); + QString message = "Do you want to save your changes?"; + bool templateChanged = false; + if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) { + if (bundledTemplates.contains(printOptions->p_template)) { + message = "You are about to modify a template bundled with Subsurface. Do you want to save your changes?"; + } + templateChanged = true; + } + msgBox.setText(message); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); if (msgBox.exec() == QMessageBox::Save) { memcpy(templateOptions, &newTemplateOptions, sizeof(struct template_options)); - if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) { + if (templateChanged) { TemplateLayout::writeTemplate(printOptions->p_template, ui->plainTextEdit->toPlainText()); } if (templateOptions->color_palette_index == CUSTOM) { -- cgit v1.2.3-70-g09d2