Merge branch 'dbus-interface-fork' into 'dbus-interface'

解决开启移动热点时连接状态变化,弹出安全管控页面的BUG, 解决部分机型WiFi断开后连接列表仍然显示的BUG

See merge request kylin-desktop/kylin-nm!673
This commit is contained in:
陈学超 2022-07-25 07:38:18 +00:00
commit d593223fe7
6 changed files with 65 additions and 49 deletions

View File

@ -130,7 +130,6 @@ void BlacklistPage::addBlacklistDevFrame(QString staMac, QString staName)
void BlacklistPage::clearBlacklistLayout()
{
m_blacklistMap.clear();
if (m_blacklistLayout->layout() != NULL) {
QLayoutItem* layoutItem;
while ((layoutItem = m_blacklistLayout->layout()->takeAt(0)) != NULL) {
@ -157,12 +156,8 @@ bool BlacklistPage::removeStaFromBlacklist(QString staMac)
return true;
}
void BlacklistPage::refreshBlacklist()
void BlacklistPage::resetLayoutHight()
{
clearBlacklistLayout();
getBlacklistDevice(m_blacklistMap);
initBlacklistDev();
int height = 0;
for (int i = 0; i < m_blacklistLayout->count(); i ++) {
QWidget *w = m_blacklistLayout->itemAt(i)->widget();
@ -172,14 +167,23 @@ void BlacklistPage::refreshBlacklist()
}
this->setFixedHeight(height + m_titleLabel->height() + 8);
if (!m_blacklistMap.isEmpty()) {
this->show();
} else {
if (m_blacklistMap.isEmpty()) {
this->hide();
} else {
this->show();
}
this->update();
}
void BlacklistPage::refreshBlacklist()
{
m_blacklistMap.clear();
getBlacklistDevice(m_blacklistMap);
clearBlacklistLayout();
initBlacklistDev();
resetLayoutHight();
}
void BlacklistPage::onRemoveFromBlacklistBtnClicked(QString staMac)
{
if (staMac.isNull() || staMac.isEmpty()) {

View File

@ -63,6 +63,7 @@ private:
void initBlacklistDev();
void addBlacklistDevFrame(QString staMac, QString staName);
void clearBlacklistLayout();
void resetLayoutHight();
private slots:
void onsetStaIntoBlacklist(QString staMac);

View File

@ -116,7 +116,7 @@ void ConnectdevPage::addStaDevFrame(QString staMac, QString staName)
void ConnectdevPage::clearStaListLayout()
{
m_staMap.clear();
if (m_staListLayout->layout() != NULL) {
QLayoutItem* layoutItem;
while ((layoutItem = m_staListLayout->layout()->takeAt(0)) != NULL) {
@ -128,30 +128,27 @@ void ConnectdevPage::clearStaListLayout()
void ConnectdevPage::onStaDevAdded(bool istrue, QString staMac, QString staName)
{
if (!m_staMap.keys().contains(staMac)) {
onStaDevChanged(istrue, staMac, staName);
if (!m_staMap.contains(staMac)) {
m_staMap.insert(staMac, staName);
clearStaListLayout();
initStaDev();
resetLayoutHight();
}
}
void ConnectdevPage::onStaDevRemoved(bool istrue, QString staMac, QString staName)
{
if (m_staMap.keys().contains(staMac)) {
onStaDevChanged(istrue, staMac, staName);
if (m_staMap.contains(staMac)) {
if (m_staMap.remove(staMac)) {
clearStaListLayout();
initStaDev();
resetLayoutHight();
}
}
}
void ConnectdevPage::onStaDevChanged(bool istrue, QString staMac, QString staName)
void ConnectdevPage::resetLayoutHight()
{
if (istrue) {
refreshStalist();
}
}
void ConnectdevPage::refreshStalist()
{
clearStaListLayout();
getConnectStaDevice(m_staMap);
initStaDev();
int height = 0;
for (int i = 0; i < m_staListLayout->count(); i ++) {
QWidget *w = m_staListLayout->itemAt(i)->widget();
@ -169,6 +166,15 @@ void ConnectdevPage::refreshStalist()
this->update();
}
void ConnectdevPage::refreshStalist()
{
m_staMap.clear();
getConnectStaDevice(m_staMap);
clearStaListLayout();
initStaDev();
resetLayoutHight();
}
void ConnectdevPage::onDropIntoBlacklistBtnClicked(QString staMac)
{
if (staMac.isNull() || staMac.isEmpty()) {

View File

@ -65,6 +65,7 @@ private:
void initNmDbus(QDBusInterface *interface);
void onStaDevChanged(bool istrue, QString staMac, QString staName);
void resetLayoutHight();
signals:
void setStaIntoBlacklist(QString staMac);

View File

@ -34,7 +34,8 @@
#include "wlanpage.h"
#include "netdetails/netdetail.h"
#include "netdetails/joinhiddenwifipage.h"
#include <ukuisdk/kylin-com4cxx.h>
//删除此头文件,别在添加
//#include <ukuisdk/kylin-com4cxx.h>
#ifdef WITHKYSEC
#include <kysec/libkysec.h>

View File

@ -918,7 +918,9 @@ void WlanPage::onConnectionStateChanged(QString uuid,
emit this->wlanConnectChanged(state);
if (m_connectResource->isApConnection(uuid)) {
bool isApConnection = m_connectResource->isApConnection(uuid);
if (isApConnection) {
sendApStateChangeSignal(uuid, ssid, devName, state);
} else {
if (state == NetworkManager::ActiveConnection::State::Deactivated &&
@ -938,31 +940,32 @@ void WlanPage::onConnectionStateChanged(QString uuid,
if (state == NetworkManager::ActiveConnection::State::Activated) {
m_updateStrength = true;
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(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_PRIVATE);
});
if (configType == -1) {
FirewallDialog *fireWallDiaglog = new FirewallDialog();
fireWallDiaglog->setWindowTitle(ssid);
connect(fireWallDiaglog, &FirewallDialog::setPublicNetMode, this, [=](){
fireWallDiaglog->close();
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
});
connect(fireWallDiaglog, &FirewallDialog::setPrivateNetMode, this, [=](){
fireWallDiaglog->close();
connect(fireWallDiaglog, &FirewallDialog::close, this, [=](){
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
});
fireWallDiaglog->show();
} else if (configType == KSC_FIREWALL_PUBLIC) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
} else if (configType == KSC_FIREWALL_PRIVATE) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PRIVATE);
});
connect(fireWallDiaglog, &FirewallDialog::setPublicNetMode, this, [=](){
fireWallDiaglog->close();
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
});
connect(fireWallDiaglog, &FirewallDialog::close, this, [=](){
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
});
fireWallDiaglog->show();
} else if (configType == KSC_FIREWALL_PUBLIC) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PUBLIC);
} else if (configType == KSC_FIREWALL_PRIVATE) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(uuid, devName, ssid, KSC_FIREWALL_PRIVATE);
}
}
updateActivatedArea(uuid, ssid, devName);