diff --git a/kcms/wifi/ui/NetworkSettings.qml b/kcms/wifi/ui/NetworkSettings.qml index bb907119..f5320b44 100644 --- a/kcms/wifi/ui/NetworkSettings.qml +++ b/kcms/wifi/ui/NetworkSettings.qml @@ -92,28 +92,38 @@ Kirigami.ScrollablePage { text: "placeholder" } function load() { - clear() - append({ "text": i18n("None"), "type": PlasmaNM.Enums.NoneSecurity }) - append({ "text": i18n("WEP Key"), "type": PlasmaNM.Enums.StaticWep }) - append({ "text": i18n("Dynamic WEP"), "type": PlasmaNM.Enums.DynamicWep }) - append({ "text": i18n("WPA/WPA2 Personal"), "type": PlasmaNM.Enums.Wpa2Psk }) - append({ "text": i18n("WPA/WPA2 Enterprise"), "type": PlasmaNM.Enums.Wpa2Eap }) + clear(); + append({ "text": i18n("None"), "type": PlasmaNM.Enums.NoneSecurity }); + append({ "text": i18n("WEP Key"), "type": PlasmaNM.Enums.StaticWep }); + append({ "text": i18n("Dynamic WEP"), "type": PlasmaNM.Enums.DynamicWep }); + append({ "text": i18n("WPA/WPA2 Personal"), "type": PlasmaNM.Enums.Wpa2Psk }); + append({ "text": i18n("WPA/WPA2 Enterprise"), "type": PlasmaNM.Enums.Wpa2Eap }); + append({ "text": i18n("WPA3 Personal"), "type": PlasmaNM.Enums.SAE }); + append({ "text": i18n("WPA3 Enterprise"), "type": PlasmaNM.Enums.Wpa3SuiteB192 }); + + // See https://networkmanager.dev/docs/api/latest/settings-802-11-wireless-security.html switch (securitySettings["key-mgmt"]) { case "none": - securityCombobox.currentIndex = 0 - break + securityCombobox.currentIndex = 0; + break; case "ieee8021x": - securityCombobox.currentIndex = 1 - break + securityCombobox.currentIndex = 1; + break; case "wpa-psk": - securityCombobox.currentIndex = 3 - break + securityCombobox.currentIndex = 3; + break; case "wpa-eap": - securityCombobox.currentIndex = 4 - break + securityCombobox.currentIndex = 4; + break; + case "sae": + securityCombobox.currentIndex = 5; + break; + case "wpa-eap-suite-b-192": + securityCombobox.currentIndex = 6; + break; default: - securityCombobox.currentIndex = 0 - break + securityCombobox.currentIndex = 0; + break; } } } @@ -153,7 +163,7 @@ Kirigami.ScrollablePage { } Controls.Label { - visible: securityCombobox.currentIndex !== 3 && securityCombobox.currentIndex !== 0 + visible: ![0, 3, 5].includes(securityCombobox.currentIndex) // only supports WPA PSK, SAE text: "----Not yet implemented----" color: "red" } diff --git a/kcms/wifi/wifisettings.cpp b/kcms/wifi/wifisettings.cpp index fd91a520..b53464c3 100644 --- a/kcms/wifi/wifisettings.cpp +++ b/kcms/wifi/wifisettings.cpp @@ -163,6 +163,12 @@ void WifiSettings::addConnectionFromQML(const QVariantMap &QMLmap) securitySettings->setWepKeyFlags(NetworkManager::Setting::SecretFlagType::AgentOwned); securitySettings->setWepKey0(securMap["password"].toString()); } + if (type == NetworkManager::SAE) { + securitySettings->setKeyMgmt(NetworkManager::WirelessSecuritySetting::KeyMgmt::SAE); + securitySettings->setAuthAlg(NetworkManager::WirelessSecuritySetting::AuthAlg::Open); + securitySettings->setPskFlags(NetworkManager::Setting::SecretFlagType::AgentOwned); + securitySettings->setPsk(securMap["password"].toString()); + } map.insert("802-11-wireless-security", securitySettings->toMap()); } } @@ -223,6 +229,10 @@ void WifiSettings::updateConnectionFromQML(const QString &path, const QVariantMa securitySetting->setPsk(secMap["password"].toString()); } + if ((securitySetting->keyMgmt() == NetworkManager::WirelessSecuritySetting::SAE) && (secMap.value("type") == NetworkManager::SAE)) { + securitySetting->setPsk(secMap["password"].toString()); + } + // TODO can't set password for AP // needs further inspection if (wirelessSetting->mode() == NetworkManager::WirelessSetting::Ap) {