summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/btdeviceselectiondialog.cpp21
-rw-r--r--qt-ui/btdeviceselectiondialog.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index 2f5a5d1f9..e52580e78 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -276,6 +276,25 @@ void BtDeviceSelectionDialog::error(QBluetoothLocalDevice::Error error)
.arg((error == QBluetoothLocalDevice::PairingError)? "Pairing error" : "Unknown error"));
}
+void BtDeviceSelectionDialog::deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error)
+{
+ QString errorDescription;
+
+ switch (error) {
+ case QBluetoothDeviceDiscoveryAgent::PoweredOffError:
+ errorDescription = QString("The Bluetooth adaptor is powered off, power it on before doing discovery.");
+ break;
+ case QBluetoothDeviceDiscoveryAgent::InputOutputError:
+ errorDescription = QString("Writing or reading from the device resulted in an error.");
+ break;
+ default:
+ errorDescription = QString("An unknown error has occurred.");
+ break;
+ }
+
+ ui->dialogStatus->setText(QString("Device discovery error: %1.").arg(errorDescription));
+}
+
QString BtDeviceSelectionDialog::getSelectedDeviceAddress()
{
if (selectedRemoteDeviceInfo) {
@@ -336,4 +355,6 @@ void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
this, SLOT(addRemoteDevice(QBluetoothDeviceInfo)));
connect(remoteDeviceDiscoveryAgent, SIGNAL(finished()),
this, SLOT(remoteDeviceScanFinished()));
+ connect(remoteDeviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
+ this, SLOT(deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error)));
}
diff --git a/qt-ui/btdeviceselectiondialog.h b/qt-ui/btdeviceselectiondialog.h
index 9c040dc68..b6c34e8b8 100644
--- a/qt-ui/btdeviceselectiondialog.h
+++ b/qt-ui/btdeviceselectiondialog.h
@@ -37,6 +37,7 @@ private slots:
void displayPairingMenu(const QPoint &pos);
void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing);
void error(QBluetoothLocalDevice::Error error);
+ void deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error);
void localDeviceChanged(int);
private: