|
|
@ -42,7 +42,7 @@ dbusInterface::dbusInterface(){
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
|
|
dbus_is_connected = false;
|
|
|
|
dbus_is_connected = false;
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
|
|
|
|
|
|
|
|
// add pointer to this for filter_function()
|
|
|
|
// add pointer to this for filter_function()
|
|
|
|
myInstance=this;
|
|
|
|
myInstance=this;
|
|
|
@ -79,11 +79,11 @@ bool dbusInterface::isConnectedToDBUS() {
|
|
|
|
* This function return information if the org.freedesktop.Policy.Power
|
|
|
|
* This function return information if the org.freedesktop.Policy.Power
|
|
|
|
* interface was claimed.
|
|
|
|
* interface was claimed.
|
|
|
|
* \return boolean with the status of claim the interface
|
|
|
|
* \return boolean with the status of claim the interface
|
|
|
|
* \retval true if aquired
|
|
|
|
* \retval true if acquired
|
|
|
|
* \retval false if not
|
|
|
|
* \retval false if not
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool dbusInterface::aquiredPolicyPowerInterface() {
|
|
|
|
bool dbusInterface::acquiredPolicyPowerInterface() {
|
|
|
|
return aquiredPolicyPower;
|
|
|
|
return acquiredPolicyPower;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
@ -145,7 +145,7 @@ bool dbusInterface::initDBUS(){
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
aquirePolicyPowerIface();
|
|
|
|
acquirePolicyPowerIface();
|
|
|
|
|
|
|
|
|
|
|
|
dbus_connection_set_exit_on_disconnect( dbus_connection, false );
|
|
|
|
dbus_connection_set_exit_on_disconnect( dbus_connection, false );
|
|
|
|
|
|
|
|
|
|
|
@ -175,12 +175,12 @@ bool dbusInterface::initDBUS(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
* This function aquire the org.freedesktop.Policy.Power interface
|
|
|
|
* This function acquire the org.freedesktop.Policy.Power interface
|
|
|
|
* \return boolean with the result of the operation
|
|
|
|
* \return boolean with the result of the operation
|
|
|
|
* \retval true if successful aquired the interface
|
|
|
|
* \retval true if successful acquired the interface
|
|
|
|
* \retval false if unsuccessful
|
|
|
|
* \retval false if unsuccessful
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool dbusInterface::aquirePolicyPowerIface(){
|
|
|
|
bool dbusInterface::acquirePolicyPowerIface(){
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
|
|
if (dbus_connection == NULL) {
|
|
|
|
if (dbus_connection == NULL) {
|
|
|
@ -192,26 +192,26 @@ bool dbusInterface::aquirePolicyPowerIface(){
|
|
|
|
DBUS_NAME_FLAG_REPLACE_EXISTING, NULL)) {
|
|
|
|
DBUS_NAME_FLAG_REPLACE_EXISTING, NULL)) {
|
|
|
|
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
|
|
|
|
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
|
|
|
|
kdDebug() << "Acquired org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
kdDebug() << "Acquired org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
aquiredPolicyPower = true;
|
|
|
|
acquiredPolicyPower = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
|
|
|
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
|
|
|
kdWarning() << "Queued to aquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
kdWarning() << "Queued to acquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
kdWarning() << "Unknown error while aquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
kdWarning() << "Unknown error while acquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
return aquiredPolicyPower;
|
|
|
|
return acquiredPolicyPower;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
* This function release the org.freedesktop.Policy.Power interface
|
|
|
|
* This function release the org.freedesktop.Policy.Power interface
|
|
|
|
* \return boolean with the result of the operation
|
|
|
|
* \return boolean with the result of the operation
|
|
|
|
* \retval true if successful aquired the interface
|
|
|
|
* \retval true if successful acquired the interface
|
|
|
|
* \retval false if unsuccessful
|
|
|
|
* \retval false if unsuccessful
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool dbusInterface::releasePolicyPowerIface(){
|
|
|
|
bool dbusInterface::releasePolicyPowerIface(){
|
|
|
@ -238,7 +238,7 @@ bool dbusInterface::releasePolicyPowerIface(){
|
|
|
|
case DBUS_RELEASE_NAME_REPLY_RELEASED:
|
|
|
|
case DBUS_RELEASE_NAME_REPLY_RELEASED:
|
|
|
|
kdDebug() << "Released org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
kdDebug() << "Released org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
retval = true;
|
|
|
|
retval = true;
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DBUS_RELEASE_NAME_REPLY_NOT_OWNER:
|
|
|
|
case DBUS_RELEASE_NAME_REPLY_NOT_OWNER:
|
|
|
|
kdWarning() << "Couldn't release org.freedesktop.Policy.Power, not the owner" << endl;
|
|
|
|
kdWarning() << "Couldn't release org.freedesktop.Policy.Power, not the owner" << endl;
|
|
|
@ -502,9 +502,9 @@ void dbusInterface::emitMsgReceived( msg_type type, TQString message, TQString s
|
|
|
|
|
|
|
|
|
|
|
|
if (type == POLICY_POWER_OWNER_CHANGED) {
|
|
|
|
if (type == POLICY_POWER_OWNER_CHANGED) {
|
|
|
|
if (message.startsWith("NOW_OWNER"))
|
|
|
|
if (message.startsWith("NOW_OWNER"))
|
|
|
|
aquiredPolicyPower = true;
|
|
|
|
acquiredPolicyPower = true;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
emit msgReceived_withStringString( type, message, string );
|
|
|
|
emit msgReceived_withStringString( type, message, string );
|
|
|
|