From c57df085a4dc9e4b679dfa5f2d834c3ecf5f8f63 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Thu, 23 Nov 2017 16:42:54 +0200 Subject: printing: make sure that exported templates are .html Thus far the exported template did not had the .html extension. This patch makes sure that the extension is always added to the file if missing. Also handle the case where the user used ".htm" and replace that with ".html". Signed-off-by: Lubomir I. Ivanov --- desktop-widgets/printoptions.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/desktop-widgets/printoptions.cpp b/desktop-widgets/printoptions.cpp index 10d6d9c25..4b1deabca 100644 --- a/desktop-widgets/printoptions.cpp +++ b/desktop-widgets/printoptions.cpp @@ -163,6 +163,11 @@ void PrintOptions::on_exportButton_clicked() tr("HTML files") + " (*.html)"); if (filename.isEmpty()) return; + const QString ext(".html"); + if (filename.endsWith(".htm", Qt::CaseInsensitive)) + filename += "l"; + else if (!filename.endsWith(ext, Qt::CaseInsensitive)) + filename += ext; QFile::copy(pathUser + QDir::separator() + getSelectedTemplate(), filename); QFile f(filename); if (!f.open(QFile::ReadWrite | QFile::Text)) -- cgit v1.2.3-70-g09d2