--- kpowersave-0.7.2/src/configuredialog.h.unique_brightness_level 2007-02-14 19:05:09.000000000 +0100 +++ kpowersave-0.7.2/src/configuredialog.h 2007-08-20 23:00:35.000000000 +0200 @@ -82,8 +82,6 @@ private: bool scheme_changed; //! true if the warning message was displayed , else if not! bool displayed_WARN_autosuspend; - //! true if machine support set brightness - bool brightness_supported; //! true if the brightness was changed bool brightness_changed; --- kpowersave-0.7.2/src/detaileddialog.cpp.unique_brightness_level 2007-02-14 19:05:09.000000000 +0100 +++ kpowersave-0.7.2/src/detaileddialog.cpp 2007-08-20 23:00:35.000000000 +0200 @@ -463,7 +463,7 @@ void detaileddialog::setInfos() { } } - if(hwinfo->getMaxBrightnessLevel() > 0) { + if(hwinfo->supportBrightness()) { display += i18n("Set brightness supported:") + "\n"; displayValue += i18n("yes") + "\n"; } else { --- kpowersave-0.7.2/src/hardware.cpp.unique_brightness_level 2007-08-20 23:00:35.000000000 +0200 +++ kpowersave-0.7.2/src/hardware.cpp 2007-08-20 23:08:02.000000000 +0200 @@ -46,6 +46,7 @@ HardwareInfo::HardwareInfo() { hal_terminated = true; laptop = false; brightness = false; + brightness_in_hardware = false; // update everything the first time update_info_ac_changed = true; @@ -584,7 +585,7 @@ void HardwareInfo::checkBrightness() { } else { int retval; - brightness = true; + myDebug("HardwareInfo::checkBrightness: %s", devices.first().latin1()); // we should asume there is only one laptop panel device in the system @@ -592,11 +593,19 @@ void HardwareInfo::checkBrightness() { udis.insert("laptop_panel", new QString( devices.first() )); if (!allUDIs.contains( devices.first() )) allUDIs.append( devices.first() ); - availableBrightnessLevels = retval; + + if (retval > 1) { + dbus_HAL->halGetPropertyBool(devices.first(), "laptop_panel.brightness_in_hardware", + &brightness_in_hardware); + + availableBrightnessLevels = retval; + brightness = true; + // get the current level via GetBrightness + checkCurrentBrightness(); + } else { + myDebug("Found a Panel, but laptop_panel.num_levels < 2, which means KPowersave can't set usefull values"); + } } - - // get the current level via GetBrightness - checkCurrentBrightness(); } } } --- kpowersave-0.7.2/src/configuredialog.cpp.unique_brightness_level 2007-08-20 23:00:35.000000000 +0200 +++ kpowersave-0.7.2/src/configuredialog.cpp 2007-08-20 23:00:35.000000000 +0200 @@ -72,13 +72,11 @@ ConfigureDialog::ConfigureDialog( KConfi scheme_changed = false; displayed_WARN_autosuspend = false; - // check if brightness is supported - if((brightnessLevels = (hwinfo->getMaxBrightnessLevel()-1)) >= 0) { - brightness_supported = true; + if(hwinfo->supportBrightness()) { + brightnessLevels = hwinfo->getMaxBrightnessLevel() -1; brightness_last = hwinfo->getCurrentBrightnessLevel(); - } - else { - brightness_supported = false; + } else { + brightnessLevels = -1; brightness_last = -1; } brightness_changed = false; @@ -486,7 +484,7 @@ void ConfigureDialog::setConfigToDialog( else kconfig->setGroup("default-scheme"); } - if (brightness_supported) { + if (hwinfo->supportBrightness()) { // enable the widgets cB_Brightness->setEnabled(true); cB_Brightness_toggled(kconfig->readBoolEntry("enableBrightness",false)); @@ -613,19 +611,19 @@ void ConfigureDialog::setGeneralSettings QStringList _actions = kconfig->readListEntry("batteryAllowedActions", QString()); _select = kconfig->readEntry("batteryWarningAction", QString()); fillActionComboBox(cB_batWarning, _actions, _select); - if (_select == "BRIGHTNESS" && brightness_supported) { + if (_select == "BRIGHTNESS" && hwinfo->supportBrightness()) { sB_batWarnAction_value->show(); sB_batWarnAction_value->setValue(kconfig->readNumEntry( "batteryWarningActionValue",0)); } _select = kconfig->readEntry("batteryLowAction", QString()); fillActionComboBox(cB_batLow, _actions, _select); - if (_select == "BRIGHTNESS" && brightness_supported) { + if (_select == "BRIGHTNESS" && hwinfo->supportBrightness()) { sB_batLowAction_value->show(); sB_batLowAction_value->setValue( kconfig->readNumEntry( "batteryLowActionValue",0)); } _select = kconfig->readEntry("batteryCriticalAction", QString()); fillActionComboBox(cB_batCritical, _actions, _select); - if (_select == "BRIGHTNESS" && brightness_supported) { + if (_select == "BRIGHTNESS" && hwinfo->supportBrightness()) { sB_batCritAction_value->show(); sB_batCritAction_value->setValue(kconfig->readNumEntry("batteryCriticalActionValue",0)); } @@ -1433,7 +1431,7 @@ QString ConfigureDialog::mapActionToDesc else return QString(); } else if (action.startsWith("BRIGHTNESS")) { - if (brightness_supported) + if (hwinfo->supportBrightness()) return i18n("Set Brightness to"); else return QString(); --- kpowersave-0.7.2/src/hardware.h.unique_brightness_level 2007-02-14 19:05:09.000000000 +0100 +++ kpowersave-0.7.2/src/hardware.h 2007-08-20 23:00:35.000000000 +0200 @@ -208,6 +208,14 @@ private: * \li false: else */ bool brightness; + //! if brightness get controled via keyevents in hardware + /*! + * This boolean represent information if the machine handle brightness button + * and keyevents in hardware. If so KPowersave should ignore key events. + * \li true: if handled in hardware + * \li false: else + */ + bool brightness_in_hardware; //! if the machine is a laptop /*! * This boolean represent information if the machine is a laptop.