diff options
author | Martin Schulze <schulmar@hrz.tu-chemnitz.de> | 2016-03-29 16:48:07 +0200 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-04-13 10:42:54 +0100 |
commit | 3b6cfd18ff682909d168a60081b7e8f2039755da (patch) | |
tree | 4e6f752a34145d4582f69d8f566a30c561139c49 | |
parent | 88148591255e397d7d6a11ed05858152e0143184 (diff) |
gui: Overwrite existing files.
As the user already consents to that in the save dialog.
Fixes #408.
-rw-r--r-- | gui/mainwindow.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index afbd09f2..510bb21a 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -114,6 +114,15 @@ void MainWindow::saveTrace() tr("Trace Files (*.trace);;All Files (*)")); if (!fileName.isEmpty()) { + // copy won't overwrite existing files! + if (QFile::exists(fileName)) { + if (!QFile::remove(fileName)) { + QMessageBox::warning( + this, tr("Could not overwrite file"), + tr("The existing file %0 could not be replaced!") + .arg(fileName)); + } + } QFile::copy(localFile, fileName); } } |