aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputerdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/configuredivecomputerdialog.cpp')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 71960b6f2..2f8771ed7 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -244,7 +244,7 @@ void ConfigureDiveComputerDialog::on_backupButton_clicked()
QString errorText = "";
if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data, errorText)) {
QMessageBox::critical(this, tr("XML Backup Error"),
- tr("An eror occurred while saving the backup file.\n%1")
+ tr("An error occurred while saving the backup file.\n%1")
.arg(errorText)
);
} else {
@@ -255,3 +255,29 @@ void ConfigureDiveComputerDialog::on_backupButton_clicked()
}
}
}
+
+void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
+{
+ QString filename = existing_filename ?: prefs.default_filename;
+ QFileInfo fi(filename);
+ filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
+ QString restorePath = QFileDialog::getOpenFileName(this, tr("Restore Dive Computer Settings"),
+ filename, tr("Backup files (*.xml)")
+ );
+ if (!restorePath.isEmpty()) {
+ QString errorText = "";
+ if (!config->restoreXMLBackup(restorePath, deviceDetails, errorText)) {
+ QMessageBox::critical(this, tr("XML Restore Error"),
+ tr("An error occurred while restoring the backup file.\n%1")
+ .arg(errorText)
+ );
+ } else {
+ reloadValues();
+ //getDeviceData();
+ //config->saveDeviceDetails(deviceDetails, &device_data);
+ QMessageBox::information(this, tr("Restore succeeded"),
+ tr("Your settings have been restored successfully.")
+ );
+ }
+ }
+}