summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw
diff options
context:
space:
mode:
Diffstat (limited to 'tdecore/tdehw')
-rw-r--r--tdecore/tdehw/networkbackends/network-manager/network-manager.cpp83
1 files changed, 46 insertions, 37 deletions
diff --git a/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp b/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp
index 851710cd7..3e8ef6daa 100644
--- a/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp
@@ -1156,16 +1156,16 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString d
return (*it);
}
}
- return "";
+ return TQString::null;
}
else {
// Error!
PRINT_ERROR((error.name() + ": " + error.message()))
- return "";
+ return TQString::null;
}
}
else {
- return "";
+ return TQString::null;
}
}
@@ -1249,7 +1249,7 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TDE
d->m_vpnProxy->setConnection(TQT_DBusConnection::systemBus());
d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
- if (d->m_dbusDeviceString != "") {
+ if (!d->m_dbusDeviceString.isEmpty()) {
d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString);
d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus());
if (deviceType() == TDENetworkDeviceType::WiFi) {
@@ -1567,28 +1567,27 @@ TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM
if (!m_networkDevice) {
return TDENetworkDeviceType::BackendOnly;
}
- else {
- if (d->m_dbusDeviceString != "") {
- // Query NM for the device type
- TQT_DBusError error;
- d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
- DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
- genericDevice.setConnection(TQT_DBusConnection::systemBus());
- TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
- if (error.isValid()) {
- // Error!
- PRINT_ERROR((error.name() + ": " + error.message()))
- return TDENetworkDeviceType::Other;
- }
- else {
- return ret;
- }
- }
- else {
+
+ // Query NM for the device type
+ TQT_DBusError error;
+ d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
+ if (!d->m_dbusDeviceString.isEmpty()) {
+ DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
+ genericDevice.setConnection(TQT_DBusConnection::systemBus());
+ TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
+ if (error.isValid()) {
// Error!
- PRINT_ERROR(TQString("Invalid DBUS device string '%1'").arg(d->m_dbusDeviceString))
+ PRINT_ERROR((error.name() + ": " + error.message()))
return TDENetworkDeviceType::Other;
}
+ else {
+ return ret;
+ }
+ }
+ else {
+ // Error!
+ PRINT_ERROR(TQString("Invalid empty DBUS device string"))
+ return TDENetworkDeviceType::Other;
}
}
@@ -4791,6 +4790,10 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
else {
d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
}
+ if (d->m_dbusDeviceString.isEmpty()) {
+ PRINT_ERROR(TQString("Invalid empty DBUS device string"))
+ return TDENetworkConnectionStatus::Invalid;
+ }
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
TQT_DBusObjectPath active_connection;
ret = d->m_networkManagerProxy->ActivateConnection(existingConnection, TQT_DBusObjectPath(d->m_dbusDeviceString.ascii()), TQT_DBusObjectPath("/"), active_connection, error);
@@ -4984,6 +4987,10 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
else {
d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
}
+ if (d->m_dbusDeviceString.isEmpty()) {
+ PRINT_ERROR(TQString("Invalid empty DBUS device string"))
+ return TDENetworkConnectionStatus::Invalid;
+ }
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
ret = d->m_networkManagerProxy->DeactivateConnection(existingConnection, error);
if (ret && error.isValid()) {
@@ -5270,20 +5277,22 @@ TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() {
clearTDENetworkHWNeighborList();
if (myDeviceType == TDENetworkDeviceType::WiFi) {
- DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
- wiFiDevice.setConnection(TQT_DBusConnection::systemBus());
- // FIXME
- // Should call wiFiDevice.RequestScanAsync first to rescan all access points
- TQT_DBusObjectPathList accessPoints;
- ret = wiFiDevice.GetAccessPoints(accessPoints, error);
- if (ret) {
- TQT_DBusObjectPathList::iterator it;
- for (it = accessPoints.begin(); it != accessPoints.end(); ++it) {
- TDENetworkWiFiAPInfo* apInfo = getAccessPointDetails(TQString(*it));
- if (apInfo) {
- m_hwNeighborList->append(apInfo);
- // Ensure that this AP is monitored for changes
- d->internalProcessWiFiAccessPointAdded(*it);
+ if (!d->m_dbusDeviceString.isEmpty()) {
+ DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
+ wiFiDevice.setConnection(TQT_DBusConnection::systemBus());
+ // FIXME
+ // Should call wiFiDevice.RequestScanAsync first to rescan all access points
+ TQT_DBusObjectPathList accessPoints;
+ ret = wiFiDevice.GetAccessPoints(accessPoints, error);
+ if (ret) {
+ TQT_DBusObjectPathList::iterator it;
+ for (it = accessPoints.begin(); it != accessPoints.end(); ++it) {
+ TDENetworkWiFiAPInfo* apInfo = getAccessPointDetails(TQString(*it));
+ if (apInfo) {
+ m_hwNeighborList->append(apInfo);
+ // Ensure that this AP is monitored for changes
+ d->internalProcessWiFiAccessPointAdded(*it);
+ }
}
}
}