summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Claudiu Olteanu <olteanu.claudiu@ymail.com>2015-07-16 23:06:22 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-19 05:50:08 -0700
commit619e97ee4fcd008c8e2f73d1d7653e932971c453 (patch)
tree4d464fa4cc15b54e193bf4d3cb12006ec8499a4d
parent05109b2d6c7e8ef816b1290c583492dec78b3f07 (diff)
downloadsubsurface-619e97ee4fcd008c8e2f73d1d7653e932971c453.tar.gz
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 <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/btdeviceselectiondialog.cpp12
1 files changed, 12 insertions, 0 deletions
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<QBluetoothDeviceInfo>(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()