-rw-r--r-- | core/settings/light-and-power/light.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index c021ad4..aa36e06 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp @@ -140,102 +140,107 @@ static void set_fl(int bright) { qDebug ( QString( "Brightness" ).arg( bright ) ); QCopEnvelope e("QPE/System", "setBacklight(int)" ); e << bright; } void LightSettings::reject() { set_fl(initbright); QDialog::reject(); } void LightSettings::accept() { if ( qApp->focusWidget() ) { qApp->focusWidget()->clearFocus(); } applyBrightness(); // bat int i_dim = interval_dim->value(); int i_lightoff = interval_lightoff->value(); int i_suspend = interval_suspend->value(); - QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); - e << i_dim << i_lightoff << i_suspend; // ac int i_dim_ac = interval_dim_ac_3->value(); int i_lightoff_ac = interval_lightoff_ac_3->value(); int i_suspend_ac = interval_suspend_ac_3->value(); - QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" ); - e << i_dim_ac << i_lightoff_ac << i_suspend_ac; Config config( "apm" ); config.setGroup( "Battery" ); // bat config.writeEntry( "LcdOffOnly", LcdOffOnly->isChecked() ); - config.writeEntry( "Dim", interval_dim->value() ); - config.writeEntry( "LightOff", interval_lightoff->value() ); - config.writeEntry( "Suspend", interval_suspend->value() ); + config.writeEntry( "Dim", i_dim ); + config.writeEntry( "LightOff", i_lightoff ); + config.writeEntry( "Suspend", i_suspend ); config.writeEntry( "Brightness", ( brightness->value() ) * 255 / brightness->maxValue() ); // ac config.setGroup( "AC" ); config.writeEntry( "LcdOffOnly", LcdOffOnly_2_3->isChecked() ); - config.writeEntry( "Dim", interval_dim_ac_3->value() ); - config.writeEntry( "LightOff", interval_lightoff_ac_3->value() ); - config.writeEntry( "Suspend", interval_suspend_ac_3->value() ); + config.writeEntry( "Dim", i_dim_ac ); + config.writeEntry( "LightOff", i_lightoff_ac ); + config.writeEntry( "Suspend", i_suspend_ac ); config.writeEntry( "Brightness", ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() ); // only make light sensor stuff appear if the unit has a sensor if ( ODevice::inst()->hasLightSensor() ) { - config.setGroup( "lightsensor" ); config.setGroup( "Battery" ); config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); config.setGroup( "AC" ); config.writeEntry( "LightSensor", (int)auto_brightness_ac_3->isChecked() ); //config.writeEntry( "Steps", LightStepSpin->value() ); //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); //config.writeEntry( "Shift", LightShiftSpin->value() ); } // advanced config.setGroup( "Warnings" ); config.writeEntry( "check_interval", warnintervalBox->value()*1000 ); config.writeEntry( "power_verylow", lowSpinBox->value() ); config.writeEntry( "power_critical", criticalSpinBox->value() ); - QCopEnvelope e_warn("QPE/System", "reloadPowerWarnSettings()"); - config.write(); + { + QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); + } + { + QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); + e << -1; + } + { + QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); + e << -1; + } + QDialog::accept(); } void LightSettings::applyBrightness() { if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { int bright = ( brightness->value() ) * 255 / brightness->maxValue(); set_fl(bright); } } void LightSettings::applyBrightnessAC() { // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) { int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); set_fl(bright); } } void LightSettings::done(int r) { QDialog::done(r); close(); |