From 3c022d8673934ebacd618072e1534fa671346499 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 31 Dec 2017 11:44:29 +0100 Subject: 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 --- desktop-widgets/downloadfromdivecomputer.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 3c011e4a6..aeefb75a4 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -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 - data->setDevName(btDeviceSelectionDialog->getSelectedDeviceAddress()); - data->setDevBluetoothName(btDeviceSelectionDialog->getSelectedDeviceName()); + 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 -- cgit v1.2.3-70-g09d2