summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2014-06-13 14:16:58 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-15 09:25:37 -0700
commitd363722c1656733be0c75f73b7a65cd116c3d7da (patch)
treef88f6ef4a6fb6eecb6764661d2a79d3f9dda4a24 /qt-ui
parent262472c9de9c5ffe4eac5bdc3115f76257ed27f7 (diff)
downloadsubsurface-d363722c1656733be0c75f73b7a65cd116c3d7da.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divelogexportdialog.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index 3e07e70cd..b4bac0fa6 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -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");
}