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) {
|
if (isActive) {
|
||||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(m_uuid);
|
configPage->setConfigState(NetworkModeConfig::getInstance()->getNetworkModeConfig(m_uuid));
|
||||||
if (configType == -1) {
|
|
||||||
configPage->setConfigState(KSC_FIREWALL_PUBLIC);
|
|
||||||
} else {
|
|
||||||
configPage->setConfigState(configType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ void FirewallDialog::initUI()
|
||||||
QWidget *contentWidget = new QWidget(this);
|
QWidget *contentWidget = new QWidget(this);
|
||||||
QGridLayout *contentLayout = new QGridLayout(contentWidget);
|
QGridLayout *contentLayout = new QGridLayout(contentWidget);
|
||||||
contentLayout->setContentsMargins(0, 0, 0, 0);
|
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_contentLabel, 0, 1);
|
||||||
contentLayout->addWidget(m_suggestLabel, 1, 1);
|
contentLayout->addWidget(m_suggestLabel, 1, 1);
|
||||||
m_iconLabel->setFixedWidth(16);
|
m_iconLabel->setFixedWidth(16);
|
||||||
|
@ -59,7 +59,7 @@ void FirewallDialog::initUI()
|
||||||
btnLayout->addWidget(m_YesBtn);
|
btnLayout->addWidget(m_YesBtn);
|
||||||
btnLayout->addWidget(m_NoBtn);
|
btnLayout->addWidget(m_NoBtn);
|
||||||
|
|
||||||
m_dialogLayout->setContentsMargins(24, 0, 24, 24);
|
m_dialogLayout->setContentsMargins(24, 16, 24, 24);
|
||||||
m_dialogLayout->setSpacing(0);
|
m_dialogLayout->setSpacing(0);
|
||||||
m_dialogLayout->addWidget(contentWidget);
|
m_dialogLayout->addWidget(contentWidget);
|
||||||
m_dialogLayout->addStretch();
|
m_dialogLayout->addStretch();
|
||||||
|
@ -69,7 +69,7 @@ void FirewallDialog::initUI()
|
||||||
m_iconLabel->setPixmap(icon.pixmap(ICON_SIZE));
|
m_iconLabel->setPixmap(icon.pixmap(ICON_SIZE));
|
||||||
|
|
||||||
QFont font = m_contentLabel->font();
|
QFont font = m_contentLabel->font();
|
||||||
font.setWeight(75);
|
font.setWeight(57);
|
||||||
m_contentLabel->setFont(font);
|
m_contentLabel->setFont(font);
|
||||||
//是否允许你的电脑被此网络上的其他电脑和设备发现?
|
//是否允许你的电脑被此网络上的其他电脑和设备发现?
|
||||||
m_contentLabel->setText(tr("Allow your computer to be discovered by other computers and devices on this network?"));
|
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:
|
public:
|
||||||
explicit FirewallDialog(KDialog *parent = nullptr);
|
explicit FirewallDialog(KDialog *parent = nullptr);
|
||||||
~FirewallDialog();
|
~FirewallDialog();
|
||||||
|
void setUuid(QString uuid) {
|
||||||
|
m_uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initUI();
|
void initUI();
|
||||||
|
QString m_uuid;
|
||||||
QLabel * m_iconLabel = nullptr;
|
QLabel * m_iconLabel = nullptr;
|
||||||
QLabel * m_contentLabel = nullptr;
|
QLabel * m_contentLabel = nullptr;
|
||||||
QLabel * m_suggestLabel = nullptr;
|
QLabel * m_suggestLabel = nullptr;
|
||||||
|
@ -49,5 +52,12 @@ private:
|
||||||
signals:
|
signals:
|
||||||
void setPublicNetMode();
|
void setPublicNetMode();
|
||||||
void setPrivateNetMode();
|
void setPrivateNetMode();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void closeMyself(QString uuid, int status) {
|
||||||
|
if (uuid == m_uuid && status == 4) {
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif // FIREWALLDIALOG_H
|
#endif // FIREWALLDIALOG_H
|
||||||
|
|
|
@ -941,6 +941,10 @@ void LanPage::onConnectionStateChange(QString uuid,
|
||||||
|
|
||||||
sendLanStateChangeSignal(uuid, (ConnectState)state);
|
sendLanStateChangeSignal(uuid, (ConnectState)state);
|
||||||
|
|
||||||
|
if (m_activeConnectionMap.keys().contains(uuid) && state == NetworkManager::ActiveConnection::State::Activated) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
qDebug()<<"[LanPage] connection uuid"<< uuid
|
qDebug()<<"[LanPage] connection uuid"<< uuid
|
||||||
<< "state change slot:"<< state;
|
<< "state change slot:"<< state;
|
||||||
|
|
||||||
|
@ -961,23 +965,24 @@ void LanPage::onConnectionStateChange(QString uuid,
|
||||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
|
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
|
||||||
|
|
||||||
if (configType == -1) {
|
if (configType == -1) {
|
||||||
FirewallDialog *fireWallDiaglog = new FirewallDialog();
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC); //默认公有配置
|
||||||
fireWallDiaglog->setWindowTitle(p_newItem->m_connectName);
|
FirewallDialog *fireWallDialog = new FirewallDialog();
|
||||||
|
fireWallDialog->setUuid(uuid);
|
||||||
|
fireWallDialog->setWindowTitle(ssid);
|
||||||
|
|
||||||
connect(fireWallDiaglog, &FirewallDialog::setPrivateNetMode, this, [=](){
|
connect(fireWallDialog, &FirewallDialog::setPrivateNetMode, this, [=](){
|
||||||
fireWallDiaglog->close();
|
fireWallDialog->hide();
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PRIVATE);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(fireWallDiaglog, &FirewallDialog::setPublicNetMode, this, [=](){
|
connect(fireWallDialog, &FirewallDialog::setPublicNetMode, this, [=](){
|
||||||
fireWallDiaglog->close();
|
fireWallDialog->hide();
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(fireWallDiaglog, &FirewallDialog::close, this, [=](){
|
connect(m_activeResourse, &KyActiveConnectResourse::stateChangeReason, fireWallDialog, &FirewallDialog::closeMyself);
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
|
||||||
});
|
fireWallDialog->show();
|
||||||
fireWallDiaglog->show();
|
|
||||||
} else if (configType == KSC_FIREWALL_PUBLIC) {
|
} else if (configType == KSC_FIREWALL_PUBLIC) {
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, deviceName, ssid, KSC_FIREWALL_PUBLIC);
|
||||||
} else if (configType == KSC_FIREWALL_PRIVATE) {
|
} else if (configType == KSC_FIREWALL_PRIVATE) {
|
||||||
|
|
|
@ -955,24 +955,25 @@ void WlanPage::onConnectionStateChanged(QString uuid,
|
||||||
|
|
||||||
if (!isApConnection) {
|
if (!isApConnection) {
|
||||||
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
|
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid);
|
||||||
if (configType == -1) {
|
if (configType == -1) {
|
||||||
FirewallDialog *fireWallDiaglog = new FirewallDialog();
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC); //默认公有配置
|
||||||
fireWallDiaglog->setWindowTitle(ssid);
|
FirewallDialog *fireWallDialog = new FirewallDialog(); //弹窗 供用户配置
|
||||||
connect(fireWallDiaglog, &FirewallDialog::setPrivateNetMode, this, [=](){
|
fireWallDialog->setUuid(uuid);
|
||||||
fireWallDiaglog->close();
|
fireWallDialog->setWindowTitle(ssid);
|
||||||
|
|
||||||
|
connect(fireWallDialog, &FirewallDialog::setPrivateNetMode, this, [=](){
|
||||||
|
fireWallDialog->hide();
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PRIVATE);
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PRIVATE);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(fireWallDiaglog, &FirewallDialog::setPublicNetMode, this, [=](){
|
connect(fireWallDialog, &FirewallDialog::setPublicNetMode, this, [=](){
|
||||||
fireWallDiaglog->close();
|
fireWallDialog->hide();
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(fireWallDiaglog, &FirewallDialog::close, this, [=](){
|
connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason, fireWallDialog, &FirewallDialog::closeMyself);
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
|
|
||||||
});
|
|
||||||
|
|
||||||
fireWallDiaglog->show();
|
fireWallDialog->show();
|
||||||
|
|
||||||
} else if (configType == KSC_FIREWALL_PUBLIC) {
|
} else if (configType == KSC_FIREWALL_PUBLIC) {
|
||||||
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
|
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
|
||||||
|
|
Loading…
Reference in New Issue