Bug 448381

Summary: Keyboard layout needs 2 clicks on reset to properly reset
Product: [Applications] systemsettings Reporter: Nico <nico>
Component: kcm_keyboardAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: butirsky, fabian, nate, nicolas.fella
Priority: NOR    
Version First Reported In: 5.23.90   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screen recording showcasing the bug

Description Nico 2022-01-13 18:39:07 UTC
Created attachment 145422 [details]
Screen recording showcasing the bug

SUMMARY
Keyboard layout needs 2 clicks on reset to properly reset


STEPS TO REPRODUCE
1. Tick "Configure layouts" and add a layout
2. Click "Apply"
3. Click on "Defaults"
4. Click on "Reset"

OBSERVED RESULT
Checkbox for "Configure layouts" is set, but the list of layouts is empty

EXPECTED RESULT
It should be properly set back to the original values

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Bug Janitor Service 2022-01-19 20:40:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/809
Comment 2 Fabian Vogt 2022-01-26 20:16:44 UTC
Git commit a91f6d1bea5457922f4f1b3237b0758471afa1ca by Fabian Vogt.
Committed on 26/01/2022 at 20:12.
Pushed by fvogt into branch 'master'.

[kcms/keyboard] Fix populating layouts when reloading config

Previously, it populated the internal list of layouts before reloading
settings from kcfg. That lead to KCMKeyboardWidget::configureLayoutsChanged
getting called for ticking the checkbox while the list of layouts was
already nonempty, which is an invalid/unexpected state. In its confusion it
cleared the list.

Just load kcfg settings first to avoid this.

M  +1    -2    kcms/keyboard/kcm_keyboard.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/a91f6d1bea5457922f4f1b3237b0758471afa1ca
Comment 3 Fabian Vogt 2022-01-26 20:20:26 UTC
Git commit c2ecb1cd0ac26610a2b3dbd2a1e19faae9158f89 by Fabian Vogt.
Committed on 26/01/2022 at 20:20.
Pushed by fvogt into branch 'Plasma/5.24'.

[kcms/keyboard] Fix populating layouts when reloading config

Previously, it populated the internal list of layouts before reloading
settings from kcfg. That lead to KCMKeyboardWidget::configureLayoutsChanged
getting called for ticking the checkbox while the list of layouts was
already nonempty, which is an invalid/unexpected state. In its confusion it
cleared the list.

Just load kcfg settings first to avoid this.


(cherry picked from commit a91f6d1bea5457922f4f1b3237b0758471afa1ca)

M  +1    -2    kcms/keyboard/kcm_keyboard.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/c2ecb1cd0ac26610a2b3dbd2a1e19faae9158f89