Bug 459855

Summary: kcm: "Forget this Device" dialog swaps subject device on the fly
Product: [Unmaintained] Bluedevil Reporter: ratijas <me>
Component: generalAssignee: David Rosca <nowrep>
Status: RESOLVED FIXED    
Severity: normal CC: bharadwaj.raju777, plasma-bugs-null
Priority: NOR    
Version First Reported In: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.24
Sentry Crash Report:
Attachments: Bluetooth - remove device by list index

Description ratijas 2022-09-30 12:26:58 UTC
Created attachment 152517 [details]
Bluetooth - remove device by list index

SUMMARY

Changes in the list of Bluetooth devices, while the "Forget…" dialog is open, affects which device the dialog prompts to "forget".

It seems that the dialog binds to a device by its index in the list; the code should pass a copy of information, or some kind of persistent model index instead.

STEPS TO REPRODUCE
0. Pair two or more devices.
1. Open Bluetooth KCM.
2. Click "Forget …" button on the right side of any device's list row.
3. Now use Bluetooth applet to connect (or disconnect if it is already connected) this or some other device, so that overall the list of devices changes ordering, and moves device from (2) to a different row.

OBSERVED RESULT
Text in «Are you sure you want to forget "%one% device"?» changes to  «Are you sure you want to forget "%another% device"?»

EXPECTED RESULT
Dialog should copy and store persistent handle to a device it was invoked for.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE: git-master
Qt Version: 5.15.6
Kernel Version: 5.19.9-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: G752VT
System Version: 1.0
Comment 1 Bug Janitor Service 2022-09-30 16:04:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/bluedevil/-/merge_requests/97
Comment 2 ratijas 2022-10-02 21:29:56 UTC
Git commit aa51b5e44defdfa869351fa9f0cb5b10b8d534ad by ivan tkachenko.
Committed on 02/10/2022 at 21:18.
Pushed by ratijas into branch 'master'.

kcm: Copy model data into the "Forget…" dialog

…and refactor it into dynamic component. New required properties and a
signal make it completely decoupled from surrounding context.

Future directions:

1. Theoretically, now we could save even more memory and loading times
by factoring it out in a separate file.

2. Dialog needs to be closed in cases where its device somehow
disappears or adapter is disconnected.
FIXED-IN: 5.26

M  +45   -35   src/kcm/package/contents/ui/main.qml

https://invent.kde.org/plasma/bluedevil/commit/aa51b5e44defdfa869351fa9f0cb5b10b8d534ad
Comment 3 ratijas 2022-10-02 21:36:35 UTC
Git commit d9bc742987be9a8328f40129fbc99b1b42f3c302 by ivan tkachenko.
Committed on 02/10/2022 at 21:35.
Pushed by ratijas into branch 'Plasma/5.26'.

kcm: Copy model data into the "Forget…" dialog

…and refactor it into dynamic component. New required properties and a
signal make it completely decoupled from surrounding context.

Future directions:

1. Theoretically, now we could save even more memory and loading times
by factoring it out in a separate file.

2. Dialog needs to be closed in cases where its device somehow
disappears or adapter is disconnected.
FIXED-IN: 5.26
(cherry picked from commit aa51b5e44defdfa869351fa9f0cb5b10b8d534ad)

M  +45   -35   src/kcm/package/contents/ui/main.qml

https://invent.kde.org/plasma/bluedevil/commit/d9bc742987be9a8328f40129fbc99b1b42f3c302
Comment 4 ratijas 2022-10-02 21:40:56 UTC
Relevant merge request for Plasma/5.24 LTS branch @ https://invent.kde.org/plasma/bluedevil/-/merge_requests/98
Comment 5 ratijas 2022-10-02 22:20:29 UTC
Git commit 3f8f9ebd6730bdadd8c8bcd318dc9c280b632687 by ivan tkachenko.
Committed on 02/10/2022 at 21:31.
Pushed by ratijas into branch 'Plasma/5.24'.

kcm: Copy model data into the "Forget…" dialog
FIXED-IN: 5.24

(adapted (not cherry picked) from commit aa51b5e44defdfa869351fa9f0cb5b10b8d534ad)

M  +16   -10   src/kcm/package/contents/ui/main.qml

https://invent.kde.org/plasma/bluedevil/commit/3f8f9ebd6730bdadd8c8bcd318dc9c280b632687