diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-16 23:01:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-16 23:01:29 +0000 |
commit | 4304e8d9dab8e20513e38e71b0debdf6937b630c (patch) | |
tree | 76a86f013a811449a5b5bfbbbb962e7db0bbcc6a /src/dbusHAL.cpp | |
parent | ba24506b3bb46312d998468ad3c1a7f28058b2bd (diff) | |
download | tdepowersave-4304e8d9dab8e20513e38e71b0debdf6937b630c.tar.gz tdepowersave-4304e8d9dab8e20513e38e71b0debdf6937b630c.zip |
Finish TQt4 port of kpowersave
This enables both Qt3 and Qt4 builds
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpowersave@1228282 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/dbusHAL.cpp')
-rw-r--r-- | src/dbusHAL.cpp | 113 |
1 files changed, 57 insertions, 56 deletions
diff --git a/src/dbusHAL.cpp b/src/dbusHAL.cpp index 926d189..6983eb3 100644 --- a/src/dbusHAL.cpp +++ b/src/dbusHAL.cpp @@ -194,17 +194,17 @@ bool dbusHAL::initDBUS(){ dbus_bus_add_match( dbus_connection, "type='signal'," "interface='org.freedesktop.ConsoleKit.Session'," "member='ActiveChanged'", NULL); - + m_dBusQtConnection = new DBusQt::Connection(this); m_dBusQtConnection->dbus_connection_setup_with_qt_main(dbus_connection); - + dbus_is_connected = true; kdDebugFuncOut(trace); return true; } -/*! +/*! * This function aquire the org.freedesktop.Policy.Power interface * \return boolean with the result of the operation * \retval true if successful aquired the interface @@ -415,12 +415,12 @@ bool dbusHAL::reconnectHAL() { /*! * This function query a integer property from HAL for a given device - * \param udi QString with the UDI of the device - * \param property QString with the property + * \param udi TQString with the UDI of the device + * \param property TQString with the property * \param returnval pointer to the return value * \return If the query was successful or not */ -bool dbusHAL::halGetPropertyInt(QString udi, QString property, int *returnval){ +bool dbusHAL::halGetPropertyInt(TQString udi, TQString property, int *returnval){ kdDebugFuncIn(trace); bool ret = false; @@ -454,12 +454,12 @@ out: /*! * This function query a boolean property from HAL for a given device - * \param udi QString with the UDI of the device - * \param property QString with the property + * \param udi TQString with the UDI of the device + * \param property TQString with the property * \param returnval pointer to the return value * \return If the query was successful or not */ -bool dbusHAL::halGetPropertyBool(QString udi, QString property, bool *returnval){ +bool dbusHAL::halGetPropertyBool(TQString udi, TQString property, bool *returnval){ kdDebugFuncIn(trace); bool ret = false; @@ -494,12 +494,12 @@ out: /*! * This function query a Sting property from HAL for a given device - * \param udi QString with the UDI of the device - * \param property QString with the property + * \param udi TQString with the UDI of the device + * \param property TQString with the property * \param returnval pointer to the return value * \return If the query was successful or not */ -bool dbusHAL::halGetPropertyString(QString udi, QString property, QString *returnval){ +bool dbusHAL::halGetPropertyString(TQString udi, TQString property, TQString *returnval){ kdDebugFuncIn(trace); bool ret = false; @@ -533,12 +533,12 @@ out: /*! * This function query a String List property from HAL for a given device - * \param udi QString with the udi of the device - * \param property QString with the property to query - * \param devices QStringList to return the values + * \param udi TQString with the udi of the device + * \param property TQString with the property to query + * \param devices TQStringList to return the values * \return If the query was successful or not */ -bool dbusHAL::halGetPropertyStringList (QString udi, QString property, QStringList *devices) { +bool dbusHAL::halGetPropertyStringList (TQString udi, TQString property, TQStringList *devices) { kdDebugFuncIn(trace); bool ret = false; @@ -566,7 +566,7 @@ bool dbusHAL::halGetPropertyStringList (QString udi, QString property, QStringLi goto out; } else { for (int i = 0; found[i] != NULL ; ++i) { - QString _to_add = found[i]; + TQString _to_add = found[i]; if (!_to_add.isEmpty()) *devices += _to_add; } libhal_free_string_array(found); @@ -581,12 +581,12 @@ out: /*! * This function query a capability from HAL for a given device - * \param udi QString with the UDI of the device - * \param capability QString with the capability to query + * \param udi TQString with the UDI of the device + * \param capability TQString with the capability to query * \param returnval pointer to the return value as boolean * \return If the query was successful or not */ -bool dbusHAL::halQueryCapability(QString udi, QString capability, bool *returnval) { +bool dbusHAL::halQueryCapability(TQString udi, TQString capability, bool *returnval) { kdDebugFuncIn(trace); bool ret = false; @@ -615,11 +615,11 @@ out: /*! * Use this function to check if a device has a specia property/key. - * \param udi QString with the UDI of the device - * \param property QString with the property + * \param udi TQString with the UDI of the device + * \param property TQString with the property * \return If the query was successful or not */ -bool dbusHAL::halDevicePropertyExist(QString udi, QString property ) { +bool dbusHAL::halDevicePropertyExist(TQString udi, TQString property ) { kdDebugFuncIn(trace); bool ret = false; @@ -648,11 +648,11 @@ out: /*! * Use this function to search find devices with a give capability - * \param capability QString with the capability to query - * \param devices QStringList to return the found devices + * \param capability TQString with the capability to query + * \param devices TQStringList to return the found devices * \return If the query was successful or not */ -bool dbusHAL::halFindDeviceByCapability (QString capability, QStringList *devices) { +bool dbusHAL::halFindDeviceByCapability (TQString capability, TQStringList *devices) { kdDebugFuncIn(trace); DBusError error; @@ -675,7 +675,7 @@ bool dbusHAL::halFindDeviceByCapability (QString capability, QStringList *device goto out; } else { for (int i = 0; i < num; ++i) { - QString _to_add = found[i]; + TQString _to_add = found[i]; if (!_to_add.isEmpty()) *devices += _to_add; } libhal_free_string_array(found); @@ -689,12 +689,12 @@ out: /*! * Use this function to search find devices with a special string property - * \param property QString with the name of the property - * \param keyval QString with value of the string property - * \param devices QStringList to return the found devices + * \param property TQString with the name of the property + * \param keyval TQString with value of the string property + * \param devices TQStringList to return the found devices * \return If the query was successful or not */ -bool dbusHAL::halFindDeviceByString (QString property, QString keyval, QStringList *devices) { +bool dbusHAL::halFindDeviceByString (TQString property, TQString keyval, TQStringList *devices) { kdDebugFuncIn(trace); DBusError error; @@ -717,7 +717,7 @@ bool dbusHAL::halFindDeviceByString (QString property, QString keyval, QStringLi goto out; } else { for (int i = 0; i < num; ++i) { - QString _to_add = found[i]; + TQString _to_add = found[i]; if (!_to_add.isEmpty()) *devices += _to_add; } libhal_free_string_array(found); @@ -733,15 +733,15 @@ out: /* ----> D-Bus methode calls functions :: START <---- */ /*! * This function call a D-Bus method - * \param interface QString with te dbus interface - * \param path QString with the object path - * \param object QString with the object name - * \param method QString with the name of the methode + * \param interface TQString with te dbus interface + * \param path TQString with the object path + * \param object TQString with the object name + * \param method TQString with the name of the methode * \param first_arg_type integer with the dbus type of the first argument * \param ... more arguments * \return If the query was successful or not */ -bool dbusHAL::dbusSystemMethodCall( QString interface, QString path, QString object, QString method, +bool dbusHAL::dbusSystemMethodCall( TQString interface, TQString path, TQString object, TQString method, int first_arg_type, ... ) { kdDebugFuncIn(trace); @@ -760,16 +760,16 @@ bool dbusHAL::dbusSystemMethodCall( QString interface, QString path, QString obj /*! * This overloaded function call a D-Bus method on the D-Bus system bus with a return value - * \param interface QString with the dbus interface - * \param path QString with the object path - * \param object QString with the object name - * \param method QString with the name of the method + * \param interface TQString with the dbus interface + * \param path TQString with the object path + * \param object TQString with the object name + * \param method TQString with the name of the method * \param retvalue void pointer to arguments, if NULL we make a simple call * \param retval_type Integer with the dbus type of the return value, set to -1 if retvalue is NULL * \param first_arg_type Integer with the dbus type of the first argument followed by the value * \return If the query was successful or not */ -bool dbusHAL::dbusSystemMethodCall( QString interface, QString path, QString object, QString method, +bool dbusHAL::dbusSystemMethodCall( TQString interface, TQString path, TQString object, TQString method, void *retvalue, int retval_type, int first_arg_type, ... ) { kdDebugFuncIn(trace); @@ -788,10 +788,10 @@ bool dbusHAL::dbusSystemMethodCall( QString interface, QString path, QString obj /*! * This function call a D-Bus method with a return value - * \param interface QString with the dbus interface - * \param path QString with the object path - * \param object QString with the object name - * \param method QString with the name of the method + * \param interface TQString with the dbus interface + * \param path TQString with the object path + * \param object TQString with the object name + * \param method TQString with the name of the method * \param dbus_type DBusBusType with the D-Bus BUS Type * \param retvalue void pointer to arguments, if NULL we make a simple call * \param retval_type Integer with the dbus type of the return value, set to -1 if retvalue is NULL @@ -799,7 +799,7 @@ bool dbusHAL::dbusSystemMethodCall( QString interface, QString path, QString obj * \param var_args va_list with more arguments * \return If the query was successful or not */ -bool dbusHAL::dbusMethodCall( QString interface, QString path, QString object, QString method, +bool dbusHAL::dbusMethodCall( TQString interface, TQString path, TQString object, TQString method, DBusBusType dbus_type, void *retvalue, int retval_type, int first_arg_type, va_list var_args ) { kdDebugFuncIn(trace); @@ -969,16 +969,16 @@ out: /*! * Check if the user is privileged to a special privilege - * \param privilege QString with the name of the requested privilege - * \param udi QString with the UDI. - * \param ressource QString with the name of the ressource - * \param user QString with the name of the user. If empty the current user is used. + * \param privilege TQString with the name of the requested privilege + * \param udi TQString with the UDI. + * \param ressource TQString with the name of the ressource + * \param user TQString with the name of the user. If empty the current user is used. * \return int with info if the user is allowed or not. * \retval 0 if not allowed * \retval 1 if allowed * \retval -1 if a error occurs or we could not query the interface */ -int dbusHAL::isUserPrivileged(QString privilege, QString udi, QString ressource, QString user) { +int dbusHAL::isUserPrivileged(TQString privilege, TQString udi, TQString ressource, TQString user) { kdDebugFuncIn(trace); const char *_unique_name; @@ -1058,14 +1058,14 @@ out: /* ---> PolicyKit method call section :: END <--- */ /*! - * Use this SLOT to emit a reviced messages to the kpowersave. + * Use this TQT_SLOT to emit a reviced messages to the kpowersave. * NOTE: Because of the filter function this need to be a public function. * Don't use this function in any other place than this class. * \param type enum with the type of the message * \param message String with the message * \param string String with additional info */ -void dbusHAL::emitMsgReceived( msg_type type, QString message, QString string ) { +void dbusHAL::emitMsgReceived( msg_type type, TQString message, TQString string ) { if (message.startsWith("dbus.terminate")) dbus_is_connected = false; @@ -1097,7 +1097,7 @@ filterFunction (DBusConnection *connection, DBusMessage *message, void */*data*/ bool reply_wanted; char *value; - QString ifaceType; + TQString ifaceType; DBusError error; dbus_error_init( &error ); @@ -1288,7 +1288,7 @@ filterFunction (DBusConnection *connection, DBusMessage *message, void */*data*/ if (dbus_message_get_args( message, &error, DBUS_TYPE_BOOLEAN, &active, DBUS_TYPE_INVALID )) { ((dbusHAL*) myInstance)->emitMsgReceived( CONSOLEKIT_SESSION_ACTIVE, - session, QString("%1").arg((int)active)); + session, TQString("%1").tqarg((int)active)); } else { if (dbus_error_is_set( &error )) dbus_error_free( &error ); } @@ -1312,3 +1312,4 @@ filterFunction (DBusConnection *connection, DBusMessage *message, void */*data*/ DBusConnection * dbusHAL::get_DBUS_connection() { return dbus_connection; } + |