From 619e97ee4fcd008c8e2f73d1d7653e932971c453 Mon Sep 17 00:00:00 2001 From: Claudiu Olteanu Date: Thu, 16 Jul 2015 23:06:22 +0300 Subject: Stop the SDP agent if the Clear/Save button was pressed If the Cancel button was pressed then we should stop the SDP agent. The same thing happens when the Save button was pressed. We don't need to add new BT remote devices to the list if the widget was closed or if the list with the discovered BT devices was cleared. Signed-off-by: Claudiu Olteanu Signed-off-by: Dirk Hohndel --- qt-ui/btdeviceselectiondialog.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp index 9b97da3a9..6a2a97731 100644 --- a/qt-ui/btdeviceselectiondialog.cpp +++ b/qt-ui/btdeviceselectiondialog.cpp @@ -86,6 +86,12 @@ void BtDeviceSelectionDialog::on_save_clicked() // Save the selected device selectedRemoteDeviceInfo = QSharedPointer(new QBluetoothDeviceInfo(remoteDeviceInfo)); + if (remoteDeviceDiscoveryAgent->isActive()) { + // Stop the SDP agent if the clear button is pressed and enable the Scan button + remoteDeviceDiscoveryAgent->stop(); + ui->scan->setEnabled(true); + } + // Close the device selection dialog and set the result code to Accepted accept(); } @@ -95,6 +101,12 @@ void BtDeviceSelectionDialog::on_clear_clicked() ui->dialogStatus->setText("Remote devices list was cleaned."); ui->discoveredDevicesList->clear(); ui->save->setEnabled(false); + + if (remoteDeviceDiscoveryAgent->isActive()) { + // Stop the SDP agent if the clear button is pressed and enable the Scan button + remoteDeviceDiscoveryAgent->stop(); + ui->scan->setEnabled(true); + } } void BtDeviceSelectionDialog::on_scan_clicked() -- cgit v1.2.3-70-g09d2