Fixbug 131910 首次连接网络弹窗重复问题

This commit is contained in:
zhangyuanyuan1 2022-08-03 11:05:33 +08:00
parent be48c30738
commit 1783bdb86a
4 changed files with 39 additions and 28 deletions

View File

@ -455,12 +455,7 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
//配置页面
if (isActive) {
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(m_uuid);
if (configType == -1) {
configPage->setConfigState(KSC_FIREWALL_PUBLIC);
} else {
configPage->setConfigState(configType);
}
configPage->setConfigState(NetworkModeConfig::getInstance()->getNetworkModeConfig(m_uuid));
}
}

View File

@ -35,10 +35,13 @@ class FirewallDialog : public KDialog
public:
explicit FirewallDialog(KDialog *parent = nullptr);
~FirewallDialog();
void setUuid(QString uuid) {
m_uuid = uuid;
}
private:
void initUI();
QString m_uuid;
QLabel * m_iconLabel = nullptr;
QLabel * m_contentLabel = nullptr;
QLabel * m_suggestLabel = nullptr;
@ -49,5 +52,12 @@ private:
signals:
void setPublicNetMode();
void setPrivateNetMode();
public slots:
void closeMyself(QString uuid, int status) {
if (uuid == m_uuid && status == 4) {
this->close();
}
}
};
#endif // FIREWALLDIALOG_H

View File

@ -926,6 +926,10 @@ void LanPage::onConnectionStateChange(QString uuid,
return;
}
if (m_activeConnectionMap.keys().contains(uuid) && state == NetworkManager::ActiveConnection::State::Activated) {
return;
}
sendLanStateChangeSignal(uuid, (ConnectState)state);
qDebug()<<"[LanPage] connection uuid"<< uuid
@ -948,23 +952,24 @@ void LanPage::onConnectionStateChange(QString uuid,
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
if (configType == -1) {
FirewallDialog *fireWallDiaglog = new FirewallDialog();
fireWallDiaglog->setWindowTitle(p_newItem->m_connectName);
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC); //默认公有配置
FirewallDialog *fireWallDialog = new FirewallDialog();
fireWallDialog->setUuid(uuid);
fireWallDialog->setWindowTitle(ssid);
connect(fireWallDiaglog, &FirewallDialog::setPrivateNetMode, this, [=](){
fireWallDiaglog->close();
connect(fireWallDialog, &FirewallDialog::setPrivateNetMode, this, [=](){
fireWallDialog->hide();
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
});
connect(fireWallDiaglog, &FirewallDialog::setPublicNetMode, this, [=](){
fireWallDiaglog->close();
connect(fireWallDialog, &FirewallDialog::setPublicNetMode, this, [=](){
fireWallDialog->hide();
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
});
connect(fireWallDiaglog, &FirewallDialog::close, this, [=](){
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
});
fireWallDiaglog->show();
connect(m_activeResourse, &KyActiveConnectResourse::stateChangeReason, fireWallDialog, &FirewallDialog::closeMyself);
fireWallDialog->show();
} else if (configType == KSC_FIREWALL_PUBLIC) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
} else if (configType == KSC_FIREWALL_PRIVATE) {

View File

@ -942,24 +942,25 @@ void WlanPage::onConnectionStateChanged(QString uuid,
if (!isApConnection) {
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
if (configType == -1) {
FirewallDialog *fireWallDiaglog = new FirewallDialog();
fireWallDiaglog->setWindowTitle(ssid);
connect(fireWallDiaglog, &FirewallDialog::setPrivateNetMode, this, [=](){
fireWallDiaglog->close();
if (configType == -1) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC); //默认公有配置
FirewallDialog *fireWallDialog = new FirewallDialog(); //弹窗 供用户配置
fireWallDialog->setUuid(uuid);
fireWallDialog->setWindowTitle(ssid);
connect(fireWallDialog, &FirewallDialog::setPrivateNetMode, this, [=](){
fireWallDialog->hide();
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PRIVATE);
});
connect(fireWallDiaglog, &FirewallDialog::setPublicNetMode, this, [=](){
fireWallDiaglog->close();
connect(fireWallDialog, &FirewallDialog::setPublicNetMode, this, [=](){
fireWallDialog->hide();
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
});
connect(fireWallDiaglog, &FirewallDialog::close, this, [=](){
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
});
connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason, fireWallDialog, &FirewallDialog::closeMyself);
fireWallDiaglog->show();
fireWallDialog->show();
} else if (configType == KSC_FIREWALL_PUBLIC) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);