summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-01-21 16:00:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 18:56:21 +0100
commit5254e62e1898cffe397ecd0b0c8be43213e5b4e8 (patch)
tree754ea319d95455e4319108644ba65317275976c3
parente413009f3be46ec1020e4ccc1e574e55fb4eb17f (diff)
Stop SDP search if QML Model is turned off
So far, we only ever disabled the device search. If a SDP discovery was running and we changed to device discovery the SDP discovery kept running in the background. Change-Id: I5f2cf88ecf7f9b5cfe2608e0ceda366b552982e5 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.cpp3
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
index 87ccb108..beaa3503 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
@@ -266,6 +266,9 @@ void QBluetoothServiceDiscoveryAgent::stop()
{
Q_D(QBluetoothServiceDiscoveryAgent);
+ if (!isActive())
+ return;
+
switch (d->discoveryState()) {
case QBluetoothServiceDiscoveryAgentPrivate::DeviceDiscovery:
d->stopDeviceDiscovery();
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
index 6689d663..b7534329 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
@@ -367,11 +367,10 @@ void QDeclarativeBluetoothDiscoveryModel::setRunning(bool running)
d->m_running = running;
if (!running) {
- if (d->m_deviceAgent) {
+ if (d->m_deviceAgent)
d->m_deviceAgent->stop();
- } else if (d->m_serviceAgent) {
+ if (d->m_serviceAgent)
d->m_serviceAgent->stop();
- }
} else {
clearModel();
d->m_error = NoError;