diff --git a/daemon/powerdevilprofilegenerator.cpp b/daemon/powerdevilprofilegenerator.cpp --- a/daemon/powerdevilprofilegenerator.cpp +++ b/daemon/powerdevilprofilegenerator.cpp @@ -58,15 +58,20 @@ KConfigGroup acProfile(profilesConfig, "AC"); acProfile.writeEntry("icon", "battery-charging"); + const bool mobile = !qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_MOBILE"); + const Modes defaultPowerButtonAction = mobile ? LockScreenMode : LogoutDialogMode; + // We want to dim the screen after a while, definitely { KConfigGroup dimDisplay(&acProfile, "DimDisplay"); dimDisplay.writeEntry< int >("idleTime", 300000); } // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) { KConfigGroup handleButtonEvents(&acProfile, "HandleButtonEvents"); - handleButtonEvents.writeEntry< uint >("powerButtonAction", LogoutDialogMode); + + handleButtonEvents.writeEntry< uint >("powerButtonAction", defaultPowerButtonAction); + if (toRam) { handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); } else { @@ -91,7 +96,7 @@ // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) { KConfigGroup handleButtonEvents(&batteryProfile, "HandleButtonEvents"); - handleButtonEvents.writeEntry< uint >("powerButtonAction", LogoutDialogMode); + handleButtonEvents.writeEntry< uint >("powerButtonAction", defaultPowerButtonAction); if (toRam) { handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); } else { @@ -127,7 +132,7 @@ // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) { KConfigGroup handleButtonEvents(&lowBatteryProfile, "HandleButtonEvents"); - handleButtonEvents.writeEntry< uint >("powerButtonAction", LogoutDialogMode); + handleButtonEvents.writeEntry< uint >("powerButtonAction", defaultPowerButtonAction); if (toRam) { handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); } else {