Merge branch 'networkmode' into 'dbus-interface'
Fixbug 131910 首次连接网络弹窗重复问题 See merge request kylin-desktop/kylin-nm!684
This commit is contained in:
commit
48ef36759e
|
@ -481,12 +481,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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ void FirewallDialog::initUI()
|
|||
QWidget *contentWidget = new QWidget(this);
|
||||
QGridLayout *contentLayout = new QGridLayout(contentWidget);
|
||||
contentLayout->setContentsMargins(0, 0, 0, 0);
|
||||
contentLayout->addWidget(m_iconLabel, 0, 0, Qt::AlignTop);
|
||||
contentLayout->addWidget(m_iconLabel, 0, 0, Qt::AlignVCenter);
|
||||
contentLayout->addWidget(m_contentLabel, 0, 1);
|
||||
contentLayout->addWidget(m_suggestLabel, 1, 1);
|
||||
m_iconLabel->setFixedWidth(16);
|
||||
|
@ -59,7 +59,7 @@ void FirewallDialog::initUI()
|
|||
btnLayout->addWidget(m_YesBtn);
|
||||
btnLayout->addWidget(m_NoBtn);
|
||||
|
||||
m_dialogLayout->setContentsMargins(24, 0, 24, 24);
|
||||
m_dialogLayout->setContentsMargins(24, 16, 24, 24);
|
||||
m_dialogLayout->setSpacing(0);
|
||||
m_dialogLayout->addWidget(contentWidget);
|
||||
m_dialogLayout->addStretch();
|
||||
|
@ -69,7 +69,7 @@ void FirewallDialog::initUI()
|
|||
m_iconLabel->setPixmap(icon.pixmap(ICON_SIZE));
|
||||
|
||||
QFont font = m_contentLabel->font();
|
||||
font.setWeight(75);
|
||||
font.setWeight(57);
|
||||
m_contentLabel->setFont(font);
|
||||
//是否允许你的电脑被此网络上的其他电脑和设备发现?
|
||||
m_contentLabel->setText(tr("Allow your computer to be discovered by other computers and devices on this network?"));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -941,6 +941,10 @@ void LanPage::onConnectionStateChange(QString uuid,
|
|||
|
||||
sendLanStateChangeSignal(uuid, (ConnectState)state);
|
||||
|
||||
if (m_activeConnectionMap.keys().contains(uuid) && state == NetworkManager::ActiveConnection::State::Activated) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug()<<"[LanPage] connection uuid"<< uuid
|
||||
<< "state change slot:"<< state;
|
||||
|
||||
|
@ -961,23 +965,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) {
|
||||
|
|
|
@ -956,23 +956,24 @@ 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();
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue