Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit f579d8d9 authored by Martin Kacej's avatar Martin Kacej

implemented security options to editor

parent 726adae5
......@@ -548,7 +548,10 @@ QVariantMap Handler::getActiveConnectionInfo(const QString &connection)
void Handler::addConnectionFromQML(const QVariantMap &QMLmap)
{
if (!QMLmap.isEmpty()) {
if (QMLmap.isEmpty())
return;
if (QMLmap["mode"].toString() == "infrastructure") {
NetworkManager::WirelessSetting::Ptr wirelessSettings = NetworkManager::WirelessSetting::Ptr(new NetworkManager::WirelessSetting());
wirelessSettings->setSsid(QMLmap.value(QLatin1String("id")).toString().toUtf8());
wirelessSettings->setMode(NetworkManager::WirelessSetting::Infrastructure);
......@@ -574,7 +577,28 @@ void Handler::addConnectionFromQML(const QVariantMap &QMLmap)
map.insert("802-11-wireless",wirelessSettings->toMap());
map.insert("ipv4",ipSettings->toMap());
//qWarning() << map;
if (QMLmap.contains("802-11-wireless-security")) {
QVariantMap securMap = QMLmap["802-11-wireless-security"].toMap();
int type = securMap["type"].toInt();
if (!type == NetworkManager::NoneSecurity) {
NetworkManager::WirelessSecuritySetting::Ptr securitySettings = NetworkManager::WirelessSecuritySetting::Ptr(new NetworkManager::WirelessSecuritySetting());
if (type == NetworkManager::Wpa2Psk ) {
securitySettings->setKeyMgmt(NetworkManager::WirelessSecuritySetting::KeyMgmt::WpaPsk);
securitySettings->setAuthAlg(NetworkManager::WirelessSecuritySetting::AuthAlg::Open);
securitySettings->setPskFlags(NetworkManager::Setting::SecretFlagType::AgentOwned);
securitySettings->setPsk(securMap["password"].toString());
}
if (type == NetworkManager::StaticWep) {
securitySettings->setKeyMgmt(NetworkManager::WirelessSecuritySetting::KeyMgmt::Wep);
securitySettings->setAuthAlg(NetworkManager::WirelessSecuritySetting::AuthAlg::Open);
securitySettings->setWepKeyType(NetworkManager::WirelessSecuritySetting::WepKeyType::Hex);
securitySettings->setWepKeyFlags(NetworkManager::Setting::SecretFlagType::AgentOwned);
securitySettings->setWepKey0(securMap["password"].toString());
}
map.insert("802-11-wireless-security",securitySettings->toMap());
}
}
qWarning() << map;
this->addConnection(map);
}
}
......
......@@ -85,6 +85,8 @@ Kirigami.ScrollablePage{
connection = editorIpSection.ipmap
connection["id"] = ssidField.text
connection["mode"] = "infrastructure"
connection["802-11-wireless-security"] = editorSecuritySection.securityMap
console.info(connection)
handler.addConnectionFromQML(connection)
console.info('Connection saved '+ connection["id"])
}
......
......@@ -20,14 +20,13 @@
import QtQuick 2.6
import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.2 as Layouts
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
Layouts.ColumnLayout {
id:securitySectionView
property var securityMap: ({})
property var enabledSave: true
property var enabledSave: !wepWpaPasswordField.visible || (wepWpaPasswordField.visible && wepWpaPasswordField.acceptableInput)
property alias password: wepWpaPasswordField.text
width: parent.width
Column {
......@@ -64,6 +63,9 @@ Layouts.ColumnLayout {
securityCombobox.currentIndex = 0
}
}
onCurrentIndexChanged: {
securitySectionView.state = securityTypesModel.get(currentIndex).type;
}
}
Controls.Label {
......@@ -83,6 +85,7 @@ Layouts.ColumnLayout {
id: wepWpaPasswordField
width: parent.width
securityType: securityTypesModel.get(securityCombobox.currentIndex).type
}
}
}
......@@ -99,6 +102,36 @@ Layouts.ColumnLayout {
id: authComboBox
model: [i18n("TLS"), i18n("LEAP"), i18n("FAST"), i18n("Tunneled TLS"), i18n("Protected EAP")] // more - SIM, AKA, PWD ?
}
Controls.Label{
text: "----Not yet implemented----"
color: "red"
}
}
}
states: [
State {
name: PlasmaNM.Enums.NoneSecurity
PropertyChanges {
target: securitySectionView; securityMap: {"type" : PlasmaNM.Enums.NoneSecurity }
}
},
State {
name: PlasmaNM.Enums.StaticWep
PropertyChanges {
target: securitySectionView; securityMap: { "type" : PlasmaNM.Enums.StaticWep,
"password" : password
}
}
},
State {
name: PlasmaNM.Enums.Wpa2Psk
PropertyChanges {
target: securitySectionView; securityMap: { "type" : PlasmaNM.Enums.Wpa2Psk,
"password" : password
}
}
}
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment