|
|
@ -250,7 +250,7 @@ void HardwareInfo::processMessage (msg_type type, TQString message, TQString val
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (message.startsWith("DeviceRemoved")) {
|
|
|
|
} else if (message.startsWith("DeviceRemoved")) {
|
|
|
|
if (allUDIs.tqcontains(value)) {
|
|
|
|
if (allUDIs.contains(value)) {
|
|
|
|
if (checkIfHandleDevice(value, &_type)) {
|
|
|
|
if (checkIfHandleDevice(value, &_type)) {
|
|
|
|
switch (_type) {
|
|
|
|
switch (_type) {
|
|
|
|
case BATTERY:
|
|
|
|
case BATTERY:
|
|
|
@ -276,7 +276,7 @@ void HardwareInfo::processMessage (msg_type type, TQString message, TQString val
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case HAL_PROPERTY_CHANGED:
|
|
|
|
case HAL_PROPERTY_CHANGED:
|
|
|
|
if (!message.isEmpty() && allUDIs.tqcontains( message )) {
|
|
|
|
if (!message.isEmpty() && allUDIs.contains( message )) {
|
|
|
|
if (value.startsWith( "ac_adapter.present" )) {
|
|
|
|
if (value.startsWith( "ac_adapter.present" )) {
|
|
|
|
TQTimer::singleShot(50, this, TQT_SLOT(checkACAdapterState()));
|
|
|
|
TQTimer::singleShot(50, this, TQT_SLOT(checkACAdapterState()));
|
|
|
|
} else if (value.startsWith( "battery." )) {
|
|
|
|
} else if (value.startsWith( "battery." )) {
|
|
|
@ -442,9 +442,9 @@ bool HardwareInfo::checkIfHandleDevice ( TQString _udi, int *type) {
|
|
|
|
bool ret = true;
|
|
|
|
bool ret = true;
|
|
|
|
|
|
|
|
|
|
|
|
if (dbus_HAL->halGetPropertyStringList( _udi, "info.capabilities", &_cap) && !_cap.isEmpty()) {
|
|
|
|
if (dbus_HAL->halGetPropertyStringList( _udi, "info.capabilities", &_cap) && !_cap.isEmpty()) {
|
|
|
|
if (_cap.tqcontains("ac_adapter")) {
|
|
|
|
if (_cap.contains("ac_adapter")) {
|
|
|
|
*type = BATTERY;
|
|
|
|
*type = BATTERY;
|
|
|
|
} else if (_cap.tqcontains("button")) {
|
|
|
|
} else if (_cap.contains("button")) {
|
|
|
|
TQString _val;
|
|
|
|
TQString _val;
|
|
|
|
if (dbus_HAL->halGetPropertyString( _udi, "button.type", &_val)) {
|
|
|
|
if (dbus_HAL->halGetPropertyString( _udi, "button.type", &_val)) {
|
|
|
|
if (_val.startsWith("lid")) {
|
|
|
|
if (_val.startsWith("lid")) {
|
|
|
@ -459,9 +459,9 @@ bool HardwareInfo::checkIfHandleDevice ( TQString _udi, int *type) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ret = false;
|
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (_cap.tqcontains("battery")) {
|
|
|
|
} else if (_cap.contains("battery")) {
|
|
|
|
*type = BATTERY;
|
|
|
|
*type = BATTERY;
|
|
|
|
} else if (_cap.tqcontains("laptop_panel")) {
|
|
|
|
} else if (_cap.contains("laptop_panel")) {
|
|
|
|
*type = LAPTOP_PANEL;
|
|
|
|
*type = LAPTOP_PANEL;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ret = false;
|
|
|
|
ret = false;
|
|
|
@ -579,7 +579,7 @@ void HardwareInfo::checkSuspend() {
|
|
|
|
&_ret_b )) {
|
|
|
|
&_ret_b )) {
|
|
|
|
suspend_states.suspend2ram_can = _ret_b;
|
|
|
|
suspend_states.suspend2ram_can = _ret_b;
|
|
|
|
if (_ret_b) {
|
|
|
|
if (_ret_b) {
|
|
|
|
if (ret.tqcontains( "Suspend" )) {
|
|
|
|
if (ret.contains( "Suspend" )) {
|
|
|
|
suspend_states.suspend2ram = true;
|
|
|
|
suspend_states.suspend2ram = true;
|
|
|
|
suspend_states.suspend2ram_allowed = dbus_HAL->isUserPrivileged(PRIV_SUSPEND,
|
|
|
|
suspend_states.suspend2ram_allowed = dbus_HAL->isUserPrivileged(PRIV_SUSPEND,
|
|
|
|
HAL_COMPUTER_UDI);
|
|
|
|
HAL_COMPUTER_UDI);
|
|
|
@ -600,7 +600,7 @@ void HardwareInfo::checkSuspend() {
|
|
|
|
&_ret_b )) {
|
|
|
|
&_ret_b )) {
|
|
|
|
suspend_states.suspend2disk_can = _ret_b;
|
|
|
|
suspend_states.suspend2disk_can = _ret_b;
|
|
|
|
if (_ret_b) {
|
|
|
|
if (_ret_b) {
|
|
|
|
if (ret.tqcontains( "Hibernate" )) {
|
|
|
|
if (ret.contains( "Hibernate" )) {
|
|
|
|
suspend_states.suspend2disk = true;
|
|
|
|
suspend_states.suspend2disk = true;
|
|
|
|
suspend_states.suspend2disk_allowed =
|
|
|
|
suspend_states.suspend2disk_allowed =
|
|
|
|
dbus_HAL->isUserPrivileged(PRIV_HIBERNATE,
|
|
|
|
dbus_HAL->isUserPrivileged(PRIV_HIBERNATE,
|
|
|
@ -620,7 +620,7 @@ void HardwareInfo::checkSuspend() {
|
|
|
|
if (dbus_HAL->halGetPropertyBool( HAL_COMPUTER_UDI, "power_management.can_standby", &_ret_b )) {
|
|
|
|
if (dbus_HAL->halGetPropertyBool( HAL_COMPUTER_UDI, "power_management.can_standby", &_ret_b )) {
|
|
|
|
suspend_states.standby_can = _ret_b;
|
|
|
|
suspend_states.standby_can = _ret_b;
|
|
|
|
if (_ret_b) {
|
|
|
|
if (_ret_b) {
|
|
|
|
if (ret.tqcontains( "Standby" )) {
|
|
|
|
if (ret.contains( "Standby" )) {
|
|
|
|
suspend_states.standby = true;
|
|
|
|
suspend_states.standby = true;
|
|
|
|
suspend_states.standby_allowed = dbus_HAL->isUserPrivileged(PRIV_STANDBY,
|
|
|
|
suspend_states.standby_allowed = dbus_HAL->isUserPrivileged(PRIV_STANDBY,
|
|
|
|
HAL_COMPUTER_UDI);
|
|
|
|
HAL_COMPUTER_UDI);
|
|
|
@ -740,7 +740,7 @@ void HardwareInfo::checkBrightness() {
|
|
|
|
// we should asume there is only one laptop panel device in the system
|
|
|
|
// we should asume there is only one laptop panel device in the system
|
|
|
|
if (dbus_HAL->halGetPropertyInt(devices.first(), "laptop_panel.num_levels", &retval )) {
|
|
|
|
if (dbus_HAL->halGetPropertyInt(devices.first(), "laptop_panel.num_levels", &retval )) {
|
|
|
|
udis.insert("laptop_panel", new TQString( devices.first() ));
|
|
|
|
udis.insert("laptop_panel", new TQString( devices.first() ));
|
|
|
|
if (!allUDIs.tqcontains( devices.first() ))
|
|
|
|
if (!allUDIs.contains( devices.first() ))
|
|
|
|
allUDIs.append( devices.first() );
|
|
|
|
allUDIs.append( devices.first() );
|
|
|
|
|
|
|
|
|
|
|
|
if (retval > 1) {
|
|
|
|
if (retval > 1) {
|
|
|
@ -808,7 +808,7 @@ bool HardwareInfo::intialiseHWInfo() {
|
|
|
|
for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
|
|
|
|
for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
|
|
|
|
// we need a deep copy
|
|
|
|
// we need a deep copy
|
|
|
|
udis.insert("acadapter", new TQString( *it ));
|
|
|
|
udis.insert("acadapter", new TQString( *it ));
|
|
|
|
if (!allUDIs.tqcontains( *it ))
|
|
|
|
if (!allUDIs.contains( *it ))
|
|
|
|
allUDIs.append( *it );
|
|
|
|
allUDIs.append( *it );
|
|
|
|
checkACAdapterState();
|
|
|
|
checkACAdapterState();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -821,7 +821,7 @@ bool HardwareInfo::intialiseHWInfo() {
|
|
|
|
for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
|
|
|
|
for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
|
|
|
|
// we need a deep copy
|
|
|
|
// we need a deep copy
|
|
|
|
udis.insert("lidclose", new TQString( *it ));
|
|
|
|
udis.insert("lidclose", new TQString( *it ));
|
|
|
|
if (!allUDIs.tqcontains( *it ))
|
|
|
|
if (!allUDIs.contains( *it ))
|
|
|
|
allUDIs.append( *it );
|
|
|
|
allUDIs.append( *it );
|
|
|
|
checkLidcloseState();
|
|
|
|
checkLidcloseState();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -834,7 +834,7 @@ bool HardwareInfo::intialiseHWInfo() {
|
|
|
|
if (!ret.isEmpty()) {
|
|
|
|
if (!ret.isEmpty()) {
|
|
|
|
// there should be normaly only one device, but let be sure
|
|
|
|
// there should be normaly only one device, but let be sure
|
|
|
|
for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
|
|
|
|
for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
|
|
|
|
if (!allUDIs.tqcontains( *it ))
|
|
|
|
if (!allUDIs.contains( *it ))
|
|
|
|
allUDIs.append( *it );
|
|
|
|
allUDIs.append( *it );
|
|
|
|
BatteryList.append( new Battery(dbus_HAL, *it) );
|
|
|
|
BatteryList.append( new Battery(dbus_HAL, *it) );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -910,7 +910,7 @@ void HardwareInfo::checkLidcloseState() {
|
|
|
|
void HardwareInfo::updateBatteryValues (TQString udi, TQString property) {
|
|
|
|
void HardwareInfo::updateBatteryValues (TQString udi, TQString property) {
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
|
|
if (!udi.isEmpty() && allUDIs.tqcontains( udi )) {
|
|
|
|
if (!udi.isEmpty() && allUDIs.contains( udi )) {
|
|
|
|
// find effected battery object
|
|
|
|
// find effected battery object
|
|
|
|
Battery *bat;
|
|
|
|
Battery *bat;
|
|
|
|
for (bat = BatteryList.first(); bat; bat = BatteryList.next() ) {
|
|
|
|
for (bat = BatteryList.first(); bat; bat = BatteryList.next() ) {
|
|
|
|