Fix bug list of wired interface show abnormal

This commit is contained in:
chenlelin 2021-01-10 11:52:59 +08:00
parent 63e25aa409
commit 8229c92ed0
2 changed files with 15 additions and 14 deletions

View File

@ -86,13 +86,14 @@ IFace* BackThread::execGetIface()
iface->lname = iname; iface->lname = iname;
if (istateStr == "unmanaged") { if (istateStr == "unmanaged") {
iface->lstate = 2; //switch of wired device is off iface->lstate = 3; //switch of wired device is off
} } else if (istateStr == "disconnected" || istateStr == "unavailable") {
if (istateStr == "disconnected" || istateStr == "unavailable") { iface->lstate = 3; //wired network is disconnected
iface->lstate = 1; //wired network is disconnected } else if (istateStr == "connected") {
} iface->lstate = 3; //wired network is connected
if (istateStr == "connected") { } else {
iface->lstate = 0; //wired network is connected //连接中,正在配置
iface->lstate = 3;
} }
} }
if (type == "wifi") { if (type == "wifi") {

View File

@ -1217,9 +1217,14 @@ void MainWindow::onBtnNetListClicked(int flag)
return; return;
} }
if (iface->lstate != 2) { if (iface->lstate == 0 || iface->lstate == 1) {
this->startLoading(); this->startLoading();
this->ksnm->execGetLanList(); this->ksnm->execGetLanList();
} else if (iface->lstate == 3) {
this->ksnm->isUseOldLanSlist = true;
QStringList slistLan;
slistLan.append("empty");
getLanListDone(slistLan);
} else { } else {
this->startLoading(); this->startLoading();
this->ksnm->execGetLanList(); this->ksnm->execGetLanList();
@ -1259,13 +1264,8 @@ void MainWindow::on_btnWifiList_clicked()
ui->lbNetwork->setText(tr("Wifi")); ui->lbNetwork->setText(tr("Wifi"));
btnWireless->show(); btnWireless->show();
if (iface->wstate == 0 || iface->wstate == 1) {
btnWireless->setSwitchStatus(true);
} else {
btnWireless->setSwitchStatus(false);
}
if (iface->wstate != 2) { if (iface->wstate == 0 || iface->wstate == 1) {
btnWireless->setSwitchStatus(true); btnWireless->setSwitchStatus(true);
lbTopWifiList->show(); lbTopWifiList->show();
btnAddNet->show(); btnAddNet->show();