Merge remote-tracking branch 'refs/remotes/upstream/dbus-interface' into d-interface

This commit is contained in:
king 2021-10-19 08:42:24 +08:00
commit e31005945c
8 changed files with 54 additions and 20 deletions

1
debian/control vendored
View File

@ -23,6 +23,7 @@ Rules-Requires-Root: no
Homepage: https://github.com/ukui/kylin-nm
Vcs-Git: https://github.com/ukui/kylin-nm.git
Vcs-Browser: https://github.com/ukui/kylin-nm
Package: kylin-nm
Architecture: any
Depends: network-manager (>=1.2.6),

2
debian/rules vendored
View File

@ -30,5 +30,5 @@ override_dh_auto_build:
dh_auto_build -- $(MAKE_OPTS)
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

View File

@ -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);
}
//启用/禁用网卡

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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);