aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/bluetooth/BluetoothModule.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/bluetooth/BluetoothModule.qml')
-rw-r--r--desktop/modules/bluetooth/BluetoothModule.qml15
1 files changed, 15 insertions, 0 deletions
diff --git a/desktop/modules/bluetooth/BluetoothModule.qml b/desktop/modules/bluetooth/BluetoothModule.qml
index 84ac9a4..80f80b9 100644
--- a/desktop/modules/bluetooth/BluetoothModule.qml
+++ b/desktop/modules/bluetooth/BluetoothModule.qml
@@ -25,6 +25,7 @@ Module {
alwaysActive: true
readonly property var adapter: Bluetooth.defaultAdapter
+ readonly property Pairing pairing: Pairing {}
readonly property var devices: Bluetooth.devices ? Bluetooth.devices.values : []
readonly property var connectedDevices: devices.filter(d => d.connected)
readonly property var pairedDevices: devices.filter(d => d.paired && !d.connected)
@@ -44,6 +45,20 @@ Module {
property Process notifyProc: Process {}
+ // Pairing runs through bluetoothctl; on success connect natively, on
+ // failure notify, since the drawer may have closed by then.
+ property Connections pairingConn: Connections {
+ target: mod.pairing
+ function onFinished(address, ok) {
+ if (!ok) {
+ mod.notify("Bluetooth", "Pairing failed: " + mod.pairing.error);
+ return;
+ }
+ const d = mod.devices.find(x => x.address === address);
+ if (d) d.connect();
+ }
+ }
+
tileContent: Component { BluetoothTile { bt: mod } }
page: Component {