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;
if (istateStr == "unmanaged") {
iface->lstate = 2; //switch of wired device is off
}
if (istateStr == "disconnected" || istateStr == "unavailable") {
iface->lstate = 1; //wired network is disconnected
}
if (istateStr == "connected") {
iface->lstate = 0; //wired network is connected
iface->lstate = 3; //switch of wired device is off
} else if (istateStr == "disconnected" || istateStr == "unavailable") {
iface->lstate = 3; //wired network is disconnected
} else if (istateStr == "connected") {
iface->lstate = 3; //wired network is connected
} else {
//连接中,正在配置
iface->lstate = 3;
}
}
if (type == "wifi") {

View File

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