summaryrefslogtreecommitdiffstats
path: root/tdecore
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-07 20:26:57 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-07 20:26:57 -0500
commit671940a29d4d57021a1bf63d310bbd854e07f1fa (patch)
treed93acfee6c46f08c32679f9f3914c9a56794b43b /tdecore
parent6b96deb4ebac9e55ff35d7f77313c5aebb103880 (diff)
downloadtdelibs-671940a29d4d57021a1bf63d310bbd854e07f1fa.tar.gz
tdelibs-671940a29d4d57021a1bf63d310bbd854e07f1fa.zip
Add new signal to tdehwlibrary
Diffstat (limited to 'tdecore')
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp2
-rw-r--r--tdecore/tdehardwaredevices.cpp16
-rw-r--r--tdecore/tdehardwaredevices.h13
3 files changed, 30 insertions, 1 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp
index 9bb44f5f6..74d96e7ec 100644
--- a/tdecore/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/networkbackends/network-manager/network-manager.cpp
@@ -2488,7 +2488,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
// Error!
PRINT_ERROR(error.name())
}
- m_parent->internalNetworkManagementEvent(TDENetworkGlobalEventType::ConnectionListChanged);
+ internalNetworkManagementEvent(TDENetworkGlobalEventType::ConnectionListChanged);
}
}
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index 77b847752..7e8b462eb 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -1354,6 +1354,9 @@ TDENetworkDevice::TDENetworkDevice(TDEGenericDeviceType::TDEGenericDeviceType dt
}
TDENetworkDevice::~TDENetworkDevice() {
+ if (m_connectionManager) {
+ delete m_connectionManager;
+ }
}
TQString TDENetworkDevice::macAddress() {
@@ -1939,6 +1942,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
m_deviceList.append(device);
updateParentDeviceInformation(device); // Update parent/child tables for this device
emit hardwareAdded(device);
+ emit hardwareEvent(TDEHardwareEvent::HardwareAdded, device->uniqueID());
}
}
else if (actionevent == "remove") {
@@ -1949,6 +1953,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
for (hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) {
if (hwdevice->systemPath() == systempath) {
emit hardwareRemoved(hwdevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareRemoved, hwdevice->uniqueID());
// If the device is a storage device and has a slave, update it as well
if (hwdevice->type() == TDEGenericDeviceType::Disk) {
@@ -1960,6 +1965,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
if (slavedevice) {
rescanDeviceInformation(slavedevice);
emit hardwareUpdated(slavedevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
}
}
}
@@ -1982,6 +1988,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
classifyUnknownDevice(dev, hwdevice, false);
updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device
emit hardwareUpdated(hwdevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
break;
}
@@ -2149,6 +2156,7 @@ void TDEHardwareDevices::processModifiedCPUs() {
TDEGenericDevice* hwdevice = findBySystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber));
// Signal new information available
emit hardwareUpdated(hwdevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
}
}
@@ -2164,6 +2172,7 @@ void TDEHardwareDevices::processStatelessDevices() {
if ((hwdevice->type() == TDEGenericDeviceType::RootSystem) || (hwdevice->type() == TDEGenericDeviceType::Network) || (hwdevice->type() == TDEGenericDeviceType::OtherSensor) || (hwdevice->type() == TDEGenericDeviceType::Event) || (hwdevice->type() == TDEGenericDeviceType::Battery) || (hwdevice->type() == TDEGenericDeviceType::PowerSupply)) {
rescanDeviceInformation(hwdevice);
emit hardwareUpdated(hwdevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
}
}
@@ -2213,6 +2222,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
if (hwdevice) {
emit hardwareUpdated(hwdevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
// If the device is a storage device and has a slave, update it as well
if (hwdevice->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
@@ -2221,6 +2231,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
if (slavedevice) {
emit hardwareUpdated(slavedevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
}
}
}
@@ -2232,6 +2243,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
if (hwdevice) {
emit hardwareUpdated(hwdevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
// If the device is a storage device and has a slave, update it as well
if (hwdevice->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
@@ -2240,6 +2252,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
if (slavedevice) {
emit hardwareUpdated(slavedevice);
+ emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
}
}
}
@@ -2247,6 +2260,7 @@ void TDEHardwareDevices::processModifiedMounts() {
}
emit mountTableModified();
+ emit hardwareEvent(TDEHardwareEvent::MountTableModified, TQString());
}
TDEDiskDeviceType::TDEDiskDeviceType classifyDiskType(udev_device* dev, const TQString devicebus, const TQString disktypestring, const TQString systempath, const TQString devicevendor, const TQString devicemodel, const TQString filesystemtype, const TQString devicedriver) {
@@ -4402,6 +4416,8 @@ bool TDEHardwareDevices::queryHardwareInformation() {
// Update parent/child tables for all devices
updateParentDeviceInformation();
+ emit hardwareEvent(TDEHardwareEvent::HardwareListModified, TQString());
+
return true;
}
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h
index 819dfd85b..907cdb65b 100644
--- a/tdecore/tdehardwaredevices.h
+++ b/tdecore/tdehardwaredevices.h
@@ -41,6 +41,18 @@
class TDENetworkConnectionManager;
+namespace TDEHardwareEvent {
+enum TDEHardwareEvent {
+ HardwareListModified,
+ MountTableModified,
+ HardwareAdded,
+ HardwareRemoved,
+ HardwareUpdated,
+ Other,
+ Last = Other
+};
+};
+
// Keep readGenericDeviceTypeFromString(), getFriendlyDeviceTypeStringFromType(), and getDeviceTypeIconFromType() in tdehardwaredevices.cpp in sync with this enum
namespace TDEGenericDeviceType {
enum TDEGenericDeviceType {
@@ -1982,6 +1994,7 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
void hardwareRemoved(TDEGenericDevice*);
void hardwareUpdated(TDEGenericDevice*);
void mountTableModified();
+ void hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString uuid);
/**
* @param keycode the code of the key that was pressed/released