diff options
author | Michele Calgaro <[email protected]> | 2021-05-01 16:16:34 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-05-02 19:38:42 +0900 |
commit | f673e8b30691e33aed7d052525a02002c232e393 (patch) | |
tree | dfdd4380f7f42a81c83234bcf20e35778205ad82 /src | |
parent | 1926caafbcabd6e3bd4ff758d910c8f54278486c (diff) | |
download | kima-f673e8b30691e33aed7d052525a02002c232e393.tar.gz kima-f673e8b30691e33aed7d052525a02002c232e393.zip |
Fixed FTBFS without tdehw lib.
Signed-off-by: Michele Calgaro <[email protected]>
(cherry picked from commit c4a0aea65da598ce3aa78a66d8585e37caa811bd)
Diffstat (limited to 'src')
-rw-r--r-- | src/sources/batterysrc.cpp | 15 | ||||
-rw-r--r-- | src/sources/batterysrc.h | 3 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/sources/batterysrc.cpp b/src/sources/batterysrc.cpp index 7b9c763..32a2d77 100644 --- a/src/sources/batterysrc.cpp +++ b/src/sources/batterysrc.cpp @@ -22,12 +22,16 @@ #include <tdelocale.h> #include <kdebug.h> +#ifdef __TDE_HAVE_TDEHWLIB +#include <tdehardwaredevices.h> +#endif + BatterySrc::BatterySrc(TQWidget* inParent, TQString inUDI): LabelSource(inParent), mTrigger(this, 5000), mUDI(inUDI), mHardwareDevices(NULL){ - +#ifdef __TDE_HAVE_TDEHWLIB mHardwareDevices = TDEGlobal::hardwareDevices(); TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(inUDI); @@ -35,6 +39,9 @@ BatterySrc::BatterySrc(TQWidget* inParent, TQString inUDI): TDEBatteryDevice* bdevice = static_cast<TDEBatteryDevice*>(hwdevice); mID = bdevice->friendlyName(); } +#else + mID = TQString::null; +#endif mName = mID; mDescription = i18n("This source displays the current state of charge of your battery."); } @@ -45,7 +52,7 @@ BatterySrc::~BatterySrc(){ std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){ std::list<Source*> list; - +#ifdef __TDE_HAVE_TDEHWLIB TDEHardwareDevices* hardwareDevices = TDEGlobal::hardwareDevices(); TDEGenericHardwareList hwlist = hardwareDevices->listAllPhysicalDevices(); TDEGenericDevice *hwdevice; @@ -54,12 +61,13 @@ std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){ list.push_back(new BatterySrc(inParent, hwdevice->uniqueID())); } } - +#endif return list; } TQString BatterySrc::fetchValue() { TQString s = "n/a"; +#ifdef __TDE_HAVE_TDEHWLIB if (mHardwareDevices != NULL) { TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(mUDI); if (hwdevice->type() != TDEGenericDeviceType::Battery) { @@ -68,6 +76,7 @@ TQString BatterySrc::fetchValue() { TDEBatteryDevice* bdevice = static_cast<TDEBatteryDevice*>(hwdevice); s = TQString::number(bdevice->chargePercent()) + " %"; } +#endif return s; } #include "batterysrc.moc" diff --git a/src/sources/batterysrc.h b/src/sources/batterysrc.h index 62c6828..a61883c 100644 --- a/src/sources/batterysrc.h +++ b/src/sources/batterysrc.h @@ -26,8 +26,7 @@ #include <tqstring.h> #include <list> -#include <tdehardwaredevices.h> - +class TDEHardwareDevices; /** * BatterySrc fetches the state of charge of the battery from HAL * @author Ken Werner |