Skip to content

kcm: Reject the «Forget…?» dialog when either device or adapter is gone, and fix missing context property

ivan tkachenko requested to merge work/ratijas/kcm-forget-fixes into master

kcm: Fix root not being found due to loss of a context in deleted delegate

ListView's delegates are not reliable, because they may be destroyed (for various reasons, not only because a device was removed, e.g. they may get recycled because another device got connected and shifted the list downward, causing some delegates to go out of view). Ideally the code would bind root object directly by value instead of capturing it in a local javascript closure, but AFAIK such level of memory control (early binding) is not available to QML/JS.

kcm: Use idiomatic accept & reject methods for the «Forget…?» dialog

kcm: Reject the «Forget…?» dialog when either device or adapter is gone

Tested with three possible scenarios, while «Forget…?» dialog is open:

  1. Use bluetoothctl to "remove" a device: onDeviceRemoved handler path is triggered.

  2. Use an applet, rfkill or bluetoothctl to soft-block Bluetooth controller: this corresponds to onPoweredChanged code path.

  3. Hot-unplugging an external Bluetooth dongle to which a device was previously paired: this runs onAdapterRemoved function.

Merge request reports