fix(wifi): wifi button is closed when connected wifi.
Description: 修复连接wifi时wifi开关被关闭的问题 Log: 修复连接wifi时wifi开关被关闭的问题
This commit is contained in:
parent
fcfb6e01e9
commit
43ddb2f851
|
@ -106,7 +106,7 @@ KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent)
|
||||||
if (mw) {
|
if (mw) {
|
||||||
QObject::connect(this, SIGNAL(updateWiredList(int)), mw, SLOT(onBtnNetListClicked(int)));
|
QObject::connect(this, SIGNAL(updateWiredList(int)), mw, SLOT(onBtnNetListClicked(int)));
|
||||||
QObject::connect(this, SIGNAL(newConnAdded(int)), mw, SLOT(onNewConnAdded(int)));
|
QObject::connect(this, SIGNAL(newConnAdded(int)), mw, SLOT(onNewConnAdded(int)));
|
||||||
QObject::connect(this, SIGNAL(updateWirelessList()), mw, SLOT(on_btnWifiList_clicked()));
|
QObject::connect(this, SIGNAL(updateWirelessList()), mw, SLOT(on_wifi_changed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
mUtils = new Utils();
|
mUtils = new Utils();
|
||||||
|
|
|
@ -1373,6 +1373,26 @@ void MainWindow::on_btnWifiList_clicked()
|
||||||
bt->deleteLater();
|
bt->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_wifi_changed()
|
||||||
|
{
|
||||||
|
QString actWifiUuid = objKyDBus->getActiveWifiUuid();
|
||||||
|
objKyDBus->getConnectNetIp(actWifiUuid);
|
||||||
|
objKyDBus->getWifiIp(actWifiUuid);
|
||||||
|
if (oldWifiIpv4Method == "") {
|
||||||
|
oldWifiIpv4Method = objKyDBus-> dbusWifiIpv4Method;
|
||||||
|
}
|
||||||
|
if (objKyDBus->dbusWifiIpv4 != "" && objKyDBus->dbusActiveWifiIpv4 != "" && objKyDBus->dbusWifiIpv4 != objKyDBus->dbusActiveWifiIpv4 &&objKyDBus-> dbusWifiIpv4Method == "manual") {
|
||||||
|
//在第三方nm-connection-editor进行新的IP配置后,重新连接网络
|
||||||
|
oldWifiIpv4Method = "manual";
|
||||||
|
qDebug()<<"Ipv4.address of current activated wifi is:"<<objKyDBus->dbusActiveWifiIpv4 << ". Real ipv4.address is:" << objKyDBus->dbusWifiIpv4;
|
||||||
|
emit this->reConnectWifi(actWifiUuid);
|
||||||
|
} else if (objKyDBus-> dbusWifiIpv4Method == "auto" && oldWifiIpv4Method == "manual") {
|
||||||
|
oldWifiIpv4Method = "auto";
|
||||||
|
qDebug()<<"Ipv4.method is set to auto.";
|
||||||
|
emit this->reConnectWifi(actWifiUuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MainWindow::onNewConnAdded 获取新的连接列表
|
* @brief MainWindow::onNewConnAdded 获取新的连接列表
|
||||||
* @param type 0为有线,1为无线
|
* @param type 0为有线,1为无线
|
||||||
|
@ -1641,22 +1661,22 @@ void MainWindow::getWifiListDone(QStringList slist)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString actWifiUuid = objKyDBus->getActiveWifiUuid();
|
// QString actWifiUuid = objKyDBus->getActiveWifiUuid();
|
||||||
objKyDBus->getConnectNetIp(actWifiUuid);
|
// objKyDBus->getConnectNetIp(actWifiUuid);
|
||||||
objKyDBus->getWifiIp(actWifiUuid);
|
// objKyDBus->getWifiIp(actWifiUuid);
|
||||||
if (oldWifiIpv4Method == "") {
|
// if (oldWifiIpv4Method == "") {
|
||||||
oldWifiIpv4Method = objKyDBus-> dbusWifiIpv4Method;
|
// oldWifiIpv4Method = objKyDBus-> dbusWifiIpv4Method;
|
||||||
}
|
// }
|
||||||
if (objKyDBus->dbusWifiIpv4 != "" && objKyDBus->dbusActiveWifiIpv4 != "" && objKyDBus->dbusWifiIpv4 != objKyDBus->dbusActiveWifiIpv4 &&objKyDBus-> dbusWifiIpv4Method == "manual") {
|
// if (objKyDBus->dbusWifiIpv4 != "" && objKyDBus->dbusActiveWifiIpv4 != "" && objKyDBus->dbusWifiIpv4 != objKyDBus->dbusActiveWifiIpv4 &&objKyDBus-> dbusWifiIpv4Method == "manual") {
|
||||||
//在第三方nm-connection-editor进行新的IP配置后,重新连接网络
|
// //在第三方nm-connection-editor进行新的IP配置后,重新连接网络
|
||||||
oldWifiIpv4Method = "manual";
|
// oldWifiIpv4Method = "manual";
|
||||||
qDebug()<<"Ipv4.address of current activated wifi is:"<<objKyDBus->dbusActiveWifiIpv4 << ". Real ipv4.address is:" << objKyDBus->dbusWifiIpv4;
|
// qDebug()<<"Ipv4.address of current activated wifi is:"<<objKyDBus->dbusActiveWifiIpv4 << ". Real ipv4.address is:" << objKyDBus->dbusWifiIpv4;
|
||||||
emit this->reConnectWifi(actWifiUuid);
|
// emit this->reConnectWifi(actWifiUuid);
|
||||||
} else if (objKyDBus-> dbusWifiIpv4Method == "auto" && oldWifiIpv4Method == "manual") {
|
// } else if (objKyDBus-> dbusWifiIpv4Method == "auto" && oldWifiIpv4Method == "manual") {
|
||||||
oldWifiIpv4Method = "auto";
|
// oldWifiIpv4Method = "auto";
|
||||||
qDebug()<<"Ipv4.method is set to auto.";
|
// qDebug()<<"Ipv4.method is set to auto.";
|
||||||
emit this->reConnectWifi(actWifiUuid);
|
// emit this->reConnectWifi(actWifiUuid);
|
||||||
}
|
// }
|
||||||
//qDebug()<<"debug: oldWifiSlist.size()="<<oldWifiSlist.size()<<" slist.size()="<<slist.size();
|
//qDebug()<<"debug: oldWifiSlist.size()="<<oldWifiSlist.size()<<" slist.size()="<<slist.size();
|
||||||
|
|
||||||
//qDebug()<<"------------";
|
//qDebug()<<"------------";
|
||||||
|
|
|
@ -209,6 +209,7 @@ public slots:
|
||||||
void on_btnHotspot_clicked();
|
void on_btnHotspot_clicked();
|
||||||
void on_btnHotspotState();
|
void on_btnHotspotState();
|
||||||
void on_btnWifiList_clicked();
|
void on_btnWifiList_clicked();
|
||||||
|
void on_wifi_changed();
|
||||||
|
|
||||||
void connWifiDone(int connFlag);
|
void connWifiDone(int connFlag);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue