How and when to use mobile power settings?
519dc0c4 introduced some Plasma Mobile specific tweaks to the default powerdevil config, like different timeout values for screen lock and suspend, and locking the screen when the power button is pressed instead of suspending.
On first start powerdevil generates a new profile with specific values for everything, depending on whether we are mobile or not. Whether or not we are mobile is checked using the QT_QUICK_CONTROLS_MOBILE
environment variable.
!68 (merged) changed this to use the tablet mode instead, with !143 (merged) fixing it up. This is somewhat problematic. Tablet mode is not a static thing, it changes depending on the state of the hardware. However, the profile generation only happens once, and if the device was in tablet mode we will get mobile settings forever. For phones this is not a problem, but if you have a laptop in tablet mode during first boot you get the "wrong" set of settings.
Furthermore, the fact that we generate a profile config on first run is bad in itself. It goes against how KConfig generally works and makes it impossible for us to change defaults for users that haven't changed their settings, or distros/admins to provide their own defaults using config inheritance. By using KConfigXT (!71 (closed)) we are moving towards solving this, but that could cause a problem because then we would get different config values depending on whether or not we are currently in tablet mode, which is probably not what we want.
This raises the question: What is the proper way to detect "We are running Plasma Mobile on a phone" and use appropriate settings, without causing issues for convertible laptops?