DeclarativeManager needs to implement connectedDevices list property
DeclarativeManager class — which is exposed as BluezQt.Manager to QML — provides devices
list property, but downstream consumers such as plasma-mobile shell and Bluedevil applet also manually keep track of a filtered list which should contain only the connected devices. Being a pure QML/JS code, the implementations are ridiculously complicated, involving custom catch-all Connections:
Connections {
target: BluezQt.Manager
function onDeviceAdded(): void {
updateConnectedDevices();
}
function onDeviceRemoved(): void {
updateConnectedDevices();
}
function onDeviceChanged(): void {
updateConnectedDevices();
}
function onBluetoothBlockedChanged(): void {
updateConnectedDevices();
}
function onBluetoothOperationalChanged(): void {
updateConnectedDevices();
}
}
and manual shallow JS array comparison (which used an incorrect ==
operator relying on Device.toString()
implementation — something which I fixed in plasma/bluedevil!171 (merged)).
Let's drop all that mess by introducing an in-house BluezQt.Manager.connectedDevices
observable property.