Bug 483750 - Suspend session actions are shown as unsupported on first open
Summary: Suspend session actions are shown as unsupported on first open
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_powerdevil (other bugs)
Version First Reported In: master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Jakob Petsovits
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-16 12:06 UTC by Natalie Clarius
Modified: 2024-03-16 15:36 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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