Merge pull request #96 from mammonsama666/0325-dev

Fix bugs.
This commit is contained in:
chenlelin 2021-03-25 15:45:55 +08:00 committed by GitHub
commit cc4f51647f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 2 deletions

View File

@ -429,7 +429,7 @@ void ConfForm::saveNetworkConfiguration()
kylin_network_set_automethod(netUuid.toUtf8().data());
}
else {
if (newUuid != "--") {
if (newUuid != "--" && newUuid != "" && !newUuid.isEmpty()) {
qDebug() << Q_FUNC_INFO << __LINE__ << name << newUuid << ui->leAddr->text() << mask << ui->leGateway->text() << dnss;
kylin_network_set_manualall(newUuid.toUtf8().data(), ui->leAddr->text().toUtf8().data(), mask.toUtf8().data(), ui->leGateway->text().toUtf8().data(), dnss.toUtf8().data());
} else {

View File

@ -436,6 +436,24 @@ void KylinDBus::getWifiIp(QString uuid)
}
}
}
if (key == "ipv6") {
for (QString inner_key : innerMap.keys()) {
if (inner_key == "address-data"){
const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value<QDBusArgument>();
QMap<QString,QVariant> m_map;
dbusArg2nd.beginArray();
while (!dbusArg2nd.atEnd()) {
dbusArg2nd >> m_map;// append map to a vector here if you want to keep it
}
dbusArg2nd.endArray();
dbusWifiIpv6 = m_map.value("address").toString();
} else if (inner_key == "method") {
dbusWifiIpv6Method = innerMap.value(inner_key).toString();
}
}
}
}
}
} else {
@ -522,7 +540,7 @@ void KylinDBus::getConnectNetIp(QString netUuid)
QDBusReply<QVariant> replyType = interfacePro.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type");
QDBusReply<QVariant> replyUuid = interfacePro.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Uuid");
if (replyType.value().toString() == "ethernet" || replyType.value().toString() == "802-3-ethernet") { //有线网
if (replyType.value().toString() == "ethernet" || replyType.value().toString() == "802-3-ethernet" || replyType.value().toString() == "bluetooth") { //有线网或蓝牙共享网络
if (replyUuid.value().toString() == netUuid) {
//ipv4的路径信息和ip信息
QDBusInterface interfaceIp4( "org.freedesktop.NetworkManager",
@ -619,6 +637,37 @@ void KylinDBus::getConnectNetIp(QString netUuid)
foreach (QVariantMap mDataIpv4, mDatasIpv4) {
dbusActiveWifiIpv4 = mDataIpv4.value("address").toString();
}
//ipv6的路径信息和ip信息
QDBusInterface interfaceIp6( "org.freedesktop.NetworkManager",
objPath.path(),
"org.freedesktop.DBus.Properties",
QDBusConnection::systemBus() );
QDBusMessage replyIp6 = interfaceIp6.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Ip6Config");
QList<QVariant> outArgsIp6 = replyIp6.arguments();
QVariant firstIp6 = outArgsIp6.at(0);
QDBusVariant dbvFirstIp6 = firstIp6.value<QDBusVariant>();
QVariant vFirstIp6 = dbvFirstIp6.variant();
QDBusObjectPath dbusPathIp6 = vFirstIp6.value<QDBusObjectPath>();
QDBusInterface interfaceIpv6( "org.freedesktop.NetworkManager",
dbusPathIp6.path(),
"org.freedesktop.DBus.Properties",
QDBusConnection::systemBus() );
QDBusMessage replyIpv6 = interfaceIpv6.call("Get", "org.freedesktop.NetworkManager.IP6Config", "AddressData");
QList<QVariant> outArgsIpv6 = replyIpv6.arguments();
QVariant firstIpv6 = outArgsIpv6.at(0);
QDBusVariant dbvFirstIpv6 = firstIpv6.value<QDBusVariant>();
QVariant vFirstIpv6 = dbvFirstIpv6.variant();
const QDBusArgument &dbusArgIpv6 = vFirstIpv6.value<QDBusArgument>();
QList<QVariantMap> mDatasIpv6;
dbusArgIpv6 >> mDatasIpv6;
foreach (QVariantMap mDataIpv6, mDatasIpv6) {
dbusActiveWifiIpv6 = mDataIpv6.value("address").toString();
}
}
}
}

View File

@ -93,10 +93,13 @@ public:
QString dbusLanIpv6 = "";
QString dbusLanIpv6Method = "";
QString dbusWifiIpv4Method = "";
QString dbusWifiIpv6Method = "";
QString dbusActiveLanIpv4 = "";
QString dbusActiveLanIpv6 = "";
QString dbusActiveWifiIpv4 = "";
QString dbusActiveWifiIpv6 = "";
QString dbusWifiIpv4 = "";
QString dbusWifiIpv6 = "";
QString dbusLanGateway = "";
QString dbusWiFiCardName = "";
QString dbusWifiMac = "";

View File

@ -1402,6 +1402,9 @@ void MainWindow::on_wifi_changed()
oldWifiIpv4Method = "auto";
qDebug()<<"Ipv4.method is set to auto.";
emit this->reConnectWifi(actWifiUuid);
} else if (!objKyDBus->dbusActiveWifiIpv6.isEmpty() && objKyDBus->dbusActiveWifiIpv6 != objKyDBus->dbusWifiIpv6 && objKyDBus->dbusWifiIpv6Method == "manual") {
//在第三方nm-connection-editor或kylin-nm配置页进行新的IPV6配置后重新连接网络
emit this->reConnectWifi(actWifiUuid);
}
}