Diffstat (limited to 'core/settings/light-and-power/light.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 387 |
1 files changed, 195 insertions, 192 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index d64a063..424a64c 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -26,20 +26,23 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "light.h" | 29 | #include "light.h" |
30 | #include "sensor.h" | 30 | #include "sensor.h" |
31 | 31 | ||
32 | /* OPIE */ | ||
32 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | #include <opie2/odebug.h> | ||
33 | 35 | ||
34 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
35 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
36 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 38 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
37 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
38 | #endif | 40 | #endif |
39 | 41 | ||
42 | /* QT */ | ||
40 | #include <qlabel.h> | 43 | #include <qlabel.h> |
41 | #include <qcheckbox.h> | 44 | #include <qcheckbox.h> |
42 | #include <qtabwidget.h> | 45 | #include <qtabwidget.h> |
43 | #include <qslider.h> | 46 | #include <qslider.h> |
44 | #include <qspinbox.h> | 47 | #include <qspinbox.h> |
45 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
@@ -48,267 +51,267 @@ | |||
48 | 51 | ||
49 | 52 | ||
50 | 53 | ||
51 | using namespace Opie::Core; | 54 | using namespace Opie::Core; |
52 | 55 | ||
53 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 56 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
54 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) | 57 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
55 | { | 58 | { |
56 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); | 59 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); |
57 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); | 60 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); |
58 | 61 | ||
59 | // check whether to show the light sensor stuff | 62 | // check whether to show the light sensor stuff |
60 | 63 | ||
61 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 64 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
62 | auto_brightness-> hide ( ); | 65 | auto_brightness-> hide ( ); |
63 | CalibrateLightSensor-> hide ( ); | 66 | CalibrateLightSensor-> hide ( ); |
64 | auto_brightness_ac-> hide ( ); | 67 | auto_brightness_ac-> hide ( ); |
65 | CalibrateLightSensor_ac-> hide ( ); | 68 | CalibrateLightSensor_ac-> hide ( ); |
66 | } | 69 | } |
67 | 70 | ||
68 | // check whether to show the contrast stuff | 71 | // check whether to show the contrast stuff |
69 | 72 | ||
70 | if (m_cres) { | 73 | if (m_cres) { |
71 | GroupLight->setTitle(tr("Backlight && Contrast")); | 74 | GroupLight->setTitle(tr("Backlight && Contrast")); |
72 | GroupLight_ac->setTitle(GroupLight->title()); | 75 | GroupLight_ac->setTitle(GroupLight->title()); |
73 | } else { | 76 | } else { |
74 | contrast->hide(); | 77 | contrast->hide(); |
75 | contrast_ac->hide(); | 78 | contrast_ac->hide(); |
76 | } | 79 | } |
77 | 80 | ||
78 | // check whether to show the cpu frequency stuff | 81 | // check whether to show the cpu frequency stuff |
79 | 82 | ||
80 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 83 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
81 | if ( freq.count() ) { | 84 | if ( freq.count() ) { |
82 | frequency->insertStrList( freq ); | 85 | frequency->insertStrList( freq ); |
83 | frequency_ac->insertStrList( freq ); | 86 | frequency_ac->insertStrList( freq ); |
84 | } else { | 87 | } else { |
85 | frequencyLabel->hide(); | 88 | frequencyLabel->hide(); |
86 | frequency->hide(); | 89 | frequency->hide(); |
87 | frequencyLabel_ac->hide(); | 90 | frequencyLabel_ac->hide(); |
88 | frequency_ac->hide(); | 91 | frequency_ac->hide(); |
89 | } | 92 | } |
90 | 93 | ||
91 | // check whether to show the hinge action stuff | 94 | // check whether to show the hinge action stuff |
92 | 95 | ||
93 | if ( !ODevice::inst()->hasHingeSensor() ) { | 96 | if ( !ODevice::inst()->hasHingeSensor() ) { |
94 | closeHingeLabel->hide(); | 97 | closeHingeLabel->hide(); |
95 | closeHingeAction->hide(); | 98 | closeHingeAction->hide(); |
96 | closeHingeLabel_ac->hide(); | 99 | closeHingeLabel_ac->hide(); |
97 | closeHingeAction_ac->hide(); | 100 | closeHingeAction_ac->hide(); |
98 | } | 101 | } |
99 | 102 | ||
100 | Config config ( "apm" ); | 103 | Config config ( "apm" ); |
101 | config. setGroup ( "Battery" ); | 104 | config. setGroup ( "Battery" ); |
102 | 105 | ||
103 | // battery spinboxes | 106 | // battery spinboxes |
104 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); | 107 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); |
105 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); | 108 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); |
106 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 109 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
107 | 110 | ||
108 | // battery check and slider | 111 | // battery check and slider |
109 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 112 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
110 | 113 | ||
111 | // CPU frequency | 114 | // CPU frequency |
112 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | 115 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); |
113 | 116 | ||
114 | // hinge action | 117 | // hinge action |
115 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 118 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
116 | 119 | ||
117 | int bright = config. readNumEntry ( "Brightness", 127 ); | 120 | int bright = config. readNumEntry ( "Brightness", 127 ); |
118 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 121 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
119 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 122 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
120 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); | 123 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); |
121 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); | 124 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); |
122 | brightness-> setValue ( bright ); | 125 | brightness-> setValue ( bright ); |
123 | 126 | ||
124 | if (m_cres) { | 127 | if (m_cres) { |
125 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 128 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
126 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); | 129 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); |
127 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); | 130 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); |
128 | contrast-> setValue ( contr ); | 131 | contrast-> setValue ( contr ); |
129 | } | 132 | } |
130 | 133 | ||
131 | // light sensor | 134 | // light sensor |
132 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 135 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
133 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); | 136 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); |
134 | 137 | ||
135 | config. setGroup ( "AC" ); | 138 | config. setGroup ( "AC" ); |
136 | 139 | ||
137 | // ac spinboxes | 140 | // ac spinboxes |
138 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); | 141 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); |
139 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); | 142 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); |
140 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); | 143 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); |
141 | 144 | ||
142 | // ac check and slider | 145 | // ac check and slider |
143 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 146 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
144 | 147 | ||
145 | // CPU frequency | 148 | // CPU frequency |
146 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); | 149 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); |
147 | 150 | ||
148 | // hinge action | 151 | // hinge action |
149 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 152 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
150 | 153 | ||
151 | bright = config. readNumEntry ( "Brightness", 255 ); | 154 | bright = config. readNumEntry ( "Brightness", 255 ); |
152 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 155 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
153 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); | 156 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); |
154 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); | 157 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); |
155 | brightness_ac-> setValue ( bright ); | 158 | brightness_ac-> setValue ( bright ); |
156 | 159 | ||
157 | if (m_cres) { | 160 | if (m_cres) { |
158 | contr = config. readNumEntry ( "Contrast", 127); | 161 | contr = config. readNumEntry ( "Contrast", 127); |
159 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 162 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
160 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); | 163 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); |
161 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); | 164 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); |
162 | contrast_ac-> setValue ( contr ); | 165 | contrast_ac-> setValue ( contr ); |
163 | } | 166 | } |
164 | 167 | ||
165 | // light sensor | 168 | // light sensor |
166 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 169 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
167 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); | 170 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); |
168 | 171 | ||
169 | // warnings | 172 | // warnings |
170 | config. setGroup ( "Warnings" ); | 173 | config. setGroup ( "Warnings" ); |
171 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); | 174 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); |
172 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); | 175 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); |
173 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); | 176 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); |
174 | 177 | ||
175 | m_resettimer = new QTimer ( this ); | 178 | m_resettimer = new QTimer ( this ); |
176 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); | 179 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); |
177 | 180 | ||
178 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 181 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
179 | tabs-> setCurrentPage ( 0 ); | 182 | tabs-> setCurrentPage ( 0 ); |
180 | } | 183 | } |
181 | else { | 184 | else { |
182 | tabs-> setCurrentPage ( 1 ); | 185 | tabs-> setCurrentPage ( 1 ); |
183 | } | 186 | } |
184 | 187 | ||
185 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 188 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
186 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 189 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
187 | if (m_cres) { | 190 | if (m_cres) { |
188 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 191 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
189 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 192 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
190 | } | 193 | } |
191 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 194 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
192 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 195 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
193 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 196 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
194 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 197 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
195 | } | 198 | } |
196 | 199 | ||
197 | LightSettings::~LightSettings ( ) | 200 | LightSettings::~LightSettings ( ) |
198 | { | 201 | { |
199 | } | 202 | } |
200 | 203 | ||
201 | void LightSettings::calibrateSensor ( ) | 204 | void LightSettings::calibrateSensor ( ) |
202 | { | 205 | { |
203 | Sensor *s = new Sensor ( m_sensordata, this ); | 206 | Sensor *s = new Sensor ( m_sensordata, this ); |
204 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 207 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
205 | QPEApplication::execDialog( s ); | 208 | QPEApplication::execDialog( s ); |
206 | delete s; | 209 | delete s; |
207 | } | 210 | } |
208 | 211 | ||
209 | void LightSettings::calibrateSensorAC ( ) | 212 | void LightSettings::calibrateSensorAC ( ) |
210 | { | 213 | { |
211 | Sensor *s = new Sensor ( m_sensordata_ac, this ); | 214 | Sensor *s = new Sensor ( m_sensordata_ac, this ); |
212 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 215 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
213 | QPEApplication::execDialog ( s ); | 216 | QPEApplication::execDialog ( s ); |
214 | delete s; | 217 | delete s; |
215 | } | 218 | } |
216 | 219 | ||
217 | void LightSettings::setBacklight ( int bright ) | 220 | void LightSettings::setBacklight ( int bright ) |
218 | { | 221 | { |
219 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | 222 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); |
220 | e << bright; | 223 | e << bright; |
221 | 224 | ||
222 | if ( bright != -1 ) { | 225 | if ( bright != -1 ) { |
223 | m_resettimer-> stop ( ); | 226 | m_resettimer-> stop ( ); |
224 | m_resettimer-> start ( 4000, true ); | 227 | m_resettimer-> start ( 4000, true ); |
225 | } | 228 | } |
226 | } | 229 | } |
227 | 230 | ||
228 | void LightSettings::setContrast ( int contr ) | 231 | void LightSettings::setContrast ( int contr ) |
229 | { | 232 | { |
230 | if (contr == -1) contr = m_oldcontrast; | 233 | if (contr == -1) contr = m_oldcontrast; |
231 | ODevice::inst ( )-> setDisplayContrast(contr); | 234 | ODevice::inst ( )-> setDisplayContrast(contr); |
232 | } | 235 | } |
233 | 236 | ||
234 | void LightSettings::setFrequency ( int index ) | 237 | void LightSettings::setFrequency ( int index ) |
235 | { | 238 | { |
236 | qWarning("LightSettings::setFrequency(%d)", index); | 239 | owarn << "LightSettings::setFrequency(" << index << ")" << oendl; |
237 | ODevice::inst ( )-> setCurrentCpuFrequency(index); | 240 | ODevice::inst ( )-> setCurrentCpuFrequency(index); |
238 | } | 241 | } |
239 | 242 | ||
240 | void LightSettings::resetBacklight ( ) | 243 | void LightSettings::resetBacklight ( ) |
241 | { | 244 | { |
242 | setBacklight ( -1 ); | 245 | setBacklight ( -1 ); |
243 | setContrast ( -1 ); | 246 | setContrast ( -1 ); |
244 | } | 247 | } |
245 | 248 | ||
246 | void LightSettings::setCloseHingeAction ( int index ) | 249 | void LightSettings::setCloseHingeAction ( int index ) |
247 | { | 250 | { |
248 | qWarning("LightSettings::setCloseHingeStatus(%d)", index); | 251 | owarn << "LightSettings::setCloseHingeStatus(" << index << ")" << oendl; |
249 | } | 252 | } |
250 | 253 | ||
251 | void LightSettings::accept ( ) | 254 | void LightSettings::accept ( ) |
252 | { | 255 | { |
253 | Config config ( "apm" ); | 256 | Config config ( "apm" ); |
254 | 257 | ||
255 | // bat | 258 | // bat |
256 | config. setGroup ( "Battery" ); | 259 | config. setGroup ( "Battery" ); |
257 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); | 260 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); |
258 | config. writeEntry ( "Dim", interval_dim-> value ( )); | 261 | config. writeEntry ( "Dim", interval_dim-> value ( )); |
259 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); | 262 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); |
260 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); | 263 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); |
261 | config. writeEntry ( "Brightness", brightness-> value () ); | 264 | config. writeEntry ( "Brightness", brightness-> value () ); |
262 | if (m_cres) | 265 | if (m_cres) |
263 | config. writeEntry ( "Contrast", contrast-> value () ); | 266 | config. writeEntry ( "Contrast", contrast-> value () ); |
264 | config. writeEntry ( "Freq", frequency->currentItem() ); | 267 | config. writeEntry ( "Freq", frequency->currentItem() ); |
265 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); | 268 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); |
266 | 269 | ||
267 | // ac | 270 | // ac |
268 | config. setGroup ( "AC" ); | 271 | config. setGroup ( "AC" ); |
269 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); | 272 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); |
270 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); | 273 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); |
271 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); | 274 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); |
272 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); | 275 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); |
273 | config. writeEntry ( "Brightness", brightness_ac-> value () ); | 276 | config. writeEntry ( "Brightness", brightness_ac-> value () ); |
274 | if (m_cres) | 277 | if (m_cres) |
275 | config. writeEntry ( "Contrast", contrast_ac-> value () ); | 278 | config. writeEntry ( "Contrast", contrast_ac-> value () ); |
276 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); | 279 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); |
277 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); | 280 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); |
278 | 281 | ||
279 | // only make light sensor stuff appear if the unit has a sensor | 282 | // only make light sensor stuff appear if the unit has a sensor |
280 | if ( ODevice::inst ( )-> hasLightSensor ( )) { | 283 | if ( ODevice::inst ( )-> hasLightSensor ( )) { |
281 | config. setGroup ( "Battery" ); | 284 | config. setGroup ( "Battery" ); |
282 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); | 285 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); |
283 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); | 286 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); |
284 | config. setGroup ( "AC" ); | 287 | config. setGroup ( "AC" ); |
285 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); | 288 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); |
286 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); | 289 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); |
287 | } | 290 | } |
288 | 291 | ||
289 | // advanced | 292 | // advanced |
290 | config. setGroup ( "Warnings" ); | 293 | config. setGroup ( "Warnings" ); |
291 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); | 294 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); |
292 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); | 295 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); |
293 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); | 296 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); |
294 | config. write ( ); | 297 | config. write ( ); |
295 | 298 | ||
296 | // notify the launcher | 299 | // notify the launcher |
297 | { | 300 | { |
298 | QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); | 301 | QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); |
299 | } | 302 | } |
300 | { | 303 | { |
301 | QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); | 304 | QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); |
302 | e << -1; | 305 | e << -1; |
303 | } | 306 | } |
304 | LightSettingsBase::accept ( ); | 307 | LightSettingsBase::accept ( ); |
305 | } | 308 | } |
306 | 309 | ||
307 | void LightSettings::done ( int r ) | 310 | void LightSettings::done ( int r ) |
308 | { | 311 | { |
309 | m_resettimer-> stop ( ); | 312 | m_resettimer-> stop ( ); |
310 | resetBacklight ( ); | 313 | resetBacklight ( ); |
311 | 314 | ||
312 | LightSettingsBase::done ( r ); | 315 | LightSettingsBase::done ( r ); |
313 | close ( ); | 316 | close ( ); |
314 | } | 317 | } |