diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-04-15 17:53:42 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-04-15 17:53:42 -0500 |
commit | 3c32b869c2208758c2027d094c8930592370858a (patch) | |
tree | 39724674d33faf4a09f28fce507c7ccbbf79a9a3 /src | |
parent | 3ec8230e9f10645de684b5e03471e293481183d7 (diff) | |
download | tdepowersave-3c32b869c2208758c2027d094c8930592370858a.tar.gz tdepowersave-3c32b869c2208758c2027d094c8930592370858a.zip |
Rename dbusHAL class to something more sensible
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/dbusInterface.cpp (renamed from src/dbusHAL.cpp) | 50 | ||||
-rw-r--r-- | src/dbusInterface.h (renamed from src/dbusHAL.h) | 12 | ||||
-rw-r--r-- | src/hardware.cpp | 2 | ||||
-rw-r--r-- | src/hardware.h | 9 | ||||
-rw-r--r-- | src/hardware_battery.h | 2 |
7 files changed, 39 insertions, 42 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41cad7d..ada56e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -41,7 +41,7 @@ tde_add_tdeinit_executable( kpowersave AUTOMOC dummy.cpp autodimm.cpp autosuspend.cpp blacklistedit_Dialog.ui blacklisteditdialog.cpp configure_Dialog.ui configuredialog.cpp countdown_Dialog.ui - countdowndialog.cpp dbusHAL.cpp detailed_Dialog.ui + countdowndialog.cpp dbusInterface.cpp detailed_Dialog.ui detaileddialog.cpp hardware.cpp hardware_battery.cpp hardware_batteryCollection.cpp hardware_cpu.cpp inactivity.cpp info_Dialog.ui infodialog.cpp kpowersave.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 0315ff0..a6f2aed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ noinst_HEADERS = \ blacklisteditdialog.h \ configuredialog.h \ countdowndialog.h \ - dbusHAL.h \ + dbusInterface.h \ detaileddialog.h \ hardware.h \ hardware_battery.h \ @@ -53,7 +53,7 @@ kpowersave_la_SOURCES = \ configuredialog.cpp \ countdown_Dialog.ui \ countdowndialog.cpp \ - dbusHAL.cpp \ + dbusInterface.cpp \ detailed_Dialog.ui \ detaileddialog.cpp \ hardware.cpp \ diff --git a/src/dbusHAL.cpp b/src/dbusInterface.cpp index 48686a3..adec4cd 100644 --- a/src/dbusHAL.cpp +++ b/src/dbusInterface.cpp @@ -18,7 +18,7 @@ ***************************************************************************/ /*! - * \file dbusHAL.cpp + * \file dbusInterface.cpp * \brief In this file can be found the functionality to connect to * the HAL daemon via D-Bus, to handle D-Bus calls/events and to * provide wrapper to HAL lib and functions @@ -30,15 +30,15 @@ #include <klocale.h> // DBUS - Header -#include "dbusHAL.h" +#include "dbusInterface.h" // system headers #include <iostream> static void* myInstance = 0; -/*! The default constructor of the class dbusHAL. */ -dbusHAL::dbusHAL(){ +/*! The default constructor of the class dbusInterface. */ +dbusInterface::dbusInterface(){ kdDebugFuncIn(trace); dbus_is_connected = false; @@ -56,7 +56,7 @@ dbusHAL::dbusHAL(){ } /*! This is the default destructor of class dbusPowersaveConnection. */ -dbusHAL::~dbusHAL(){ +dbusInterface::~dbusInterface(){ kdDebugFuncIn(trace); close(); @@ -71,7 +71,7 @@ dbusHAL::~dbusHAL(){ * \retval true if connected * \retval false if disconnected */ -bool dbusHAL::isConnectedToDBUS() { +bool dbusInterface::isConnectedToDBUS() { return dbus_is_connected; } @@ -82,7 +82,7 @@ bool dbusHAL::isConnectedToDBUS() { * \retval true if aquired * \retval false if not */ -bool dbusHAL::aquiredPolicyPowerInterface() { +bool dbusInterface::aquiredPolicyPowerInterface() { return aquiredPolicyPower; } @@ -92,7 +92,7 @@ bool dbusHAL::aquiredPolicyPowerInterface() { * \retval true if successful reconnected to D-Bus and HAL * \retval false if unsuccessful */ -bool dbusHAL::reconnect() { +bool dbusInterface::reconnect() { // close D-Bus connection close(); // init D-Bus conntection and HAL context @@ -105,7 +105,7 @@ bool dbusHAL::reconnect() { * \retval true if successful closed the connection * \retval false if any problems */ -bool dbusHAL::close() { +bool dbusInterface::close() { if ( m_dBusQtConnection != NULL ) { releasePolicyPowerIface(); m_dBusQtConnection->close(); @@ -124,7 +124,7 @@ bool dbusHAL::close() { * \retval true if successful initialised D-Bus connection * \retval false if unsuccessful */ -bool dbusHAL::initDBUS(){ +bool dbusInterface::initDBUS(){ kdDebugFuncIn(trace); dbus_is_connected = false; @@ -180,7 +180,7 @@ bool dbusHAL::initDBUS(){ * \retval true if successful aquired the interface * \retval false if unsuccessful */ -bool dbusHAL::aquirePolicyPowerIface(){ +bool dbusInterface::aquirePolicyPowerIface(){ kdDebugFuncIn(trace); if (dbus_connection == NULL) { @@ -214,7 +214,7 @@ bool dbusHAL::aquirePolicyPowerIface(){ * \retval true if successful aquired the interface * \retval false if unsuccessful */ -bool dbusHAL::releasePolicyPowerIface(){ +bool dbusInterface::releasePolicyPowerIface(){ kdDebugFuncIn(trace); int result; @@ -263,7 +263,7 @@ bool dbusHAL::releasePolicyPowerIface(){ * \retval true if the interface is owned by someone * \retval false if else */ -bool dbusHAL::isPolicyPowerIfaceOwned(){ +bool dbusInterface::isPolicyPowerIfaceOwned(){ kdDebugFuncIn(trace); bool retval = false; @@ -300,7 +300,7 @@ bool dbusHAL::isPolicyPowerIfaceOwned(){ * \param ... more arguments * \return If the query was successful or not */ -bool dbusHAL::dbusSystemMethodCall( TQString interface, TQString path, TQString object, TQString method, +bool dbusInterface::dbusSystemMethodCall( TQString interface, TQString path, TQString object, TQString method, int first_arg_type, ... ) { kdDebugFuncIn(trace); @@ -328,7 +328,7 @@ bool dbusHAL::dbusSystemMethodCall( TQString interface, TQString path, TQString * \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( TQString interface, TQString path, TQString object, TQString method, +bool dbusInterface::dbusSystemMethodCall( TQString interface, TQString path, TQString object, TQString method, void *retvalue, int retval_type, int first_arg_type, ... ) { kdDebugFuncIn(trace); @@ -358,7 +358,7 @@ bool dbusHAL::dbusSystemMethodCall( TQString interface, TQString path, TQString * \param var_args va_list with more arguments * \return If the query was successful or not */ -bool dbusHAL::dbusMethodCall( TQString interface, TQString path, TQString object, TQString method, +bool dbusInterface::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); @@ -441,7 +441,7 @@ out: * \retval 1 if allowed * \retval -1 if a error occurs or we could not query the interface */ -int dbusHAL::isUserPrivileged(TQString privilege, TQString udi, TQString ressource, TQString user) { +int dbusInterface::isUserPrivileged(TQString privilege, TQString udi, TQString ressource, TQString user) { kdDebugFuncIn(trace); const char *_unique_name; @@ -495,7 +495,7 @@ out: * \param message String with the message * \param string String with additional info */ -void dbusHAL::emitMsgReceived( msg_type type, TQString message, TQString string ) { +void dbusInterface::emitMsgReceived( msg_type type, TQString message, TQString string ) { if (message.startsWith("dbus.terminate")) dbus_is_connected = false; @@ -510,7 +510,7 @@ void dbusHAL::emitMsgReceived( msg_type type, TQString message, TQString string emit msgReceived_withStringString( type, message, string ); } -#include "dbusHAL.moc" +#include "dbusInterface.moc" // --> functions which are not member of the class ... /*! @@ -535,7 +535,7 @@ filterFunction (DBusConnection *connection, DBusMessage *message, void */*data*/ if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected")){ - ((dbusHAL*) myInstance)->emitMsgReceived( DBUS_EVENT, "dbus.terminate", 0 ); + ((dbusInterface*) myInstance)->emitMsgReceived( DBUS_EVENT, "dbus.terminate", 0 ); dbus_connection_unref(connection); kdDebugFuncOut(trace); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -590,18 +590,18 @@ filterFunction (DBusConnection *connection, DBusMessage *message, void */*data*/ if (!strcmp(service, "org.freedesktop.Policy.Power")) { const char *own_name; - own_name = dbus_bus_get_unique_name(((dbusHAL*) myInstance)->get_DBUS_connection()); + own_name = dbus_bus_get_unique_name(((dbusInterface*) myInstance)->get_DBUS_connection()); if (!strcmp(new_owner, own_name)) { kdDebug() << "=== now owner of org.freedesktop.Policy.Power ===" << endl; // we have now again the ower of the name! - ((dbusHAL*) myInstance)->emitMsgReceived( POLICY_POWER_OWNER_CHANGED, + ((dbusInterface*) myInstance)->emitMsgReceived( POLICY_POWER_OWNER_CHANGED, "NOW_OWNER", NULL ); } else { // some other has now the interface kdDebug() << "=== someone owner of org.freedesktop.Policy.Power ===" << endl; - ((dbusHAL*) myInstance)->emitMsgReceived( POLICY_POWER_OWNER_CHANGED, + ((dbusInterface*) myInstance)->emitMsgReceived( POLICY_POWER_OWNER_CHANGED, "OTHER_OWNER", NULL ); } @@ -620,7 +620,7 @@ filterFunction (DBusConnection *connection, DBusMessage *message, void */*data*/ dbus_bool_t active; if (dbus_message_get_args( message, &error, DBUS_TYPE_BOOLEAN, &active, DBUS_TYPE_INVALID )) { - ((dbusHAL*) myInstance)->emitMsgReceived( CONSOLEKIT_SESSION_ACTIVE, + ((dbusInterface*) myInstance)->emitMsgReceived( CONSOLEKIT_SESSION_ACTIVE, session, TQString("%1").arg((int)active)); } else { if (dbus_error_is_set( &error )) dbus_error_free( &error ); @@ -642,7 +642,7 @@ filterFunction (DBusConnection *connection, DBusMessage *message, void */*data*/ // --> some functions to get private members //! to get the current connection to D-Bus -DBusConnection * dbusHAL::get_DBUS_connection() { +DBusConnection * dbusInterface::get_DBUS_connection() { return dbus_connection; } diff --git a/src/dbusHAL.h b/src/dbusInterface.h index 9a2e613..b0eb0b4 100644 --- a/src/dbusHAL.h +++ b/src/dbusInterface.h @@ -18,11 +18,11 @@ ***************************************************************************/ /*! -* \file dbusHAL.h -* \brief Headerfile for dbusHAL.cpp and the class \ref dbusHAL. +* \file dbusInterface.h +* \brief Headerfile for dbusInterface.cpp and the class \ref dbusInterface. */ /*! -* \class dbusHAL +* \class dbusInterface * \brief class for connection to HAL via D-Bus * \author Danny Kukawka, <dkukawka@suse.de>, <danny.kukawka@web.de> * \date 2006-2007 @@ -66,7 +66,7 @@ enum msg_type { POLICY_POWER_OWNER_CHANGED }; -class dbusHAL : public TQObject{ +class dbusInterface : public TQObject{ Q_OBJECT @@ -105,9 +105,9 @@ private: public: //! default constructor - dbusHAL(); + dbusInterface(); //! default destructor - ~dbusHAL(); + ~dbusInterface(); //! to reconnect to D-Bus and HAL bool reconnect(); diff --git a/src/hardware.cpp b/src/hardware.cpp index 227c7a5..f0996fd 100644 --- a/src/hardware.cpp +++ b/src/hardware.cpp @@ -75,7 +75,7 @@ HardwareInfo::HardwareInfo() { setPrimaryBatteriesWarningLevel(); // force default settings // connect to D-Bus and HAL - dbus_HAL = new dbusHAL(); + dbus_HAL = new dbusInterface(); if (dbus_HAL->isConnectedToDBUS()) { dbus_terminated = false; } else { diff --git a/src/hardware.h b/src/hardware.h index f902499..3dd048b 100644 --- a/src/hardware.h +++ b/src/hardware.h @@ -48,10 +48,7 @@ // TDE hardware library #include <tdehardwaredevices.h> -// HAL Library -#include <hal/libhal.h> - -#include "dbusHAL.h" +#include "dbusInterface.h" #include "hardware_battery.h" #include "hardware_batteryCollection.h" @@ -130,8 +127,8 @@ class HardwareInfo : public TQObject{ private: TDEHardwareDevices *m_hwdevices; - //! pointer to the dbusHAL connection class - dbusHAL *dbus_HAL; + //! pointer to the dbusInterface connection class + dbusInterface *dbus_HAL; //! hold udis of special hardware execpt batteries represented by a TQString pairs (name,udi) /*! diff --git a/src/hardware_battery.h b/src/hardware_battery.h index 1eaa7b0..3e50c0a 100644 --- a/src/hardware_battery.h +++ b/src/hardware_battery.h @@ -45,7 +45,7 @@ // TDE hardware library #include <tdehardwaredevices.h> -#include "dbusHAL.h" +#include "dbusInterface.h" class Battery : public TQObject { |