diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-12-31 11:44:29 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-31 07:56:33 -0800 |
commit | 3c022d8673934ebacd618072e1534fa671346499 (patch) | |
tree | 98bc69f89211d57f403d0619debd4c8b1d0334c3 /desktop-widgets/downloadfromdivecomputer.cpp | |
parent | a1cd2f2e7ac5f31d835a538ac8a6e77430416e0c (diff) | |
download | subsurface-3c022d8673934ebacd618072e1534fa671346499.tar.gz |
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>
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 14 |
1 files 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 |