Fix bug can not reconnect wifi

This commit is contained in:
you name 2021-04-02 15:58:23 +08:00
parent a9aed41a63
commit 4b8486249a
3 changed files with 11 additions and 9 deletions

View File

@ -1629,8 +1629,8 @@ void KylinDBus::onPropertiesChanged(QVariantMap qvm)
//接收到自动连接的信号过后执行自动连接wifi
void KylinDBus::onAutoConnect()
{
syslog(LOG_DEBUG, "Receive a auto-connect signal to reconnect network");
qDebug() << "Receive a auto-connect signal to reconnect network";
syslog(LOG_DEBUG, "Receive a auto-connect signal to reconnect wifi");
qDebug() << "Receive a auto-connect signal to reconnect wifi";
mw->toReconnectWifi();
}

View File

@ -3168,18 +3168,20 @@ void MainWindow::on_btnHotspotState()
//执行wifi的重新连接
void MainWindow::toReconnectWifi()
{
if (canReconnectNetwork) {
canReconnectNetwork = false;
if (!is_stop_check_net_state && isHuaWeiPC) {
if (canReconnectWifiTimeInterval) {
canReconnectWifiTimeInterval = false;
QTimer::singleShot(2*1000, this, SLOT(timeIntervalToConnectWifi() ));
if (isHuaWeiPC) {
current_wifi_list_state = RECONNECT_WIFI;
this->ksnm->execGetWifiList(this->wcardname);
}
}
}
void MainWindow::toChangeReconnectValue()
void MainWindow::timeIntervalToConnectWifi()
{
canReconnectNetwork = true;
canReconnectWifiTimeInterval = true;
}
//处理外界对网络的连接与断开

View File

@ -183,7 +183,7 @@ public:
bool isReconnectingLan = false; //是否正在执行lan的回连
int addNumberForWifi = 0; //短时间内收到关于wifi连接信号的次数
bool isHuaWeiPC;
bool canReconnectNetwork = true;
bool canReconnectWifiTimeInterval = true;
QString currSelNetName = ""; //当前ScrollArea中选中的网络名称
QStringList canReconnectWifiList; //当前可以回连的wifi列表
@ -234,7 +234,7 @@ public slots:
void checkIfConnectedWifiExist();
void toReconnectWifi();
void toChangeReconnectValue();
void timeIntervalToConnectWifi();
void rfkillDisableWifiDone();
void rfkillEnableWifiDone();