Add new signal to tdehwlibrary

pull/16/head
Timothy Pearson 13 years ago
parent 6b96deb4eb
commit 671940a29d

@ -2488,7 +2488,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
// Error! // Error!
PRINT_ERROR(error.name()) PRINT_ERROR(error.name())
} }
m_parent->internalNetworkManagementEvent(TDENetworkGlobalEventType::ConnectionListChanged); internalNetworkManagementEvent(TDENetworkGlobalEventType::ConnectionListChanged);
} }
} }

@ -1354,6 +1354,9 @@ TDENetworkDevice::TDENetworkDevice(TDEGenericDeviceType::TDEGenericDeviceType dt
} }
TDENetworkDevice::~TDENetworkDevice() { TDENetworkDevice::~TDENetworkDevice() {
if (m_connectionManager) {
delete m_connectionManager;
}
} }
TQString TDENetworkDevice::macAddress() { TQString TDENetworkDevice::macAddress() {
@ -1939,6 +1942,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
m_deviceList.append(device); m_deviceList.append(device);
updateParentDeviceInformation(device); // Update parent/child tables for this device updateParentDeviceInformation(device); // Update parent/child tables for this device
emit hardwareAdded(device); emit hardwareAdded(device);
emit hardwareEvent(TDEHardwareEvent::HardwareAdded, device->uniqueID());
} }
} }
else if (actionevent == "remove") { else if (actionevent == "remove") {
@ -1949,6 +1953,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
for (hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) { for (hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) {
if (hwdevice->systemPath() == systempath) { if (hwdevice->systemPath() == systempath) {
emit hardwareRemoved(hwdevice); 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 the device is a storage device and has a slave, update it as well
if (hwdevice->type() == TDEGenericDeviceType::Disk) { if (hwdevice->type() == TDEGenericDeviceType::Disk) {
@ -1960,6 +1965,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
if (slavedevice) { if (slavedevice) {
rescanDeviceInformation(slavedevice); rescanDeviceInformation(slavedevice);
emit hardwareUpdated(slavedevice); emit hardwareUpdated(slavedevice);
emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
} }
} }
} }
@ -1982,6 +1988,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
classifyUnknownDevice(dev, hwdevice, false); classifyUnknownDevice(dev, hwdevice, false);
updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device
emit hardwareUpdated(hwdevice); emit hardwareUpdated(hwdevice);
emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
} }
break; break;
} }
@ -2149,6 +2156,7 @@ void TDEHardwareDevices::processModifiedCPUs() {
TDEGenericDevice* hwdevice = findBySystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber)); TDEGenericDevice* hwdevice = findBySystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber));
// Signal new information available // Signal new information available
emit hardwareUpdated(hwdevice); 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)) { 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); rescanDeviceInformation(hwdevice);
emit hardwareUpdated(hwdevice); emit hardwareUpdated(hwdevice);
emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
} }
} }
} }
@ -2213,6 +2222,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0)); TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
if (hwdevice) { if (hwdevice) {
emit hardwareUpdated(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 the device is a storage device and has a slave, update it as well
if (hwdevice->type() == TDEGenericDeviceType::Disk) { if (hwdevice->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice); TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
@ -2221,6 +2231,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* slavedevice = findBySystemPath(*slaveit); TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
if (slavedevice) { if (slavedevice) {
emit hardwareUpdated(slavedevice); emit hardwareUpdated(slavedevice);
emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
} }
} }
} }
@ -2232,6 +2243,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0)); TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
if (hwdevice) { if (hwdevice) {
emit hardwareUpdated(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 the device is a storage device and has a slave, update it as well
if (hwdevice->type() == TDEGenericDeviceType::Disk) { if (hwdevice->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice); TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
@ -2240,6 +2252,7 @@ void TDEHardwareDevices::processModifiedMounts() {
TDEGenericDevice* slavedevice = findBySystemPath(*slaveit); TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
if (slavedevice) { if (slavedevice) {
emit hardwareUpdated(slavedevice); emit hardwareUpdated(slavedevice);
emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
} }
} }
} }
@ -2247,6 +2260,7 @@ void TDEHardwareDevices::processModifiedMounts() {
} }
emit mountTableModified(); 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) { 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 // Update parent/child tables for all devices
updateParentDeviceInformation(); updateParentDeviceInformation();
emit hardwareEvent(TDEHardwareEvent::HardwareListModified, TQString());
return true; return true;
} }

@ -41,6 +41,18 @@
class TDENetworkConnectionManager; 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 // Keep readGenericDeviceTypeFromString(), getFriendlyDeviceTypeStringFromType(), and getDeviceTypeIconFromType() in tdehardwaredevices.cpp in sync with this enum
namespace TDEGenericDeviceType { namespace TDEGenericDeviceType {
enum TDEGenericDeviceType { enum TDEGenericDeviceType {
@ -1982,6 +1994,7 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
void hardwareRemoved(TDEGenericDevice*); void hardwareRemoved(TDEGenericDevice*);
void hardwareUpdated(TDEGenericDevice*); void hardwareUpdated(TDEGenericDevice*);
void mountTableModified(); void mountTableModified();
void hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString uuid);
/** /**
* @param keycode the code of the key that was pressed/released * @param keycode the code of the key that was pressed/released

Loading…
Cancel
Save