Skip to content

Add PowerButtonActionModel class and use it in global config KCM

Note: This MR depends on !200 (merged) to go in first, it uses those enums. So pipelines will fail for the time being. But other than that, the patch is complete and barely affected by merge conflicts, so I thought I'll put it up now. Will rebase and fix pipelines once the enums MR has made it in.


Commit message body

Derived from Tomaz Canabrava's unmerged MR !66 (closed), but generalized to allow any arbitrary combination of selectable actions.

This model is quite easily plugged into the BatteryCriticalCombo widget in the global config KCM a.k.a. "Advanced Power Settings", replacing the previously manually inserted option items. I left the profile action config untouched so that the model class can live in kcmodules/common/ as opposed to powerdevilcore directly.

PowerButtonActionModel will also come in handy once we port the global and profile KCMs to QML.

One functional change: The "critical level" action now also allows selecting Hybrid Sleep, which was previously unavailable. No good reason to hide that from the user, especially now that PowerDevil::Core handles it correctly. Hybrid suspend might even be the best of all critical-battery suspend options for many users.

Merge request reports