HTML: remove theme file if already exist in the export directory

as QFile:copy doesn't overwrite files by default, we must check before
copying if file exist and remove it.

We must be able to overwrite files here, user is already notified and
choosed to replace them.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2014-06-13 14:16:58 +03:00 committed by Dirk Hohndel
parent 262472c9de
commit d363722c16

View file

@ -90,6 +90,12 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
QFile::copy(searchPath + "dive_export.html", filename);
QFile::copy(searchPath + "list_lib.js", exportFiles + "list_lib.js");
QFile::copy(searchPath + "poster.png", exportFiles + "poster.png");
// Remove theme file if already exist in the export dir
QFile theme(exportFiles + "theme.css");
if (theme.exists())
theme.remove();
QFile::copy(searchPath + (ui->themeSelection->currentText() == "Light" ? "light.css" : "sand.css"),
exportFiles + "theme.css");
}