Changeset View
Changeset View
Standalone View
Standalone View
daemon/powerdevilprofilegenerator.cpp
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 52 | if (group != "Activities") { | |||
---|---|---|---|---|---|
53 | profilesConfig->deleteGroup(group); | 53 | profilesConfig->deleteGroup(group); | ||
54 | } | 54 | } | ||
55 | } | 55 | } | ||
56 | 56 | | |||
57 | // Let's start: AC profile before anything else | 57 | // Let's start: AC profile before anything else | ||
58 | KConfigGroup acProfile(profilesConfig, "AC"); | 58 | KConfigGroup acProfile(profilesConfig, "AC"); | ||
59 | acProfile.writeEntry("icon", "battery-charging"); | 59 | acProfile.writeEntry("icon", "battery-charging"); | ||
60 | 60 | | |||
61 | const bool mobile = !qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_MOBILE"); | ||||
62 | const Modes defaultPowerButtonAction = mobile ? LockScreenMode : LogoutDialogMode; | ||||
63 | | ||||
61 | // We want to dim the screen after a while, definitely | 64 | // We want to dim the screen after a while, definitely | ||
62 | { | 65 | { | ||
63 | KConfigGroup dimDisplay(&acProfile, "DimDisplay"); | 66 | KConfigGroup dimDisplay(&acProfile, "DimDisplay"); | ||
64 | dimDisplay.writeEntry< int >("idleTime", 300000); | 67 | dimDisplay.writeEntry< int >("idleTime", 300000); | ||
65 | } | 68 | } | ||
66 | // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) | 69 | // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) | ||
67 | { | 70 | { | ||
68 | KConfigGroup handleButtonEvents(&acProfile, "HandleButtonEvents"); | 71 | KConfigGroup handleButtonEvents(&acProfile, "HandleButtonEvents"); | ||
69 | handleButtonEvents.writeEntry< uint >("powerButtonAction", LogoutDialogMode); | 72 | | ||
73 | handleButtonEvents.writeEntry< uint >("powerButtonAction", defaultPowerButtonAction); | ||||
74 | | ||||
70 | if (toRam) { | 75 | if (toRam) { | ||
71 | handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); | 76 | handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); | ||
72 | } else { | 77 | } else { | ||
73 | handleButtonEvents.writeEntry< uint >("lidAction", TurnOffScreenMode); | 78 | handleButtonEvents.writeEntry< uint >("lidAction", TurnOffScreenMode); | ||
74 | } | 79 | } | ||
75 | } | 80 | } | ||
76 | 81 | | |||
77 | // And we also want to turn off the screen after another while | 82 | // And we also want to turn off the screen after another while | ||
78 | { | 83 | { | ||
79 | KConfigGroup dpmsControl(&acProfile, "DPMSControl"); | 84 | KConfigGroup dpmsControl(&acProfile, "DPMSControl"); | ||
80 | dpmsControl.writeEntry< uint >("idleTime", 600); | 85 | dpmsControl.writeEntry< uint >("idleTime", 600); | ||
81 | } | 86 | } | ||
82 | 87 | | |||
83 | // Powersave | 88 | // Powersave | ||
84 | KConfigGroup batteryProfile(profilesConfig, "Battery"); | 89 | KConfigGroup batteryProfile(profilesConfig, "Battery"); | ||
85 | batteryProfile.writeEntry("icon", "battery-060"); | 90 | batteryProfile.writeEntry("icon", "battery-060"); | ||
86 | // We want to dim the screen after a while, definitely | 91 | // We want to dim the screen after a while, definitely | ||
87 | { | 92 | { | ||
88 | KConfigGroup dimDisplay(&batteryProfile, "DimDisplay"); | 93 | KConfigGroup dimDisplay(&batteryProfile, "DimDisplay"); | ||
89 | dimDisplay.writeEntry< int >("idleTime", 120000); | 94 | dimDisplay.writeEntry< int >("idleTime", 120000); | ||
90 | } | 95 | } | ||
91 | // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) | 96 | // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) | ||
92 | { | 97 | { | ||
93 | KConfigGroup handleButtonEvents(&batteryProfile, "HandleButtonEvents"); | 98 | KConfigGroup handleButtonEvents(&batteryProfile, "HandleButtonEvents"); | ||
94 | handleButtonEvents.writeEntry< uint >("powerButtonAction", LogoutDialogMode); | 99 | handleButtonEvents.writeEntry< uint >("powerButtonAction", defaultPowerButtonAction); | ||
95 | if (toRam) { | 100 | if (toRam) { | ||
96 | handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); | 101 | handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); | ||
97 | } else { | 102 | } else { | ||
98 | handleButtonEvents.writeEntry< uint >("lidAction", TurnOffScreenMode); | 103 | handleButtonEvents.writeEntry< uint >("lidAction", TurnOffScreenMode); | ||
99 | } | 104 | } | ||
100 | } | 105 | } | ||
101 | // We want to turn off the screen after another while | 106 | // We want to turn off the screen after another while | ||
102 | { | 107 | { | ||
Show All 19 Lines | |||||
122 | // We want to dim the screen after a while, definitely | 127 | // We want to dim the screen after a while, definitely | ||
123 | { | 128 | { | ||
124 | KConfigGroup dimDisplay(&lowBatteryProfile, "DimDisplay"); | 129 | KConfigGroup dimDisplay(&lowBatteryProfile, "DimDisplay"); | ||
125 | dimDisplay.writeEntry< int >("idleTime", 60000); | 130 | dimDisplay.writeEntry< int >("idleTime", 60000); | ||
126 | } | 131 | } | ||
127 | // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) | 132 | // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) | ||
128 | { | 133 | { | ||
129 | KConfigGroup handleButtonEvents(&lowBatteryProfile, "HandleButtonEvents"); | 134 | KConfigGroup handleButtonEvents(&lowBatteryProfile, "HandleButtonEvents"); | ||
130 | handleButtonEvents.writeEntry< uint >("powerButtonAction", LogoutDialogMode); | 135 | handleButtonEvents.writeEntry< uint >("powerButtonAction", defaultPowerButtonAction); | ||
131 | if (toRam) { | 136 | if (toRam) { | ||
132 | handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); | 137 | handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); | ||
133 | } else { | 138 | } else { | ||
134 | handleButtonEvents.writeEntry< uint >("lidAction", TurnOffScreenMode); | 139 | handleButtonEvents.writeEntry< uint >("lidAction", TurnOffScreenMode); | ||
135 | } | 140 | } | ||
136 | } | 141 | } | ||
137 | // We want to turn off the screen after another while | 142 | // We want to turn off the screen after another while | ||
138 | { | 143 | { | ||
Show All 15 Lines |