Fix bug error occur when switch to wired interface if refreshing wifi list

This commit is contained in:
chenlelin 2021-01-12 09:36:32 +08:00
parent ce6fec26c7
commit 0c9f34d8d5
3 changed files with 19 additions and 11 deletions

View File

@ -781,7 +781,7 @@ void KylinDBus::onConnectionRemoved(QDBusObjectPath objPath)
syslog(LOG_DEBUG, "An old network was removed from configure directory.");
qDebug()<<"An old network was removed from configure directory.";
if (mw->is_btnNetList_clicked == 1) {
if (mw->is_btnLanList_clicked == 1) {
emit this->updateWiredList(0); //send this signal to update wired network list
}

View File

@ -158,12 +158,12 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui->btnNetList) {
if (event->type() == QEvent::HoverEnter) {
if (!is_btnNetList_clicked) {
if (!is_btnLanList_clicked) {
ui->lbNetListBG->setStyleSheet(btnBgHoverQss);
}
return true;
} else if(event->type() == QEvent::HoverLeave) {
if (!is_btnNetList_clicked) {
if (!is_btnLanList_clicked) {
ui->lbNetListBG->setStyleSheet(btnBgLeaveQss);
}
return true;
@ -637,7 +637,7 @@ void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
this->showNormal();
this->raise();
this->activateWindow();
if (is_btnNetList_clicked == 1) {
if (is_btnLanList_clicked == 1) {
onBtnNetListClicked(0);
}
if (!is_init_wifi_list && !is_connect_hide_wifi) {
@ -1187,7 +1187,7 @@ void MainWindow::onBtnWifiClicked(int flag)
void MainWindow::onBtnNetListClicked(int flag)
{
this->is_btnNetList_clicked = 1;
this->is_btnLanList_clicked = 1;
this->is_btnWifiList_clicked = 0;
ui->lbNetListBG->setStyleSheet(btnOnQss);
@ -1242,7 +1242,7 @@ void MainWindow::onBtnNetListClicked(int flag)
void MainWindow::on_btnWifiList_clicked()
{
this->is_btnWifiList_clicked = 1;
this->is_btnNetList_clicked = 0;
this->is_btnLanList_clicked = 0;
BackThread *bt = new BackThread();
IFace *iface = bt->execGetIface();
@ -1345,6 +1345,10 @@ void MainWindow::on_btnWifiList_clicked()
// 获取lan列表回调
void MainWindow::getLanListDone(QStringList slist)
{
if (this->is_btnWifiList_clicked == 1) {
return;
}
//要求使用上一次获取到的列表
if (this->ksnm->isUseOldLanSlist) {
slist = oldLanSlist;
@ -1562,6 +1566,10 @@ void MainWindow::getLanListDone(QStringList slist)
// 获取wifi列表回调
void MainWindow::getWifiListDone(QStringList slist)
{
if (this->is_btnLanList_clicked == 1) {
return;
}
qDebug()<<"debug: oldWifiSlist.size()="<<oldWifiSlist.size()<<" slist.size()="<<slist.size();
//qDebug()<<"0 ";
@ -2439,7 +2447,7 @@ void MainWindow::enNetDone()
}
void MainWindow::disNetDone()
{
this->is_btnNetList_clicked = 1;
this->is_btnLanList_clicked = 1;
this->is_btnWifiList_clicked = 0;
ui->lbNetListBG->setStyleSheet(btnOnQss);
@ -2508,7 +2516,7 @@ void MainWindow::disWifiDone()
}
void MainWindow::disWifiStateKeep()
{
if (this->is_btnNetList_clicked == 1) {
if (this->is_btnLanList_clicked == 1) {
btnWireless->setSwitchStatus(false);
}
if (this->is_btnWifiList_clicked== 1) {
@ -2651,7 +2659,7 @@ void MainWindow::on_setNetSpeed()
if ( objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusWiFiCardName.toUtf8().data(), &start_rcv_rates, &start_tx_rates) == -1) {
start_rcv_rates = end_rcv_rates;
}
} else if(is_btnNetList_clicked == 1) {
} else if(is_btnLanList_clicked == 1) {
if ( objNetSpeed->getCurrentDownloadRates(currConnIfname.toUtf8().data(), &start_rcv_rates, &start_tx_rates) == -1) {
start_tx_rates = end_tx_rates;
}

View File

@ -148,12 +148,12 @@ public:
//状态设置,0为假1为真
int is_update_wifi_list = 0; //是否是update wifi列表而不是load wifi列表
int is_init_wifi_list = 0; //是否在启动软件时正在获取wifi的列表
int is_btnNetList_clicked = 1; //是否处于有线网界面
int is_btnLanList_clicked = 1; //是否处于有线网界面
int is_btnWifiList_clicked = 0; //是否处于无线网界面
int is_wireless_adapter_ready = 1; //主机是否插入无线网卡
int is_keep_wifi_turn_on_state = 1; //是否要执行wifi开关变为打开样式
int is_stop_check_net_state = 0; //是否要在进行其他操作时停止检查网络状态
int is_connect_net_failed = 0; //刚才是否连接wifi失败
int is_connect_net_failed = 0; //刚才是否连接网络失败
int is_fly_mode_on = 0; //是否已经打开飞行模式
int is_hot_sopt_on = 0; //是否已经打开热点
int is_connect_hide_wifi = 0; //是否正在连接隐藏wifi