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>
This commit is contained in:
Claudiu Olteanu 2015-07-16 23:06:22 +03:00 committed by Dirk Hohndel
parent 05109b2d6c
commit 619e97ee4f

View file

@ -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()