diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-09-16 20:44:58 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-16 21:17:35 -0700 |
commit | d3c75f2c72ba635eae8ea1df45b6ee9b2f4bb872 (patch) | |
tree | c024cfb3e1ccd1266003787af7eb894033855122 /qt-ui/templateedit.cpp | |
parent | 27bec9bc7b2a163f680d1fb03f53b4bcaecd1234 (diff) | |
download | subsurface-d3c75f2c72ba635eae8ea1df45b6ee9b2f4bb872.tar.gz |
Printing: show warning message when editing bundled templates
When editing a bundled template show warning message.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/templateedit.cpp')
-rw-r--r-- | qt-ui/templateedit.cpp | 14 |
1 files 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) { |