Improve on error reporting in the ConfigureDiveComputer class

This patch improves on the error reporting for the dive computer
configuration dialog to use config->lastError.

The previous code was using a different argument in each function,
which lacked uniformity.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
Joseph W. Joshua 2014-07-31 18:51:38 +03:00 committed by Thiago Macieira
parent 24cb0b0496
commit 4e99382c96
3 changed files with 13 additions and 16 deletions

View file

@ -396,11 +396,10 @@ void ConfigureDiveComputerDialog::on_backupButton_clicked()
if (!backupPath.isEmpty()) {
populateDeviceDetails();
getDeviceData();
QString errorText = "";
if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data, errorText)) {
if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data)) {
QMessageBox::critical(this, tr("XML Backup Error"),
tr("An error occurred while saving the backup file.\n%1")
.arg(errorText)
.arg(config->lastError)
);
} else {
QMessageBox::information(this, tr("Backup succeeded"),
@ -420,11 +419,10 @@ void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
filename, tr("Backup files (*.xml)")
);
if (!restorePath.isEmpty()) {
QString errorText = "";
if (!config->restoreXMLBackup(restorePath, deviceDetails, errorText)) {
if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
QMessageBox::critical(this, tr("XML Restore Error"),
tr("An error occurred while restoring the backup file.\n%1")
.arg(errorText)
.arg(config->lastError)
);
} else {
reloadValues();
@ -447,8 +445,7 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
);
if (!firmwarePath.isEmpty()) {
getDeviceData();
QString errText;
config->startFirmwareUpdate(firmwarePath, &device_data, errText);
config->startFirmwareUpdate(firmwarePath, &device_data);
}
}