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 20a7d9ff authored by Martin Kacej's avatar Martin Kacej

method removed from handler

parent 548a779b
......@@ -512,63 +512,6 @@ void Handler::replyFinished(QDBusPendingCallWatcher * watcher)
watcher->deleteLater();
}
void Handler::addConnectionFromQML(const QVariantMap &QMLmap)
{
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);
NetworkManager::Ipv4Setting::Ptr ipSettings = NetworkManager::Ipv4Setting::Ptr(new NetworkManager::Ipv4Setting());
if (QMLmap["method"] == QLatin1String("auto")) {
ipSettings->setMethod(NetworkManager::Ipv4Setting::ConfigMethod::Automatic);
} else {
ipSettings->setMethod(NetworkManager::Ipv4Setting::ConfigMethod::Manual);
NetworkManager::IpAddress ipaddr;
ipaddr.setIp(QHostAddress(QMLmap["address"].toString()));
ipaddr.setPrefixLength(QMLmap["prefix"].toInt());
ipaddr.setGateway(QHostAddress(QMLmap["gateway"].toString()));
ipSettings->setAddresses(QList<NetworkManager::IpAddress>({ipaddr}));
ipSettings->setDns(QList<QHostAddress>({QHostAddress(QMLmap["dns"].toString())}));
}
NetworkManager::ConnectionSettings::Ptr connectionSettings = NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wireless));
connectionSettings->setId(QMLmap.value(QLatin1String("id")).toString());
connectionSettings->setUuid(NetworkManager::ConnectionSettings::createNewUuid());
NMVariantMapMap map = connectionSettings->toMap();
map.insert("802-11-wireless",wirelessSettings->toMap());
map.insert("ipv4",ipSettings->toMap());
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);
}
}
#if WITH_MODEMMANAGER_SUPPORT
void Handler::unlockRequiredChanged(MMModemLock modemLock)
{
......
......@@ -87,8 +87,6 @@ public Q_SLOTS:
void enableNetworking(bool enable);
void enableWireless(bool enable);
void addConnectionFromQML(const QVariantMap &map);
void enableWwan(bool enable);
/**
......
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