-rw-r--r-- | core/settings/light-and-power/light.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 1c61787..d0ac878 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -1,320 +1,320 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
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 | /* OPIE */ |
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 38 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qcheckbox.h> | 44 | #include <qcheckbox.h> |
45 | #include <qtabwidget.h> | 45 | #include <qtabwidget.h> |
46 | #include <qslider.h> | 46 | #include <qslider.h> |
47 | #include <qspinbox.h> | 47 | #include <qspinbox.h> |
48 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
49 | #include <qgroupbox.h> | 49 | #include <qgroupbox.h> |
50 | #include <qcombobox.h> | 50 | #include <qcombobox.h> |
51 | 51 | ||
52 | 52 | ||
53 | 53 | ||
54 | using namespace Opie::Core; | 54 | using namespace Opie::Core; |
55 | 55 | ||
56 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 56 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
57 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) | 57 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
58 | { | 58 | { |
59 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); | 59 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); |
60 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); | 60 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); |
61 | 61 | ||
62 | // check whether to show the light sensor stuff | 62 | // check whether to show the light sensor stuff |
63 | 63 | ||
64 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 64 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
65 | auto_brightness-> hide ( ); | 65 | auto_brightness-> hide ( ); |
66 | CalibrateLightSensor-> hide ( ); | 66 | CalibrateLightSensor-> hide ( ); |
67 | auto_brightness_ac-> hide ( ); | 67 | auto_brightness_ac-> hide ( ); |
68 | CalibrateLightSensor_ac-> hide ( ); | 68 | CalibrateLightSensor_ac-> hide ( ); |
69 | } | 69 | } |
70 | 70 | ||
71 | // check whether to show the contrast stuff | 71 | // check whether to show the contrast stuff |
72 | 72 | ||
73 | if (m_cres) { | 73 | if (m_cres) { |
74 | GroupLight->setTitle(tr("Backlight && Contrast")); | 74 | GroupLight->setTitle(tr("Backlight && Contrast")); |
75 | GroupLight_ac->setTitle(GroupLight->title()); | 75 | GroupLight_ac->setTitle(GroupLight->title()); |
76 | } else { | 76 | } else { |
77 | contrast->hide(); | 77 | contrast->hide(); |
78 | contrast_ac->hide(); | 78 | contrast_ac->hide(); |
79 | } | 79 | } |
80 | 80 | ||
81 | // check whether to show the cpu frequency stuff | 81 | // check whether to show the cpu frequency stuff |
82 | 82 | ||
83 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 83 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
84 | if ( freq.count() ) { | 84 | if ( freq.count() ) { |
85 | frequency->insertStrList( freq ); | 85 | frequency->insertStrList( freq ); |
86 | frequency_ac->insertStrList( freq ); | 86 | frequency_ac->insertStrList( freq ); |
87 | } else { | 87 | } else { |
88 | frequencyLabel->hide(); | 88 | frequencyLabel->hide(); |
89 | frequency->hide(); | 89 | frequency->hide(); |
90 | frequencyLabel_ac->hide(); | 90 | frequencyLabel_ac->hide(); |
91 | frequency_ac->hide(); | 91 | frequency_ac->hide(); |
92 | } | 92 | } |
93 | 93 | ||
94 | // check whether to show the hinge action stuff | 94 | // check whether to show the hinge action stuff |
95 | 95 | ||
96 | if ( !ODevice::inst()->hasHingeSensor() ) { | 96 | if ( !ODevice::inst()->hasHingeSensor() ) { |
97 | closeHingeLabel->hide(); | 97 | closeHingeLabel->hide(); |
98 | closeHingeAction->hide(); | 98 | closeHingeAction->hide(); |
99 | closeHingeLabel_ac->hide(); | 99 | closeHingeLabel_ac->hide(); |
100 | closeHingeAction_ac->hide(); | 100 | closeHingeAction_ac->hide(); |
101 | } | 101 | } |
102 | 102 | ||
103 | Config config ( "apm" ); | 103 | Config config ( "apm" ); |
104 | config. setGroup ( "Battery" ); | 104 | config. setGroup ( "Battery" ); |
105 | 105 | ||
106 | // battery spinboxes | 106 | // battery spinboxes |
107 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); | 107 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); |
108 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); | 108 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); |
109 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 109 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
110 | 110 | ||
111 | // battery check and slider | 111 | // battery check and slider |
112 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 112 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
113 | 113 | ||
114 | // CPU frequency | 114 | // CPU frequency |
115 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | 115 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); |
116 | 116 | ||
117 | // hinge action | 117 | // hinge action |
118 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 118 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
119 | 119 | ||
120 | int bright = config. readNumEntry ( "Brightness", 127 ); | 120 | int bright = config. readNumEntry ( "Brightness", 127 ); |
121 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 121 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
122 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 122 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
123 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); | 123 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); |
124 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); | 124 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); |
125 | brightness-> setValue ( bright ); | 125 | brightness-> setValue ( bright ); |
126 | 126 | ||
127 | // | 127 | // |
128 | if (m_cres) { | 128 | if (m_cres) { |
129 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 129 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
130 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); | 130 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); |
131 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); | 131 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); |
132 | contrast-> setValue ( contr ); | 132 | contrast-> setValue ( contr ); |
133 | } | 133 | } |
134 | 134 | ||
135 | // light sensor | 135 | // light sensor |
136 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 136 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
137 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); | 137 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); |
138 | 138 | ||
139 | config. setGroup ( "AC" ); | 139 | config. setGroup ( "AC" ); |
140 | 140 | ||
141 | // ac spinboxes | 141 | // ac spinboxes |
142 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); | 142 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); |
143 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); | 143 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); |
144 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); | 144 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); |
145 | 145 | ||
146 | // ac check and slider | 146 | // ac check and slider |
147 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 147 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
148 | 148 | ||
149 | // CPU frequency | 149 | // CPU frequency |
150 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); | 150 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); |
151 | 151 | ||
152 | // hinge action | 152 | // hinge action |
153 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 153 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
154 | 154 | ||
155 | bright = config. readNumEntry ( "Brightness", 255 ); | 155 | bright = config. readNumEntry ( "Brightness", 255 ); |
156 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 156 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
157 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); | 157 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); |
158 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); | 158 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); |
159 | brightness_ac-> setValue ( bright ); | 159 | brightness_ac-> setValue ( bright ); |
160 | 160 | ||
161 | if (m_cres) { | 161 | if (m_cres) { |
162 | contr = config. readNumEntry ( "Contrast", 127); | 162 | contr = config. readNumEntry ( "Contrast", 127); |
163 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 163 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
164 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); | 164 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); |
165 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); | 165 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); |
166 | contrast_ac-> setValue ( contr ); | 166 | contrast_ac-> setValue ( contr ); |
167 | } | 167 | } |
168 | 168 | ||
169 | // light sensor | 169 | // light sensor |
170 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 170 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
171 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); | 171 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); |
172 | 172 | ||
173 | // warnings | 173 | // warnings |
174 | config. setGroup ( "Warnings" ); | 174 | config. setGroup ( "Warnings" ); |
175 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); | 175 | warnintervalBox-> setValue ( config. readNumEntry ( "check_interval", 10000 ) / 1000 ); |
176 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); | 176 | lowSpinBox-> setValue ( config. readNumEntry ( "power_verylow", 10 ) ); |
177 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); | 177 | criticalSpinBox-> setValue ( config. readNumEntry ( "power_critical", 5 ) ); |
178 | 178 | ||
179 | m_resettimer = new QTimer ( this ); | 179 | m_resettimer = new QTimer ( this ); |
180 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); | 180 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); |
181 | 181 | ||
182 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 182 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
183 | tabs-> setCurrentPage ( 0 ); | 183 | tabs-> setCurrentPage ( 0 ); |
184 | brightness->setFocus(); | 184 | brightness->setFocus(); |
185 | } | 185 | } |
186 | else { | 186 | else { |
187 | tabs-> setCurrentPage ( 1 ); | 187 | tabs-> setCurrentPage ( 1 ); |
188 | brightness_ac->setFocus(); | 188 | brightness_ac->setFocus(); |
189 | } | 189 | } |
190 | 190 | ||
191 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 191 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
192 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 192 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
193 | if (m_cres) { | 193 | if (m_cres) { |
194 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 194 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
195 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 195 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
196 | } | 196 | } |
197 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 197 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
198 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 198 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
199 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 199 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
200 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 200 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
201 | } | 201 | } |
202 | 202 | ||
203 | LightSettings::~LightSettings ( ) | 203 | LightSettings::~LightSettings ( ) |
204 | { | 204 | { |
205 | } | 205 | } |
206 | 206 | ||
207 | void LightSettings::calibrateSensor ( ) | 207 | void LightSettings::calibrateSensor ( ) |
208 | { | 208 | { |
209 | Sensor *s = new Sensor ( m_sensordata, this ); | 209 | Sensor *s = new Sensor ( m_sensordata, this ); |
210 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 210 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
211 | QPEApplication::execDialog( s ); | 211 | QPEApplication::execDialog( s ); |
212 | delete s; | 212 | delete s; |
213 | } | 213 | } |
214 | 214 | ||
215 | void LightSettings::calibrateSensorAC ( ) | 215 | void LightSettings::calibrateSensorAC ( ) |
216 | { | 216 | { |
217 | Sensor *s = new Sensor ( m_sensordata_ac, this ); | 217 | Sensor *s = new Sensor ( m_sensordata_ac, this ); |
218 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 218 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
219 | QPEApplication::execDialog ( s ); | 219 | QPEApplication::execDialog ( s ); |
220 | delete s; | 220 | delete s; |
221 | } | 221 | } |
222 | 222 | ||
223 | void LightSettings::setBacklight ( int bright ) | 223 | void LightSettings::setBacklight ( int bright ) |
224 | { | 224 | { |
225 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | 225 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); |
226 | e << bright; | 226 | e << bright; |
227 | 227 | ||
228 | if ( bright != -1 ) { | 228 | if ( bright != -1 ) { |
229 | m_resettimer-> stop ( ); | 229 | m_resettimer-> stop ( ); |
230 | m_resettimer-> start ( 4000, true ); | 230 | m_resettimer-> start ( 4000, true ); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | void LightSettings::setContrast ( int contr ) | 234 | void LightSettings::setContrast ( int contr ) |
235 | { | 235 | { |
236 | if (contr == -1) contr = m_oldcontrast; | 236 | if (contr == -1) contr = m_oldcontrast; |
237 | ODevice::inst ( )-> setDisplayContrast(contr); | 237 | ODevice::inst ( )-> setDisplayContrast(contr); |
238 | } | 238 | } |
239 | 239 | ||
240 | void LightSettings::setFrequency ( int index ) | 240 | void LightSettings::setFrequency ( int index ) |
241 | { | 241 | { |
242 | owarn << "LightSettings::setFrequency(" << index << ")" << oendl; | 242 | owarn << "LightSettings::setFrequency(" << index << ")" << oendl; |
243 | ODevice::inst ( )-> setCurrentCpuFrequency(index); | 243 | ODevice::inst ( )-> setCurrentCpuFrequency(index); |
244 | } | 244 | } |
245 | 245 | ||
246 | void LightSettings::resetBacklight ( ) | 246 | void LightSettings::resetBacklight ( ) |
247 | { | 247 | { |
248 | setBacklight ( -1 ); | 248 | setBacklight ( -1 ); |
249 | setContrast ( -1 ); | 249 | setContrast ( -1 ); |
250 | } | 250 | } |
251 | 251 | ||
252 | void LightSettings::setCloseHingeAction ( int index ) | 252 | void LightSettings::setCloseHingeAction ( int index ) |
253 | { | 253 | { |
254 | owarn << "LightSettings::setCloseHingeStatus(" << index << ")" << oendl; | 254 | owarn << "LightSettings::setCloseHingeStatus(" << index << ")" << oendl; |
255 | } | 255 | } |
256 | 256 | ||
257 | void LightSettings::accept ( ) | 257 | void LightSettings::accept ( ) |
258 | { | 258 | { |
259 | Config config ( "apm" ); | 259 | Config config ( "apm" ); |
260 | 260 | ||
261 | // bat | 261 | // bat |
262 | config. setGroup ( "Battery" ); | 262 | config. setGroup ( "Battery" ); |
263 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); | 263 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); |
264 | config. writeEntry ( "Dim", interval_dim-> value ( )); | 264 | config. writeEntry ( "Dim", interval_dim-> value ( )); |
265 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); | 265 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); |
266 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); | 266 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); |
267 | config. writeEntry ( "Brightness", brightness-> value () ); | 267 | config. writeEntry ( "Brightness", brightness-> value () ); |
268 | if (m_cres) | 268 | if (m_cres) |
269 | config. writeEntry ( "Contrast", contrast-> value () ); | 269 | config. writeEntry ( "Contrast", contrast-> value () ); |
270 | config. writeEntry ( "Freq", frequency->currentItem() ); | 270 | config. writeEntry ( "Freq", frequency->currentItem() ); |
271 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); | 271 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); |
272 | 272 | ||
273 | // ac | 273 | // ac |
274 | config. setGroup ( "AC" ); | 274 | config. setGroup ( "AC" ); |
275 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); | 275 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); |
276 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); | 276 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); |
277 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); | 277 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); |
278 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); | 278 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); |
279 | config. writeEntry ( "Brightness", brightness_ac-> value () ); | 279 | config. writeEntry ( "Brightness", brightness_ac-> value () ); |
280 | if (m_cres) | 280 | if (m_cres) |
281 | config. writeEntry ( "Contrast", contrast_ac-> value () ); | 281 | config. writeEntry ( "Contrast", contrast_ac-> value () ); |
282 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); | 282 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); |
283 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); | 283 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); |
284 | 284 | ||
285 | // only make light sensor stuff appear if the unit has a sensor | 285 | // only make light sensor stuff appear if the unit has a sensor |
286 | if ( ODevice::inst ( )-> hasLightSensor ( )) { | 286 | if ( ODevice::inst ( )-> hasLightSensor ( )) { |
287 | config. setGroup ( "Battery" ); | 287 | config. setGroup ( "Battery" ); |
288 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); | 288 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); |
289 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); | 289 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); |
290 | config. setGroup ( "AC" ); | 290 | config. setGroup ( "AC" ); |
291 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); | 291 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); |
292 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); | 292 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); |
293 | } | 293 | } |
294 | 294 | ||
295 | // advanced | 295 | // advanced |
296 | config. setGroup ( "Warnings" ); | 296 | config. setGroup ( "Warnings" ); |
297 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); | 297 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); |
298 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); | 298 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); |
299 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); | 299 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); |
300 | config. write ( ); | 300 | config. write ( ); |
301 | 301 | ||
302 | // notify the launcher | 302 | // notify the launcher |
303 | { | 303 | { |
304 | QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); | 304 | QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); |
305 | } | 305 | } |
306 | { | 306 | { |
307 | QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); | 307 | QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); |
308 | e << -1; | 308 | e << -1; |
309 | } | 309 | } |
310 | LightSettingsBase::accept ( ); | 310 | LightSettingsBase::accept ( ); |
311 | } | 311 | } |
312 | 312 | ||
313 | void LightSettings::done ( int r ) | 313 | void LightSettings::done ( int r ) |
314 | { | 314 | { |
315 | m_resettimer-> stop ( ); | 315 | m_resettimer-> stop ( ); |
316 | resetBacklight ( ); | 316 | resetBacklight ( ); |
317 | 317 | ||
318 | LightSettingsBase::done ( r ); | 318 | LightSettingsBase::done ( r ); |
319 | close ( ); | 319 | close ( ); |
320 | } | 320 | } |