global function

This commit is contained in:
zhangyuanyuan1 2022-07-22 13:52:31 +08:00
parent b4b41bab2a
commit 786d3dbd1f
3 changed files with 13 additions and 13 deletions

View File

@ -454,7 +454,7 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
//配置页面 //配置页面
if (isActive) { if (isActive) {
int configType = TabPage::getNetworkModeConfig(m_uuid); int configType = getNetworkModeConfig(m_uuid);
if (configType == -1) { if (configType == -1) {
configPage->setConfigState(KSC_FIREWALL_PUBLIC); configPage->setConfigState(KSC_FIREWALL_PUBLIC);
} else { } else {
@ -976,13 +976,13 @@ bool NetDetail::updateConnect()
} }
if (configPage != nullptr) { if (configPage != nullptr) {
int configType = TabPage::getNetworkModeConfig(m_uuid); int configType = getNetworkModeConfig(m_uuid);
bool configPageChange = configPage->checkIsChanged(configType); bool configPageChange = configPage->checkIsChanged(configType);
int currentConfigType = configPage->getConfigState(); int currentConfigType = configPage->getConfigState();
// qDebug () << Q_FUNC_INFO << __LINE__<< configPageChange; // qDebug () << Q_FUNC_INFO << __LINE__<< configPageChange;
if (configPageChange) { if (configPageChange) {
TabPage::setNetworkModeConfig(m_uuid, m_deviceName, m_name, currentConfigType); setNetworkModeConfig(m_uuid, m_deviceName, m_name, currentConfigType);
// qDebug () <<Q_FUNC_INFO << __LINE__ << m_uuid << m_deviceName << m_name << currentConfigType; // qDebug () <<Q_FUNC_INFO << __LINE__ << m_uuid << m_deviceName << m_name << currentConfigType;
} }
} }

View File

@ -402,7 +402,7 @@ void FirewallDialog::initUI()
connect(m_NoBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode); connect(m_NoBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode);
} }
int TabPage::getNetworkModeConfig(QString uuid) int getNetworkModeConfig(QString uuid)
{ {
if (uuid.isEmpty()) { if (uuid.isEmpty()) {
qWarning()<< /*LOG_FLAG <<*/ "uuid is empty, so can not get network mode config"; qWarning()<< /*LOG_FLAG <<*/ "uuid is empty, so can not get network mode config";
@ -425,7 +425,7 @@ int TabPage::getNetworkModeConfig(QString uuid)
return -1; return -1;
} }
void TabPage::setNetworkModeConfig(QString uuid, QString cardName, QString ssid, int mode) void setNetworkModeConfig(QString uuid, QString cardName, QString ssid, int mode)
{ {
QDBusInterface dbusInterface("com.ksc.defender", QDBusInterface dbusInterface("com.ksc.defender",
"/firewall", "/firewall",
@ -441,7 +441,7 @@ void TabPage::setNetworkModeConfig(QString uuid, QString cardName, QString ssid,
} }
} }
int TabPage::breakNetworkConnect(QString uuid, QString cardName, QString ssid) int breakNetworkConnect(QString uuid, QString cardName, QString ssid)
{ {
QDBusInterface dbusInterface("com.ksc.defender", QDBusInterface dbusInterface("com.ksc.defender",
"/firewall", "/firewall",

View File

@ -82,6 +82,13 @@ void saveDeviceEnableState(QString deviceName, bool enable);
void deleteDeviceEnableState(QString deviceName); void deleteDeviceEnableState(QString deviceName);
void getDeviceEnableState(int type, QMap<QString, bool> &map); void getDeviceEnableState(int type, QMap<QString, bool> &map);
//安全中心-获取网络模式配置
int getNetworkModeConfig(QString uuid);
//安全中心-设置网络模式配置
void setNetworkModeConfig(QString uuid, QString cardName, QString ssid, int mode);
//安全中心-解除连接(用于防火墙处从正在使用的网络中删除)
int breakNetworkConnect(QString uuid, QString cardName, QString ssid);
class TabPage : public QWidget class TabPage : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -108,13 +115,6 @@ public:
} }
} }
//安全中心-获取网络模式配置
static int getNetworkModeConfig(QString uuid);
//安全中心-设置网络模式配置
static void setNetworkModeConfig(QString uuid, QString cardName, QString ssid, int mode);
//安全中心-解除连接(用于防火墙处从正在使用的网络中删除)
static int breakNetworkConnect(QString uuid, QString cardName, QString ssid);
signals: signals:
void deviceStatusChanged(); void deviceStatusChanged();
void deviceNameChanged(QString oldName, QString newName, int type); void deviceNameChanged(QString oldName, QString newName, int type);