Merge branch 'up-dbus' into 'dbus-interface'
modify setWirelessEnable && when property change reactive connection See merge request kylin-desktop/kylin-nm!328
This commit is contained in:
commit
1e30f5386b
|
@ -78,16 +78,17 @@ void DbusAdaptor::setWiredSwitchEnable(bool enable)
|
|||
void DbusAdaptor::setWirelessSwitchEnable(bool enable)
|
||||
{
|
||||
//todo mainwindow调用backend 对开关 打开/关闭
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
||||
QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
||||
if (gsetting->get(KEY_WIRELESS_SWITCH).toBool() != enable) {
|
||||
gsetting->set(KEY_WIRELESS_SWITCH, enable);
|
||||
}
|
||||
delete gsetting;
|
||||
gsetting = nullptr;
|
||||
} else {
|
||||
qDebug()<<"isSchemaInstalled false";
|
||||
}
|
||||
// if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
||||
// QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
||||
// if (gsetting->get(KEY_WIRELESS_SWITCH).toBool() != enable) {
|
||||
// gsetting->set(KEY_WIRELESS_SWITCH, enable);
|
||||
// }
|
||||
// delete gsetting;
|
||||
// gsetting = nullptr;
|
||||
// } else {
|
||||
// qDebug()<<"isSchemaInstalled false";
|
||||
// }
|
||||
parent()->setWirelessSwitchEnable(enable);
|
||||
}
|
||||
|
||||
//启用/禁用网卡
|
||||
|
|
|
@ -448,6 +448,12 @@ void MainWindow::getStoredApInfo(QStringList &list)
|
|||
m_wlanWidget->getStoredApInfo(list);
|
||||
}
|
||||
|
||||
//无线开关
|
||||
void MainWindow::setWirelessSwitchEnable(bool enable)
|
||||
{
|
||||
m_wlanWidget->setWirelessSwitchEnable(enable);
|
||||
}
|
||||
|
||||
void MainWindow::setWiredDeviceEnable(const QString& devName, bool enable)
|
||||
{
|
||||
m_lanWidget->setWiredDeviceEnable(devName, enable);
|
||||
|
|
|
@ -42,6 +42,8 @@ public:
|
|||
//无线连接断开
|
||||
void activateWireless(const QString& devName, const QString& ssid);
|
||||
void deactivateWireless(const QString& devName, const QString& ssid);
|
||||
//无线总开关
|
||||
void setWirelessSwitchEnable(bool enable);
|
||||
|
||||
void setWiredDeviceEnable(const QString& devName, bool enable);
|
||||
|
||||
|
|
|
@ -831,17 +831,24 @@ bool NetDetail::updateConnect()
|
|||
m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting);
|
||||
}
|
||||
|
||||
if (isWlan && securityPage->checkIsChanged(m_info)) {
|
||||
KySecuType secuType;
|
||||
KyEapMethodType enterpriseType;
|
||||
securityPage->getSecuType(secuType, enterpriseType);
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
updateWirelessEnterPriseConnect(enterpriseType);
|
||||
} else {
|
||||
updateWirelessPersonalConnect();
|
||||
bool securityChange = false;
|
||||
if (isWlan) {
|
||||
securityChange = securityPage->checkIsChanged(m_info);
|
||||
if (securityChange) {
|
||||
KySecuType secuType;
|
||||
KyEapMethodType enterpriseType;
|
||||
securityPage->getSecuType(secuType, enterpriseType);
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
updateWirelessEnterPriseConnect(enterpriseType);
|
||||
} else {
|
||||
updateWirelessPersonalConnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ipv4Change || ipv6Change || securityChange) {
|
||||
if (isActive) {
|
||||
//安全性变化 断开-重连
|
||||
//信息变化 断开-重连
|
||||
m_wirelessConnOpration->activateConnection(m_uuid, m_deviceName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -970,6 +970,21 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
|
|||
netDetail->show();
|
||||
}
|
||||
|
||||
void WlanPage::setWirelessSwitchEnable(bool enable)
|
||||
{
|
||||
qDebug() << "dbus setWirelessSwitchEnable = " << enable << __LINE__;
|
||||
//应该先检测是否有无线网卡可用,才改变开关状态
|
||||
m_netDeviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, m_devList);
|
||||
if (m_devList.isEmpty()) {
|
||||
qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__;
|
||||
//检测不到无线网卡不再触发click信号
|
||||
m_netSwitch->setSwitchStatus(false);
|
||||
m_netSwitch->setEnabled(false);
|
||||
}else{
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
void WlanPage::getWirelessDeviceCap(QMap<QString, int> &map)
|
||||
{
|
||||
for (int i = 0; i < m_devList.size(); ++i) {
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
|
||||
void activateWireless(const QString& devName, const QString& ssid);
|
||||
void deactivateWireless(const QString& devName, const QString& ssid);
|
||||
//无线总开关
|
||||
void setWirelessSwitchEnable(bool enable);
|
||||
|
||||
void showDetailPage(QString devName, QString uuid);
|
||||
|
||||
|
|
Loading…
Reference in New Issue