void PrintOptions::on_importButton_clicked() { QString filename = QFileDialog::getOpenFileName(this, tr("Import template file"), "", tr("HTML files (*.html)")); if (filename.isEmpty()) return; QFileInfo fileInfo(filename); QFile::copy(filename, getPrintingTemplatePathUser() + QDir::separator() + fileInfo.fileName()); printOptions->p_template = fileInfo.fileName(); find_all_templates(); setup(); }
void PrintOptions::on_deleteButton_clicked() { QString templateName = getSelectedTemplate(); QMessageBox msgBox; msgBox.setText(tr("This action cannot be undone!")); msgBox.setInformativeText(tr("Delete template: %1?").arg(templateName)); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); if (msgBox.exec() == QMessageBox::Ok) { QFile f(getPrintingTemplatePathUser() + QDir::separator() + templateName); f.remove(); find_all_templates(); setup(); } }
void PrintOptions::on_deleteButton_clicked() { QString templateName = getSelectedTemplate(); QMessageBox msgBox; msgBox.setText("This action cannot be undone!"); msgBox.setInformativeText("Delete '" + templateName + "' template?"); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); if (msgBox.exec() == QMessageBox::Ok) { QFile f(getSubsurfaceDataPath("printing_templates") + QDir::separator() + templateName); f.remove(); find_all_templates(); setup(); } }