dbus interface
This commit is contained in:
parent
f6bdf25c7f
commit
6ac510db84
|
@ -109,6 +109,7 @@ void KyConnectSetting::dumpInfo()
|
|||
qDebug()<<"connect setting info:";
|
||||
qDebug()<<"connect name"<< m_connectName;
|
||||
qDebug()<<"iface name" << m_ifaceName;
|
||||
qDebug()<<"ipv4 method" <<m_ipv4ConfigIpType;
|
||||
|
||||
for (int index = 0 ; index < m_ipv4Address.size(); index++) {
|
||||
qDebug()<<"ipv4 address" << m_ipv4Address.at(index).ip().toString();
|
||||
|
|
|
@ -82,6 +82,9 @@ void KyNetworkDeviceResourse::getHardwareInfo(QString ifaceName, QString &hardAd
|
|||
|
||||
if (nullptr == connectDevice || !connectDevice->isValid()) {
|
||||
qWarning()<<"[KyNetworkDeviceResourse]"<<"get hardware info failed, the device" << ifaceName << "is not existed";
|
||||
hardAddress.clear();
|
||||
bandWith = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (connectDevice->type()) {
|
||||
|
|
|
@ -63,7 +63,11 @@ void DbusAdaptor::setWiredSwitchEnable(bool enable)
|
|||
//todo mainwindow调用backend 对开关 打开/关闭
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
||||
QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
||||
gsetting->set(KEY_WIRED_SWITCH, enable);
|
||||
if (gsetting->get(KEY_WIRED_SWITCH).toBool() != enable) {
|
||||
gsetting->set(KEY_WIRED_SWITCH, enable);
|
||||
}
|
||||
delete gsetting;
|
||||
gsetting = nullptr;
|
||||
} else {
|
||||
qDebug()<<"isSchemaInstalled false";
|
||||
}
|
||||
|
@ -75,7 +79,9 @@ void DbusAdaptor::setWirelessSwitchEnable(bool enable)
|
|||
//todo mainwindow调用backend 对开关 打开/关闭
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
||||
QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
||||
gsetting->set(KEY_WIRELESS_SWITCH, enable);
|
||||
if (gsetting->get(KEY_WIRELESS_SWITCH).toBool() != enable) {
|
||||
gsetting->set(KEY_WIRELESS_SWITCH, enable);
|
||||
}
|
||||
delete gsetting;
|
||||
gsetting = nullptr;
|
||||
} else {
|
||||
|
@ -151,6 +157,7 @@ void DbusAdaptor::activateConnect(int type, QString devName, QString ssid)
|
|||
void DbusAdaptor::deActivateConnect(int type, QString devName, QString ssid)
|
||||
{
|
||||
if (type == WIRED) {
|
||||
qDebug() << "deactivateWired";
|
||||
parent()->deactivateWired(devName,ssid);
|
||||
} else if (type == WIRELESS) {
|
||||
parent()->deactivateWireless(devName,ssid);
|
||||
|
|
|
@ -43,8 +43,8 @@ void CreatNetPage::initUI()
|
|||
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
||||
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
||||
|
||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
||||
ipv4ConfigCombox->addItem(tr("Manual")); //"手动"
|
||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)"
|
||||
ipv4ConfigCombox->addItem(tr("Manual"), MANUAL_CONFIG); //"手动"
|
||||
|
||||
|
||||
// IP的正则格式限制
|
||||
|
|
|
@ -656,10 +656,12 @@ bool NetDetail::createWiredConnect()
|
|||
KyWirelessConnectSetting connetSetting;
|
||||
connetSetting.setIfaceName(m_deviceName);
|
||||
createNetPage->constructIpv4Info(connetSetting);
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
//todo desktop notify
|
||||
return false;
|
||||
if (connetSetting.m_ipv4ConfigIpType != CONFIG_IP_DHCP) {
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
//todo desktop notify
|
||||
return false;
|
||||
}
|
||||
}
|
||||
m_wiredConnOperation->createWiredConnect(connetSetting);
|
||||
return true;
|
||||
|
|
|
@ -152,6 +152,8 @@ void MainWindow::initDbusConnnect()
|
|||
|
||||
connect(m_wlanWidget, &WlanPage::activateFailed, this, &MainWindow::activateFailed);
|
||||
connect(m_wlanWidget, &WlanPage::deactivateFailed, this, &MainWindow::deactivateFailed);
|
||||
connect(m_lanWidget, &LanPage::activateFailed, this, &MainWindow::activateFailed);
|
||||
connect(m_lanWidget, &LanPage::deactivateFailed, this, &MainWindow::deactivateFailed);
|
||||
|
||||
connect(m_lanWidget, &LanPage::lanAdd, this, &MainWindow::lanAdd);
|
||||
connect(m_lanWidget, &LanPage::lanRemove, this, &MainWindow::lanRemove);
|
||||
|
|
|
@ -20,9 +20,10 @@ const QString WIRED_SWITCH = "wiredswitch";
|
|||
LanPage::LanPage(QWidget *parent) : TabPage(parent)
|
||||
{
|
||||
//释放问题
|
||||
m_activeResourse = new KyActiveConnectResourse;
|
||||
m_connectResourse = new KyConnectResourse;
|
||||
m_device = new KyNetworkDeviceResourse;
|
||||
m_activeResourse = new KyActiveConnectResourse(this);
|
||||
m_connectResourse = new KyConnectResourse(this);
|
||||
m_device = new KyNetworkDeviceResourse(this);
|
||||
m_wiredConnectOperation = new KyWiredConnectOperation(this);
|
||||
devList.empty();
|
||||
m_nullLanItem = new LanListItem();
|
||||
initUI();
|
||||
|
@ -42,6 +43,11 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
|
|||
connect(m_device, &KyNetworkDeviceResourse::deviceAdd, this, &LanPage::onDeviceAdd);
|
||||
connect(m_device, &KyNetworkDeviceResourse::deviceRemove, this, &LanPage::onDeviceRemove);
|
||||
connect(m_device, &KyNetworkDeviceResourse::deviceNameUpdate, this, &LanPage::onDeviceNameUpdate);
|
||||
|
||||
connect(m_wiredConnectOperation, &KyWiredConnectOperation::activateConnectionError, this, &LanPage::activateFailed);
|
||||
connect(m_wiredConnectOperation, &KyWiredConnectOperation::deactivateConnectionError, this, &LanPage::deactivateFailed);
|
||||
|
||||
|
||||
//为什么同一个类中要用信号槽
|
||||
connect(this, &LanPage::deviceStatusChanged, this, &LanPage::onDeviceChanged);
|
||||
}
|
||||
|
@ -262,15 +268,6 @@ void LanPage::initDeviceCombox()
|
|||
saveDeviceEnableState(iter.key(), true);
|
||||
}
|
||||
}
|
||||
if (m_deviceComboBox->currentText().isEmpty()) {
|
||||
if (m_switchGsettings->get(WIRED_SWITCH).toBool()) {
|
||||
m_switchGsettings->set(WIRED_SWITCH,false);
|
||||
}
|
||||
} else {
|
||||
if (!m_switchGsettings->get(WIRED_SWITCH).toBool()) {
|
||||
m_switchGsettings->set(WIRED_SWITCH,true);
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "[LanPage]current:" << m_deviceComboBox->currentText();
|
||||
}
|
||||
|
@ -575,23 +572,26 @@ void LanPage::setWiredDeviceEnable(const QString& devName, bool enable)
|
|||
void LanPage::activateWired(const QString& devName, const QString& connUuid)
|
||||
{
|
||||
qDebug() << "activateWired" << devName << connUuid;
|
||||
KyWiredConnectOperation a;
|
||||
a.activateConnection(connUuid, devName);
|
||||
m_wiredConnectOperation->activateConnection(connUuid, devName);
|
||||
}
|
||||
|
||||
void LanPage::deactivateWired(const QString& devName, const QString& connUuid)
|
||||
{
|
||||
qDebug() << "deactivateWired" << devName << connUuid;
|
||||
KyConnectItem *item = nullptr;
|
||||
item = m_activeResourse->getActiveConnectionByUuid(connUuid, devName);
|
||||
if (nullptr == item) {
|
||||
//todo: 通知桌面
|
||||
qDebug() << "not ActiveConnection";
|
||||
return;
|
||||
}
|
||||
|
||||
KyWiredConnectOperation a;
|
||||
a.deactivateWiredConnection(item->m_connectName, connUuid);
|
||||
// KyConnectItem *item = nullptr;
|
||||
// item = m_activeResourse->getActiveConnectionByUuid(connUuid, devName);
|
||||
// if (nullptr == item) {
|
||||
// qDebug() << "not ActiveConnection";
|
||||
// item = m_connectResourse->getConnectionItemByUuid(connUuid, devName);
|
||||
// if (nullptr == item) {
|
||||
// QString errorMessage = tr("it can not find the activate connect" + tr("uuid") + connUuid;
|
||||
// qWarning()<<errorMessage;
|
||||
// emit deactivateFailed(errorMessage);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
QString name("");
|
||||
m_wiredConnectOperation->deactivateWiredConnection(name, connUuid);
|
||||
}
|
||||
|
||||
void LanPage::showDetailPage(QString devName, QString uuid)
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
QListWidgetItem *m_listWidgetItem = nullptr;
|
||||
|
||||
KyNetworkDeviceResourse *m_device = nullptr;
|
||||
KyWiredConnectOperation *m_wiredConnectOperation = nullptr;
|
||||
KyActiveConnectResourse *m_activeResourse = nullptr; //激活的连接
|
||||
KyConnectResourse *m_connectResourse = nullptr; //未激活的连接
|
||||
|
||||
|
|
Loading…
Reference in New Issue