diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-03-13 12:07:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-14 08:39:50 +0100 |
commit | 2802eac9bc9ce2c26d09f9598263337287e2765e (patch) | |
tree | 92158ef512f68203f53230326218f113806a8f72 /examples/bluetooth/btfiletransfer | |
parent | 925eaae08427a6d17cf965c6214e19cfa6446d92 (diff) |
Ensure examples behave on default backend and/or with no local Bt device
This patch fixes crashes and ensures that examples give some form of
indication why they are not working.
Change-Id: Id99951e8729c0715505e5fff7448a475979a6406
Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com>
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples/bluetooth/btfiletransfer')
-rw-r--r-- | examples/bluetooth/btfiletransfer/remoteselector.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/bluetooth/btfiletransfer/remoteselector.cpp b/examples/bluetooth/btfiletransfer/remoteselector.cpp index 53bf47f3..84619a4e 100644 --- a/examples/bluetooth/btfiletransfer/remoteselector.cpp +++ b/examples/bluetooth/btfiletransfer/remoteselector.cpp @@ -117,9 +117,14 @@ void RemoteSelector::startDiscovery(const QBluetoothUuid &uuid) m_discoveryAgent->setUuidFilter(uuid); m_discoveryAgent->start(); - ui->status->setText(tr("Scanning...")); - ui->busyWidget->show(); - ui->busyWidget->movie()->start(); + if (!m_discoveryAgent->isActive() || + m_discoveryAgent->error() != QBluetoothServiceDiscoveryAgent::NoError) { + ui->status->setText(tr("Cannot find remote services.")); + } else { + ui->status->setText(tr("Scanning...")); + ui->busyWidget->show(); + ui->busyWidget->movie()->start(); + } } QBluetoothServiceInfo RemoteSelector::service() const |