From 63c292c62f959fd5e9349e3e9413eae01ec6efef Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 6 Apr 2012 02:39:07 -0500 Subject: Add a couple of convenience functions to the TDE hw lib --- tdecore/tdehardwaredevices.cpp | 11 +++++++++++ tdecore/tdehardwaredevices.h | 10 ++++++++++ 2 files changed, 21 insertions(+) (limited to 'tdecore') diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index 8f33e1480..e95030983 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -199,6 +199,17 @@ void TDEGenericDevice::setBlacklistedForUpdate(bool bl) { m_blacklistedForUpdate = bl; } +TQString TDEGenericDevice::friendlyDeviceType() { + return KGlobal::hardwareDevices()->getFriendlyDeviceTypeStringFromType(type()); +} + +TQString TDEGenericDevice::busID() { + TQString busid = m_systemPath; + busid = busid.remove(0, busid.findRev("/")+1); + busid = busid.remove(0, busid.find(":")+1); + return busid; +} + TQString TDEGenericDevice::friendlyName() { if (m_friendlyName.isNull()) { if (type() == TDEGenericDeviceType::Root) { diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h index 96ce7a995..bf474da3e 100644 --- a/tdecore/tdehardwaredevices.h +++ b/tdecore/tdehardwaredevices.h @@ -367,6 +367,16 @@ class TDECORE_EXPORT TDEGenericDevice */ TDEGenericDevice* parentDevice(); + /** + * @return a TQString containing the friendly type name + */ + TQString friendlyDeviceType(); + + /** + * @return a TQString containing the device bus ID, if any + */ + TQString busID(); + /** * Get an icon for this device * @param size a KIcon::StdSizes structure specifying the desired icon size -- cgit v1.2.1