-rw-r--r-- | core/settings/light-and-power/light.cpp | 86 |
1 files changed, 20 insertions, 66 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index bf94a21..c021ad4 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -76,29 +76,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
76 | 76 | ||
77 | int interval; | ||
78 | // battery spinboxes | 77 | // battery spinboxes |
79 | interval = config.readNumEntry( "Interval_Dim", 20 ); | 78 | interval_dim->setValue( config.readNumEntry( "Dim", 20 )); |
80 | if ( config.readNumEntry("Dim",1) == 0 ) { | 79 | interval_lightoff->setValue( config.readNumEntry( "LightOff", 30 )); |
81 | interval_dim->setValue( 0 ); | 80 | interval_suspend->setValue( config.readNumEntry( "Suspend", 60 )); |
82 | } else { | ||
83 | interval_dim->setValue( interval ); | ||
84 | } | ||
85 | |||
86 | interval = config.readNumEntry( "Interval_LightOff", 30 ); | ||
87 | if ( config.readNumEntry("LightOff",1) == 0 ) { | ||
88 | interval_lightoff->setValue( 0 ); | ||
89 | } else { | ||
90 | interval_lightoff->setValue( interval ); | ||
91 | } | ||
92 | |||
93 | interval = config.readNumEntry( "Interval", 60 ); | ||
94 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) | ||
95 | |||
96 | if ( config.readNumEntry("NoApm", 0 ) == 1 ) { | ||
97 | interval_suspend->setValue( 0 ); | ||
98 | } else { | ||
99 | interval_suspend->setValue( interval ); | ||
100 | } | ||
101 | 81 | ||
102 | // battery check and slider | 82 | // battery check and slider |
103 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | 83 | LcdOffOnly->setChecked( config.readBoolEntry("LcdOffOnly",false)); |
104 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); | 84 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); |
@@ -118,28 +98,8 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
118 | // ac spinboxes | 98 | // ac spinboxes |
119 | interval = config.readNumEntry( "Interval_Dim", 20 ); | 99 | interval_dim_ac_3->setValue( config.readNumEntry( "Dim", 20 )); |
120 | if ( config.readNumEntry("Dim",1) == 0 ) { | 100 | interval_lightoff_ac_3->setValue( config.readNumEntry( "LightOff", 30 )); |
121 | interval_dim_ac_3->setValue( 0 ); | 101 | interval_suspend_ac_3->setValue( config.readNumEntry( "Suspend", 60 )); |
122 | } else { | ||
123 | interval_dim_ac_3->setValue( interval ); | ||
124 | } | ||
125 | |||
126 | interval = config.readNumEntry( "Interval_LightOff", 30 ); | ||
127 | if ( config.readNumEntry("LightOff",1) == 0 ) { | ||
128 | interval_lightoff_ac_3->setValue( 0 ); | ||
129 | } else { | ||
130 | interval_lightoff_ac_3->setValue( interval ); | ||
131 | } | ||
132 | |||
133 | interval = config.readNumEntry( "Interval", 60 ); | ||
134 | if ( interval > 3600 ) { | ||
135 | interval /= 1000; // compatibility (was millisecs) | ||
136 | } | ||
137 | if ( config.readNumEntry("NoApm", 1) == 1 ) { | ||
138 | interval_suspend_ac_3->setValue( 0 ); | ||
139 | } else { | ||
140 | interval_suspend_ac_3->setValue( interval ); | ||
141 | } | ||
142 | 102 | ||
143 | // ac check and slider | 103 | // ac check and slider |
144 | LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | 104 | LcdOffOnly_2_3->setChecked( config.readBoolEntry("LcdOffOnly",false)); |
145 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); | 105 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); |
@@ -200,4 +160,4 @@ void LightSettings::accept() | |||
200 | // bat | 160 | // bat |
201 | int i_dim = ( !( interval_dim->specialValueText() == tr("never") ) ? interval_dim->value() : 0); | 161 | int i_dim = interval_dim->value(); |
202 | int i_lightoff = ( !( interval_lightoff->specialValueText() == tr("never") ) ? interval_lightoff->value() : 0); | 162 | int i_lightoff = interval_lightoff->value(); |
203 | int i_suspend = interval_suspend->value(); | 163 | int i_suspend = interval_suspend->value(); |
@@ -207,4 +167,4 @@ void LightSettings::accept() | |||
207 | // ac | 167 | // ac |
208 | int i_dim_ac = ( !( interval_dim_ac_3->specialValueText() == tr("never") ) ? interval_dim_ac_3->value() : 0); | 168 | int i_dim_ac = interval_dim_ac_3->value(); |
209 | int i_lightoff_ac = ( !( interval_lightoff_ac_3->specialValueText() == tr("never") ) ? interval_lightoff_ac_3->value() : 0); | 169 | int i_lightoff_ac = interval_lightoff_ac_3->value(); |
210 | int i_suspend_ac = interval_suspend_ac_3->value(); | 170 | int i_suspend_ac = interval_suspend_ac_3->value(); |
@@ -218,9 +178,6 @@ void LightSettings::accept() | |||
218 | // bat | 178 | // bat |
219 | config.writeEntry( "Dim", interval_dim->specialValueText() == tr("never") ); | 179 | config.writeEntry( "LcdOffOnly", LcdOffOnly->isChecked() ); |
220 | config.writeEntry( "LightOff", interval_lightoff->specialValueText() == tr("never") ); | 180 | config.writeEntry( "Dim", interval_dim->value() ); |
221 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); | 181 | config.writeEntry( "LightOff", interval_lightoff->value() ); |
222 | config.writeEntry( "NoAPm", interval_suspend->specialValueText() == tr("never") ); | 182 | config.writeEntry( "Suspend", interval_suspend->value() ); |
223 | config.writeEntry( "Interval_Dim", interval_dim->value() ); | ||
224 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); | ||
225 | config.writeEntry( "Interval", interval_suspend->value() ); | ||
226 | config.writeEntry( "Brightness", | 183 | config.writeEntry( "Brightness", |
@@ -230,9 +187,6 @@ void LightSettings::accept() | |||
230 | config.setGroup( "AC" ); | 187 | config.setGroup( "AC" ); |
231 | config.writeEntry( "Dim", interval_dim_ac_3->specialValueText() == tr("never") ); | 188 | config.writeEntry( "LcdOffOnly", LcdOffOnly_2_3->isChecked() ); |
232 | config.writeEntry( "LightOff", interval_lightoff_ac_3->specialValueText() == tr("never") ); | 189 | config.writeEntry( "Dim", interval_dim_ac_3->value() ); |
233 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly_2_3->isChecked() ); | 190 | config.writeEntry( "LightOff", interval_lightoff_ac_3->value() ); |
234 | config.writeEntry( "NoAPm", interval_suspend_ac_3->specialValueText() == tr("never") ); | 191 | config.writeEntry( "Suspend", interval_suspend_ac_3->value() ); |
235 | config.writeEntry( "Interval_Dim", interval_dim_ac_3->value() ); | ||
236 | config.writeEntry( "Interval_LightOff", interval_lightoff_ac_3->value() ); | ||
237 | config.writeEntry( "Interval", interval_suspend_ac_3->value() ); | ||
238 | config.writeEntry( "Brightness", | 192 | config.writeEntry( "Brightness", |