Merge branch 'master' of https://github.com/ukui/kylin-nm
This commit is contained in:
commit
6b0d083aad
|
@ -132,6 +132,7 @@ ConfForm::ConfForm(QWidget *parent) :
|
|||
setModal(false);
|
||||
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
|
||||
setEnableOfBtn();
|
||||
}
|
||||
|
||||
ConfForm::~ConfForm()
|
||||
|
@ -254,11 +255,22 @@ void ConfForm::on_btnCreate_clicked()
|
|||
kylindbus.showDesktopNotify(txt);
|
||||
}
|
||||
|
||||
QString name = ui->leName->text();
|
||||
QStringList charToEscape;
|
||||
charToEscape << "~" << "(" << ")" << "<" << ">" <<"\\" << "*" << "|" << "&" << "#"; //一些命令行特殊字符,需要转义
|
||||
foreach (auto ch , charToEscape) {
|
||||
if (name.contains(ch)) {
|
||||
name.replace(ch, QString("%1%2").arg("\\").arg(ch));
|
||||
}
|
||||
}
|
||||
if (name.contains(" ")) { //空格会影响命令行参数的判断,需要转义
|
||||
name.replace(QRegExp("[\\s]"), "\\\ ");
|
||||
}
|
||||
if (!ui->leAddr_ipv6->text().isEmpty()) {
|
||||
QString cmdStr = "nmcli connection modify " + ui->leName->text() + " ipv6.method manual ipv6.addresses " + ui->leAddr_ipv6->text();
|
||||
QString cmdStr = "nmcli connection modify " + name + " ipv6.method manual ipv6.addresses " + ui->leAddr_ipv6->text();
|
||||
Utils::m_system(cmdStr.toUtf8().data());
|
||||
} else {
|
||||
QString cmdStr = "nmcli connection modify " + ui->leName->text() + " ipv6.method auto";
|
||||
QString cmdStr = "nmcli connection modify " + name + " ipv6.method auto";
|
||||
Utils::m_system(cmdStr.toUtf8().data());
|
||||
}
|
||||
|
||||
|
@ -352,15 +364,15 @@ void ConfForm::on_btnSave_clicked()
|
|||
}
|
||||
|
||||
if (ui->cbType->currentIndex() == 1) {
|
||||
//对于已保存连接修改ipv6地址,使用UUID区分各网络配置(排除名称含空格或特殊字符的干扰)
|
||||
if (!ui->leAddr_ipv6->text().isEmpty()) {
|
||||
QString cmdStr = "nmcli connection modify " + ui->leName->text() + " ipv6.method manual ipv6.addresses " + ui->leAddr_ipv6->text();
|
||||
QString cmdStr = "nmcli connection modify " + netUuid + " ipv6.method manual ipv6.addresses " + ui->leAddr_ipv6->text();
|
||||
Utils::m_system(cmdStr.toUtf8().data());
|
||||
} else {
|
||||
QString cmdStr = "nmcli connection modify " + ui->leName->text() + " ipv6.method auto";
|
||||
QString cmdStr = "nmcli connection modify " + netUuid + " ipv6.method auto";
|
||||
Utils::m_system(cmdStr.toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
QString txt(tr("New network settings already finished"));
|
||||
kylindbus.showDesktopNotify(txt);
|
||||
}
|
||||
|
@ -554,7 +566,7 @@ void ConfForm::on_leDns_textEdited(const QString &arg1)
|
|||
//编辑网络备用DNS
|
||||
void ConfForm::on_leDns2_textEdited(const QString &arg1)
|
||||
{
|
||||
// this->setEnableOfBtn();
|
||||
this->setEnableOfBtn();
|
||||
}
|
||||
|
||||
//设置界面按钮是否可点击
|
||||
|
@ -585,6 +597,14 @@ void ConfForm::setEnableOfBtn()
|
|||
this->setBtnEnableFalse();
|
||||
return;
|
||||
}
|
||||
if(ui->leDns2->text().isEmpty()){
|
||||
|
||||
}else{
|
||||
if(!this->getTextEditState(ui->leDns2->text())){
|
||||
this->setBtnEnableFalse();
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -369,6 +369,8 @@ void KylinDBus::getLanIpDNS(QString uuidName, bool isActNet)
|
|||
dbusArg2nd.endArray();
|
||||
|
||||
dbusLanIpv6 = m_map.value("address").toString();
|
||||
} else if (inner_key == "method") {
|
||||
dbusLanIpv6Method = innerMap.value(inner_key).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
|
||||
QString dbusLanIpv4 = "";
|
||||
QString dbusLanIpv6 = "";
|
||||
QString dbusLanIpv6Method = "";
|
||||
QString dbusActiveLanIpv4 = "";
|
||||
QString dbusActiveLanIpv6 = "";
|
||||
QString dbusLanGateway = "";
|
||||
|
|
|
@ -1604,6 +1604,9 @@ void MainWindow::getLanListDone(QStringList slist)
|
|||
} else if ((oldActLanName == actLanSsidName.at(kk)) && (oldDbusActLanDNS != objKyDBus->dbusActLanDNS)) {
|
||||
//在第三方nm-connection-editor进行新的DNS配置后,重新连接网络
|
||||
objKyDBus->reConnectWiredNet(nuuid);
|
||||
} else if (!objKyDBus->dbusActiveLanIpv6.isEmpty() && objKyDBus->dbusActiveLanIpv6 != objKyDBus->dbusLanIpv6 && objKyDBus->dbusLanIpv6Method == "manual") {
|
||||
//在第三方nm-connection-editor或kylin-nm配置页进行新的IPV6配置后,重新连接网络
|
||||
objKyDBus->reConnectWiredNet(nuuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue