Get Bluetooth device nam from preferences if dialog wasn't shown

If the BT dialog hasn't been shown, the device name was taken from
the text field, which contained a formatted string. The device open
would then fail.

Fixes #1002

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-12-31 11:44:29 +01:00 committed by Dirk Hohndel
parent a1cd2f2e7a
commit 3c022d8673

View file

@ -292,10 +292,16 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
data->setProduct(ui.product->currentText());
#if defined(BT_SUPPORT)
data->setBluetoothMode(ui.bluetoothMode->isChecked());
if (data->bluetoothMode() && btDeviceSelectionDialog != NULL) {
// Get the selected device address
if (data->bluetoothMode()) {
// Get the selected device address from dialog or from preferences
if (btDeviceSelectionDialog != NULL) {
data->setDevName(btDeviceSelectionDialog->getSelectedDeviceAddress());
data->setDevBluetoothName(btDeviceSelectionDialog->getSelectedDeviceName());
} else {
auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
data->setDevName(dc->dc_device());
data->setDevBluetoothName(dc->dc_device_name());
}
} else
// this breaks an "else if" across lines... not happy...
#endif