diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-08 23:53:47 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-08 23:53:47 -0500 |
commit | 642f227036520a1a616e27db086a2c82e7dd1489 (patch) | |
tree | 46349e630bde08407f3511b962ddb4738e45297d /tdecore | |
parent | 7d8a74d0f9922463f3c6e12d8ea46762f5c8bb10 (diff) | |
download | tdelibs-642f227036520a1a616e27db086a2c82e7dd1489.tar.gz tdelibs-642f227036520a1a616e27db086a2c82e7dd1489.zip |
Add requisite MAC address comparator for use in TQMap objects
Diffstat (limited to 'tdecore')
-rw-r--r-- | tdecore/networkbackends/network-manager/network-manager.cpp | 20 | ||||
-rw-r--r-- | tdecore/tdenetworkconnections.cpp | 36 | ||||
-rw-r--r-- | tdecore/tdenetworkconnections.h | 2 |
3 files changed, 47 insertions, 11 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp index a46144ea2..1b639aa25 100644 --- a/tdecore/networkbackends/network-manager/network-manager.cpp +++ b/tdecore/networkbackends/network-manager/network-manager.cpp @@ -1532,6 +1532,10 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() { TDENetworkIPConfigurationFlags::IPV6DHCPRoutes | \ TDENetworkIPConfigurationFlags::IPV6MayUseAsDefaultRoute; + if (wiFiConnection) { + wiFiConnection->securitySettings.authType = TDENetworkWiFiAuthType::Open; + } + #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS printf("[network-manager comm debug] %s\n\r", (*it).data()); fflush(stdout); #endif // DEBUG_NETWORK_MANAGER_COMMUNICATIONS @@ -3321,7 +3325,12 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* } } { - settingsMap["hidden"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(wiFiConnection->isHiddenNetwork)); + if (wiFiConnection->isHiddenNetwork) { + settingsMap["hidden"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(true)); + } + else { + settingsMap.remove("hidden"); + } } } dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap)); @@ -3348,14 +3357,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* else { settingsMap.remove("wep-tx-keyidx"); } - { - if (wiFiConnection->securityRequired) { - settingsMap["auth-alg"] = convertDBUSDataToVariantData(TQT_DBusData::fromString(tdeWiFiAuthTypeToNMWiFiAuthType(wiFiConnection->securitySettings.authType))); - } - else { - settingsMap.remove("auth-alg"); - } - } + UPDATE_STRING_SETTING_IF_VALID(tdeWiFiAuthTypeToNMWiFiAuthType(wiFiConnection->securitySettings.authType), "auth-alg", settingsMap) { TQT_DBusDataValueList valueList; { diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp index 6139bd49f..9b435b2ac 100644 --- a/tdecore/tdenetworkconnections.cpp +++ b/tdecore/tdenetworkconnections.cpp @@ -247,6 +247,24 @@ bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2) { } } +bool operator<(const TDEMACAddress &a1, const TDEMACAddress &a2) { + if (a1.m_macAddress.count() < a2.m_macAddress.count()) { + return true; + } + else { + unsigned int i; + for (i=0; i<a1.m_macAddress.count(); i++) { + if (a1.m_macAddress[i] < a2.m_macAddress[i]) { + return true; + } + if (a1.m_macAddress[i] > a2.m_macAddress[i]) { + return false; + } + } + return false; + } +} + /*================================================================================================*/ /* TDENetworkSingleIPConfiguration */ /*================================================================================================*/ @@ -923,8 +941,22 @@ TDENetworkDevice* TDEGlobalNetworkManager::findDeviceByUUID(TQString uuid) { } TDENetworkWiFiAPInfo* TDEGlobalNetworkManager::findAccessPointByBSSID(TDEMACAddress bssid) { - if (!m_internalConnectionManager) return NULL; - return m_internalConnectionManager->findAccessPointByBSSID(bssid); + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (!hwdevices) { + return NULL; + } + + TDENetworkWiFiAPInfo* ret = NULL; + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(*it); + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + ret = deviceConnMan->findAccessPointByBSSID(bssid); + } + } + + return ret; } /*================================================================================================*/ diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h index 56e950fed..04a9e1c79 100644 --- a/tdecore/tdenetworkconnections.h +++ b/tdecore/tdenetworkconnections.h @@ -504,9 +504,11 @@ class TDECORE_EXPORT TDEMACAddress TDENetworkByteList m_macAddress; friend bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2); + friend bool operator<(const TDEMACAddress &a1, const TDEMACAddress &a2); }; TDECORE_EXPORT bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2); +TDECORE_EXPORT bool operator<(const TDEMACAddress &a1, const TDEMACAddress &a2); typedef TQValueList<TDEMACAddress> TDEMACAddressList; |