@ -1137,7 +1137,7 @@ TQString tdeIBTransportToNMIBTransport(TDENetworkInfinibandTransportMode::TDENet
return ret ;
}
TQString TDENetworkConnectionManager_BackendNM : : deviceInterfaceString ( TQString macA ddr ess ) {
TQString TDENetworkConnectionManager_BackendNM : : deviceInterfaceString ( TQString deviceNo de) {
if ( d - > m_networkManagerProxy ) {
TQT_DBusObjectPathList devices ;
TQT_DBusError error ;
@ -1148,74 +1148,15 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
for ( it = devices . begin ( ) ; it ! = devices . end ( ) ; + + it ) {
DBus : : DeviceProxy genericDevice ( NM_DBUS_SERVICE , ( * it ) ) ;
genericDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
T DENetworkDeviceType: : TDENetworkDeviceType deviceType = nmDeviceTypeToTDEDeviceType ( genericDevice . getDeviceType ( error ) ) ;
T QString deviceInterface = genericDevice . getInterface ( error ) ;
if ( error . isValid ( ) ) {
// Error!
PRINT_ERROR ( ( error . name ( ) + " : " + error . message ( ) ) )
break ;
}
else if ( deviceType = = TDENetworkDeviceType : : WiredEthernet ) {
DBus : : EthernetDeviceProxy ethernetDevice ( NM_DBUS_SERVICE , ( * it ) ) ;
ethernetDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = ethernetDevice . getPermHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
if ( candidateMACAddress . lower ( ) = = macAddress . lower ( ) ) {
return ( * it ) ;
}
}
}
else if ( deviceType = = TDENetworkDeviceType : : Infiniband ) {
DBus : : InfinibandDeviceProxy infinibandDevice ( NM_DBUS_SERVICE , ( * it ) ) ;
infinibandDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = infinibandDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
if ( candidateMACAddress . lower ( ) = = macAddress . lower ( ) ) {
return ( * it ) ;
}
}
}
else if ( deviceType = = TDENetworkDeviceType : : WiFi ) {
DBus : : WiFiDeviceProxy wiFiDevice ( NM_DBUS_SERVICE , ( * it ) ) ;
wiFiDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = wiFiDevice . getPermHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
if ( candidateMACAddress . lower ( ) = = macAddress . lower ( ) ) {
return ( * it ) ;
}
}
}
else if ( deviceType = = TDENetworkDeviceType : : WiMax ) {
DBus : : WiMaxDeviceProxy wiMaxDevice ( NM_DBUS_SERVICE , ( * it ) ) ;
wiMaxDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = wiMaxDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
if ( candidateMACAddress . lower ( ) = = macAddress . lower ( ) ) {
return ( * it ) ;
}
}
else if ( deviceInterface = = deviceNode ) {
return ( * it ) ;
}
else if ( deviceType = = TDENetworkDeviceType : : OLPCMesh ) {
DBus : : OlpcMeshDeviceProxy olpcMeshDevice ( NM_DBUS_SERVICE , ( * it ) ) ;
olpcMeshDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = olpcMeshDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
if ( candidateMACAddress . lower ( ) = = macAddress . lower ( ) ) {
return ( * it ) ;
}
}
}
else if ( deviceType = = TDENetworkDeviceType : : Bluetooth ) {
DBus : : BluetoothDeviceProxy bluetoothDevice ( NM_DBUS_SERVICE , ( * it ) ) ;
bluetoothDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = bluetoothDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
if ( candidateMACAddress . lower ( ) = = macAddress . lower ( ) ) {
return ( * it ) ;
}
}
}
// FIXME
// Add other supported device types here
}
return " " ;
}
@ -1230,72 +1171,15 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
}
}
TQString macAddress ForGenericDevice( TQT_DBusObjectPath path ) {
TQString tdeDeviceUUID ForGenericDevice( TQT_DBusObjectPath path ) {
TQT_DBusError error ;
DBus : : DeviceProxy genericDevice ( NM_DBUS_SERVICE , path ) ;
genericDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQ _UINT32 deviceType = genericDevice . getDeviceTyp e( error ) ;
TQ String deviceInterface = genericDevice . getInterfac e( error ) ;
if ( error . isValid ( ) ) {
// Error!
PRINT_ERROR ( ( error . name ( ) + " : " + error . message ( ) ) )
return TQString ( ) ;
}
else if ( deviceType = = NM_DEVICE_TYPE_ETHERNET ) {
DBus : : EthernetDeviceProxy ethernetDevice ( NM_DBUS_SERVICE , path ) ;
ethernetDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = ethernetDevice . getPermHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
return candidateMACAddress . lower ( ) ;
}
}
else if ( deviceType = = NM_DEVICE_TYPE_INFINIBAND ) {
DBus : : InfinibandDeviceProxy infinibandDevice ( NM_DBUS_SERVICE , path ) ;
infinibandDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = infinibandDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
return candidateMACAddress . lower ( ) ;
}
}
else if ( deviceType = = NM_DEVICE_TYPE_WIFI ) {
DBus : : WiFiDeviceProxy wiFiDevice ( NM_DBUS_SERVICE , path ) ;
wiFiDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = wiFiDevice . getPermHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
return candidateMACAddress . lower ( ) ;
}
}
else if ( deviceType = = NM_DEVICE_TYPE_WIMAX ) {
DBus : : WiMaxDeviceProxy wiMaxDevice ( NM_DBUS_SERVICE , path ) ;
wiMaxDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = wiMaxDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
return candidateMACAddress . lower ( ) ;
}
}
else if ( deviceType = = NM_DEVICE_TYPE_OLPC_MESH ) {
DBus : : OlpcMeshDeviceProxy olpcMeshDevice ( NM_DBUS_SERVICE , path ) ;
olpcMeshDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = olpcMeshDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
return candidateMACAddress . lower ( ) ;
}
}
else if ( deviceType = = NM_DEVICE_TYPE_BT ) {
DBus : : BluetoothDeviceProxy bluetoothDevice ( NM_DBUS_SERVICE , path ) ;
bluetoothDevice . setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
TQString candidateMACAddress = bluetoothDevice . getHwAddress ( error ) ;
if ( ! error . isValid ( ) ) {
return candidateMACAddress . lower ( ) ;
}
return TQString : : null ;
}
// FIXME
// Add other supported device types here
return TQString : : null ;
}
TQString tdeDeviceUUIDForMACAddress ( TQString macAddress ) {
TDEHardwareDevices * hwdevices = TDEGlobal : : hardwareDevices ( ) ;
if ( ! hwdevices ) {
return TQString : : null ;
@ -1305,7 +1189,7 @@ TQString tdeDeviceUUIDForMACAddress(TQString macAddress) {
for ( TDEGenericHardwareList : : iterator it = devices . begin ( ) ; it ! = devices . end ( ) ; + + it ) {
TDENetworkDevice * dev = dynamic_cast < TDENetworkDevice * > ( * it ) ;
if ( dev ) {
if ( macAddress. lower ( ) = = dev - > macAddress ( ) . lower ( ) ) {
if ( deviceInterface = = dev - > deviceNode ( ) ) {
return dev - > uniqueID ( ) ;
}
}
@ -1355,7 +1239,7 @@ void TDENetworkConnectionManager_BackendNM_DBusSignalReceiver::dbusSignal(const
}
}
TDENetworkConnectionManager_BackendNM : : TDENetworkConnectionManager_BackendNM ( T QString macAddress ) : TDENetworkConnectionManager ( macAddress ) {
TDENetworkConnectionManager_BackendNM : : TDENetworkConnectionManager_BackendNM ( T DENetworkDevice* networkDevice ) : TDENetworkConnectionManager ( networkDevice ) {
d = new TDENetworkConnectionManager_BackendNMPrivate ( this ) ;
// Set up proxy interfaces
@ -1366,7 +1250,7 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQS
d - > m_vpnProxy = new DBus : : VPNPluginProxy ( NM_VPN_DBUS_PLUGIN_SERVICE , NM_VPN_DBUS_PLUGIN_PATH ) ;
d - > m_vpnProxy - > setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
d - > m_dbusDeviceString = deviceInterfaceString ( macAddress ) ;
d - > m_dbusDeviceString = deviceInterfaceString ( deviceNode( ) ) ;
if ( d - > m_dbusDeviceString ! = " " ) {
d - > m_networkDeviceProxy = new DBus : : DeviceProxy ( NM_DBUS_SERVICE , d - > m_dbusDeviceString ) ;
d - > m_networkDeviceProxy - > setConnection ( TQT_DBusConnection : : systemBus ( ) ) ;
@ -1618,7 +1502,7 @@ void TDENetworkConnectionManager_BackendNMPrivate::internalProcessDeviceStateCha
m_parent - > internalNetworkDeviceEvent ( TDENetworkDeviceEventType : : Failure , errorString ) ;
}
m_parent - > internalNetworkDeviceStateChanged ( nmDeviceStateToTDEDeviceState ( newState ) , m_parent - > m_macAddress ) ;
m_parent - > internalNetworkDeviceStateChanged ( nmDeviceStateToTDEDeviceState ( newState ) , m_parent - > deviceNode( ) ) ;
}
void TDENetworkConnectionManager_BackendNMPrivate : : internalProcessWiFiAccessPointAdded ( const TQT_DBusObjectPath & dbuspath ) {
@ -1682,14 +1566,14 @@ void TDENetworkConnectionManager_BackendNMPrivate::internalProcessAPPropertiesCh
}
TDENetworkDeviceType : : TDENetworkDeviceType TDENetworkConnectionManager_BackendNM : : deviceType ( ) {
if ( m_macAddress = = " " ) {
if ( ! m_networkDevice ) {
return TDENetworkDeviceType : : BackendOnly ;
}
else {
if ( d - > m_dbusDeviceString ! = " " ) {
// Query NM for the device type
TQT_DBusError error ;
d - > m_dbusDeviceString = deviceInterfaceString ( m_macAddress ) ;
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 ) ) ;
@ -1981,7 +1865,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
d - > nonReentrantCallActive = true ;
TDEMACAddress deviceMACAddress ;
deviceMACAddress . fromString ( m_macAddress ) ;
deviceMACAddress . fromString ( this - > deviceMACAddress ( ) ) ;
if ( d - > m_networkManagerSettings ) {
clearTDENetworkConnectionList ( ) ;
@ -4953,11 +4837,11 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
if ( ( d - > m_networkManagerSettings ) & & ( d - > m_networkManagerProxy ) ) {
ret = d - > m_networkManagerSettings - > GetConnectionByUuid ( uuid , existingConnection , error ) ;
if ( ret ) {
if ( m_macAddress = = " " ) {
if ( ! m_networkDevice ) {
d - > m_dbusDeviceString = " / " ;
}
else {
d - > m_dbusDeviceString = deviceInterfaceString ( m_macAddress ) ;
d - > m_dbusDeviceString = deviceInterfaceString ( deviceNode( ) ) ;
}
# ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
TQT_DBusObjectPath active_connection ;
@ -5087,8 +4971,7 @@ TQStringList TDENetworkConnectionManager_BackendNM::connectionPhysicalDeviceUUID
TQValueList < TQT_DBusObjectPath > deviceList = activeConnection . getDevices ( error ) ;
TQT_DBusObjectPathList : : iterator it2 ;
for ( it2 = deviceList . begin ( ) ; it2 ! = deviceList . end ( ) ; + + it2 ) {
TQString macAddress = macAddressForGenericDevice ( * it2 ) ;
TQString devUUID = tdeDeviceUUIDForMACAddress ( macAddress ) ;
TQString devUUID = tdeDeviceUUIDForGenericDevice ( * it2 ) ;
if ( devUUID ! = " " ) {
ret . append ( devUUID ) ;
}
@ -5147,11 +5030,11 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
if ( ( d - > m_networkManagerSettings ) & & ( d - > m_networkManagerProxy ) ) {
existingConnection = getActiveConnectionPath ( uuid ) ;
if ( existingConnection . isValid ( ) ) {
if ( m_macAddress = = " " ) {
if ( ! m_networkDevice ) {
d - > m_dbusDeviceString = " / " ;
}
else {
d - > m_dbusDeviceString = deviceInterfaceString ( m_macAddress ) ;
d - > m_dbusDeviceString = deviceInterfaceString ( deviceNode( ) ) ;
}
# ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
ret = d - > m_networkManagerProxy - > DeactivateConnection ( existingConnection , error ) ;
@ -5435,7 +5318,7 @@ TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() {
bool ret ;
TDENetworkDeviceType : : TDENetworkDeviceType myDeviceType = deviceType ( ) ;
d - > m_dbusDeviceString = deviceInterfaceString ( m_macAddress ) ;
d - > m_dbusDeviceString = deviceInterfaceString ( deviceNode( ) ) ;
clearTDENetworkHWNeighborList ( ) ;
if ( myDeviceType = = TDENetworkDeviceType : : WiFi ) {