Bug 483750

Summary: Suspend session actions are shown as unsupported on first open
Product: [Applications] systemsettings Reporter: Natalie Clarius <natalie_clarius>
Component: kcm_powerdevilAssignee: Jakob Petsovits <jpetso>
Status: RESOLVED FIXED    
Severity: normal CC: jpetso, kde, natalie_clarius
Priority: NOR    
Version First Reported In: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=482668
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Natalie Clarius 2024-03-16 12:06:25 UTC
STEPS TO REPRODUCE
1. Open power management KCM
3. Switch to battery tab and back to AC tab again

OBSERVED RESULT
2. "The action you had previously configured for after a period of inactivity is now unsupported on your system. Please select a different one." for inactivity, power button and lid close in AC profile tab
4. Options are correctly displayed again

EXPECTED RESULT
Options for AC profile are correctly loaded on first open

SOFTWARE/OS VERSIONS
git master
Comment 1 Jakob Petsovits 2024-03-16 13:42:30 UTC
A relevant merge request is waiting for review @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/339
Comment 2 Jakob Petsovits 2024-03-16 15:36:00 UTC
Git commit 78415ae0097ad36377b407d3b143589ca8fa8a18 by Jakob Petsovits.
Committed on 16/03/2024 at 15:33.
Pushed by jpetso into branch 'master'.

kcmodule: Revert to binding currentIndex in Component.onCompleted

Commit 8ecf6430 ("Don't crash when a configured button action
is unsupported") caused empty ComboBox selections on initial load.
Turns out `indexOfValue()` can only be used after the
Component.completed() signal is emitted, so a purely declarative
binding worked incorrectly if queried too early by QML.

Therefore, we revert back to assigning a Qt.binding() to
currentIndex in Component.onCompleted.

This commit also adapts PowerProfileModel and its associated
ComboBox in a similar way as the other two models used in this KCM.
Related: bug 482668

M  +1    -1    kcmodule/common/PowerProfileModel.cpp
M  +4    -1    kcmodule/profiles/ui/GlobalConfig.qml
M  +20   -11   kcmodule/profiles/ui/ProfileConfig.qml

https://invent.kde.org/plasma/powerdevil/-/commit/78415ae0097ad36377b407d3b143589ca8fa8a18