Fix bug program crash when click to configure a wifi if use old version network-manager
This commit is contained in:
parent
b18e6ef01e
commit
0c0ba3bffb
|
@ -339,9 +339,10 @@ QString BackThread::getConnProp(QString connName)
|
|||
QString v4method = line.mid(12).trimmed();
|
||||
rtn += "method:" + v4method + "|";
|
||||
}
|
||||
|
||||
if (line.startsWith("ipv4.addresses:")) {
|
||||
QString value = line.mid(15).trimmed();
|
||||
if (value == "--") {
|
||||
if (value == "--" || value == "") {
|
||||
rtn += "addr:|mask:|";
|
||||
} else {
|
||||
QString addr = value.split("/").at(0);
|
||||
|
@ -350,17 +351,19 @@ QString BackThread::getConnProp(QString connName)
|
|||
rtn += "mask:" + mask + "|";
|
||||
}
|
||||
}
|
||||
|
||||
if (line.startsWith("ipv4.gateway:")) {
|
||||
QString value = line.mid(13).trimmed();
|
||||
if (value == "--") {
|
||||
if (value == "--" || value == "") {
|
||||
rtn += "gateway:|";
|
||||
} else {
|
||||
rtn += "gateway:" + value + "|";
|
||||
}
|
||||
}
|
||||
|
||||
if (line.startsWith("ipv4.dns:")) {
|
||||
QString value = line.mid(9).trimmed();
|
||||
if (value == "--") {
|
||||
if (value == "--" || value == "") {
|
||||
rtn += "dns:|";
|
||||
} else {
|
||||
rtn += "dns:" + value + "|";
|
||||
|
|
|
@ -644,13 +644,15 @@ void OneConnForm::on_btnInfo_clicked()
|
|||
dns = line.split(":").at(1);
|
||||
}
|
||||
}
|
||||
// qDebug()<<v4method<<addr<<mask<<gateway<<dns;
|
||||
// qDebug()<<"v4method:"<<v4method<<" addr:"<<addr<<" mask:"<<mask<<" gateway:"<<gateway<<" dns:"<<dns;
|
||||
|
||||
cf->setProp(ui->lbName->text(), v4method, addr, mask, gateway, dns, this->isActive);
|
||||
|
||||
cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2);
|
||||
cf->show();
|
||||
cf->raise();
|
||||
|
||||
bt->deleteLater();
|
||||
}
|
||||
|
||||
// Wifi连接结果,0成功 1失败 2没有配置文件
|
||||
|
|
Loading…
Reference in New Issue