Backup dialog: check if the backup file already exists.

Give the user a chance to cancel the backup if the selected file already
exists. Since the filename is automatically generated from the installation
version information this can happen when trying to create a second backup of
the installation.

Change-Id: Iee34e576c4b3b94a4ccf99836741806b52a8affd
This commit is contained in:
Dominik Riebeling 2012-06-30 11:58:45 +02:00
parent 6db53f4ef8
commit bed847a655

View file

@ -108,6 +108,13 @@ void BackupDialog::updateSizeInfo(void)
void BackupDialog::backup(void) void BackupDialog::backup(void)
{ {
if(QFileInfo(m_backupName).isFile()) {
if(QMessageBox::warning(this, tr("File exists"),
tr("The selected backup file already exists. Overwrite?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
return;
}
}
m_logger = new ProgressLoggerGui(this); m_logger = new ProgressLoggerGui(this);
connect(m_logger, SIGNAL(closed()), this, SLOT(close())); connect(m_logger, SIGNAL(closed()), this, SLOT(close()));
m_logger->show(); m_logger->show();