feature: modify the function of wired according to the design documentation.
This commit is contained in:
parent
48b297b1c8
commit
c44aa9b8d5
|
@ -66,13 +66,14 @@ SOURCES += \
|
|||
src/backthread.cpp \
|
||||
src/kylinactiveconnectresource.cpp \
|
||||
src/kylinbluetoothconnectitem.cpp \
|
||||
src/kylinconnectitem.cpp \
|
||||
src/kylinconnectoperation.cpp \
|
||||
src/kylinconnectresource.cpp \
|
||||
src/kylinconnectsetting.cpp \
|
||||
src/kylinnetworkconnect.cpp \
|
||||
src/kylinnetworkdeviceresource.cpp \
|
||||
src/kylinnetworkresourcemanager.cpp \
|
||||
src/kylinvpnconnectitem.cpp \
|
||||
src/kylinwiredconnectitem.cpp \
|
||||
src/kylinwiredconnectoperation.cpp \
|
||||
src/kylinwiredwidget.cpp \
|
||||
src/wifi-auth-thread.cpp \
|
||||
|
@ -109,13 +110,14 @@ HEADERS += \
|
|||
src/backthread.h \
|
||||
src/kylinactiveconnectresource.h \
|
||||
src/kylinbluetoothconnectitem.h \
|
||||
src/kylinconnectitem.h \
|
||||
src/kylinconnectoperation.h \
|
||||
src/kylinconnectresource.h \
|
||||
src/kylinconnectsetting.h \
|
||||
src/kylinnetworkconnect.h \
|
||||
src/kylinnetworkdeviceresource.h \
|
||||
src/kylinnetworkresourcemanager.h \
|
||||
src/kylinvpnconnectitem.h \
|
||||
src/kylinwiredconnectitem.h \
|
||||
src/kylinwiredconnectoperation.h \
|
||||
src/kylinwiredwidget.h \
|
||||
src/wifi-auth-thread.h \
|
||||
|
|
|
@ -27,6 +27,84 @@ KyActiveConnectResourse::~KyActiveConnectResourse()
|
|||
}
|
||||
}
|
||||
|
||||
KyConnectItem *KyActiveConnectResourse::getActiveConnectionItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr)
|
||||
{
|
||||
qDebug()<<"[KyActiveConnectResourse]"<<"get active connect item";
|
||||
|
||||
if (nullptr == activeConnectPtr) {
|
||||
qWarning()<<"[KyActiveConnectResourse]"<<"the active connect is empty";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (NetworkManager::ActiveConnection::State::Activated != activeConnectPtr->state()) {
|
||||
qWarning()<<"[KyActiveConnectResourse]"<<"the active connect is not activated"
|
||||
<<"connect name:"<<activeConnectPtr->connection()->name()
|
||||
<<"connect state"<< activeConnectPtr->state();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
KyConnectItem *activeConnectItem = new KyConnectItem();
|
||||
activeConnectItem->m_connectUuid = activeConnectPtr->uuid();
|
||||
|
||||
NetworkManager::Connection::Ptr connectPtr = activeConnectPtr->connection();
|
||||
activeConnectItem->m_connectName = connectPtr->name();
|
||||
activeConnectItem->m_connectPath = connectPtr->path();
|
||||
|
||||
activeConnectItem->m_connectState = NetworkManager::ActiveConnection::State::Activated;
|
||||
|
||||
return activeConnectItem;
|
||||
}
|
||||
|
||||
void KyActiveConnectResourse::getActiveConnectionList(QString deviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
QList<KyConnectItem *> &activeConnectItemList)
|
||||
{
|
||||
qDebug()<<"[KyActiveConnectResourse]"<<"get activate connect for device"
|
||||
<< deviceName <<"connect type:"<<connectionType;
|
||||
|
||||
NetworkManager::ActiveConnection::List activeConnectList;
|
||||
activeConnectList.clear();
|
||||
activeConnectList = m_networkResourceInstance->getActiveConnectList();
|
||||
|
||||
if (activeConnectList.empty()) {
|
||||
qWarning()<<"[KyActiveConnectResourse]"<<"the active connect list is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkManager::ActiveConnection::Ptr activeConnectPtr = nullptr;
|
||||
for (int index = 0; index < activeConnectList.size(); index++) {
|
||||
activeConnectPtr = activeConnectList.at(index);
|
||||
if (connectionType != activeConnectPtr->type()) {
|
||||
qDebug()<<"[KyActiveConnectResourse]" <<"the connect type " << activeConnectPtr->type()
|
||||
<<"connect name" << activeConnectPtr->connection()->name();
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList interfaces = activeConnectPtr->devices();
|
||||
for (int index = 0; index < interfaces.size(); ++index) {
|
||||
QString ifaceUni = interfaces.at(index);
|
||||
NetworkManager::Device:: Ptr devicePtr =
|
||||
m_networkResourceInstance->findDeviceUni(ifaceUni);
|
||||
if (devicePtr->interfaceName() == deviceName) {
|
||||
KyConnectItem *activeConnectItem =
|
||||
getActiveConnectionItem(activeConnectPtr);
|
||||
if (nullptr != activeConnectItem) {
|
||||
activeConnectItem->m_ifaceName = deviceName;
|
||||
activeConnectItem->m_itemType = connectionType;
|
||||
activeConnectItemList << activeConnectItem;
|
||||
activeConnectItem->dumpInfo();
|
||||
}
|
||||
|
||||
activeConnectPtr = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void KyActiveConnectResourse::getWiredActivateConnect(QList<KyWiredConnectItem *> &wiredActiveConnectItemList)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -98,6 +176,8 @@ KyWiredConnectItem *KyActiveConnectResourse::getWiredActiveConnectItem(NetworkMa
|
|||
return wiredItem;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void KyActiveConnectResourse::getActiveConnectIp(
|
||||
NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
||||
QString &ipv4Address,
|
||||
|
@ -132,6 +212,29 @@ void KyActiveConnectResourse::getActiveConnectIp(
|
|||
return;
|
||||
}
|
||||
|
||||
void KyActiveConnectResourse::getActiveConnectDns(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
||||
QList<QHostAddress> &ipv4Dns,
|
||||
QList<QHostAddress> &ipv6Dns)
|
||||
{
|
||||
qDebug()<<"[KyActiveConnectResourse]"<<"get active connect nameservice info";
|
||||
|
||||
NetworkManager::IpConfig ipv4Config =activeConnectPtr->ipV4Config();
|
||||
if (ipv4Config.isValid()) {
|
||||
ipv4Dns = ipv4Config.nameservers();
|
||||
} else {
|
||||
qWarning()<<"[KyActiveConnectResourse]"<<"ipv4 config is not valid";
|
||||
}
|
||||
|
||||
NetworkManager::IpConfig ipv6Config =activeConnectPtr->ipV6Config();
|
||||
if (ipv6Config.isValid()) {
|
||||
ipv6Dns = ipv6Config.nameservers();
|
||||
} else {
|
||||
qWarning()<<"[KyActiveConnectResourse]"<<"ipv6 config is not valid";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
KyVpnConnectItem *KyActiveConnectResourse::getVpnActiveConnectItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr)
|
||||
{
|
||||
qDebug()<<"[KyActiveConnectResourse]"<<"get vpn active connect item";
|
||||
|
@ -237,12 +340,17 @@ KyBluetoothConnectItem *KyActiveConnectResourse::getBtActiveConnectItem(NetworkM
|
|||
NetworkManager::BluetoothSetting::Ptr bluetoothSetting =
|
||||
settingPtr->setting(NetworkManager::Setting::Bluetooth).dynamicCast<NetworkManager::BluetoothSetting>();
|
||||
bluetoothItem->m_deviceAddress = bluetoothSetting->bluetoothAddress();
|
||||
QByteArray btAddrArray = bluetoothSetting->bluetoothAddress();
|
||||
for (int index = 0; index < btAddrArray.size(); ++index) {
|
||||
qDebug("bt address %d %s", index, btAddrArray[index]);
|
||||
}
|
||||
qDebug()<<"bluetooth device address"<<bluetoothItem->m_deviceAddress;
|
||||
//wiredItem->m_itemType;
|
||||
|
||||
return bluetoothItem;
|
||||
}
|
||||
|
||||
void KyActiveConnectResourse::getBluetoothConnect(QList<KyBluetoothConnectItem *> &btActiveConnectItemList)
|
||||
void KyActiveConnectResourse::getBtActivateConnect(QList<KyBluetoothConnectItem *> &btActiveConnectItemList)
|
||||
{
|
||||
int index = 0;
|
||||
NetworkManager::ActiveConnection::List activeConnectList;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QString>
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
#include "kylinwiredconnectitem.h"
|
||||
#include "kylinconnectitem.h"
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
#include "kylinvpnconnectitem.h"
|
||||
#include "kylinbluetoothconnectitem.h"
|
||||
|
@ -16,15 +16,22 @@ public:
|
|||
~KyActiveConnectResourse();
|
||||
|
||||
public:
|
||||
void getWiredActivateConnect(QList<KyWiredConnectItem *> &wiredActiveConnectItemList);
|
||||
void getActiveConnectionList(QString DeviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
QList<KyConnectItem *> &connectItemList);
|
||||
//void getWiredActivateConnect(QList<KyWiredConnectItem *> &wiredActiveConnectItemList);
|
||||
void getVpnActivateConnect(QList<KyVpnConnectItem *> &vpnActiveConnectItemList);
|
||||
void getBluetoothConnect(QList<KyBluetoothConnectItem *> &btActiveConnectItemList);
|
||||
void getBtActivateConnect(QList<KyBluetoothConnectItem *> &btActiveConnectItemList);
|
||||
|
||||
private:
|
||||
KyConnectItem *getActiveConnectionItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr);
|
||||
void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
||||
QString &ipv4Address,
|
||||
QString &ipv6Address);
|
||||
KyWiredConnectItem *getWiredActiveConnectItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr);
|
||||
void getActiveConnectDns(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
||||
QList<QHostAddress> &ipv4Dns,
|
||||
QList<QHostAddress> &ipv6Dns);
|
||||
// KyWiredConnectItem *getWiredActiveConnectItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr);
|
||||
KyVpnConnectItem *getVpnActiveConnectItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr);
|
||||
KyBluetoothConnectItem *getBtActiveConnectItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QObject>
|
||||
#include <NetworkManagerQt/BluetoothDevice>
|
||||
#include <NetworkManagerQt/BluetoothSetting>
|
||||
#include <NetworkManagerQt/BluetoothDevice>
|
||||
|
||||
class KyBluetoothConnectItem : public QObject
|
||||
{
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
#include "kylinconnectitem.h"
|
||||
|
||||
KyConnectItem::KyConnectItem(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_connectName = "";
|
||||
m_connectUuid = "";
|
||||
m_connectPath = "";
|
||||
|
||||
m_ifaceName = "";
|
||||
|
||||
m_connectState = NetworkManager::ActiveConnection::State::Unknown; //deactive、activing and actived
|
||||
m_itemType = NetworkManager::ConnectionSettings::ConnectionType::Unknown;
|
||||
}
|
||||
|
||||
KyConnectItem::~KyConnectItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void KyConnectItem::dumpInfo()
|
||||
{
|
||||
qDebug()<<"wired connection item info:";
|
||||
qDebug()<<"connect name:"<<m_connectName;
|
||||
qDebug()<<"connect uuid:"<<m_connectUuid;
|
||||
qDebug()<<"iface name:"<<m_ifaceName;
|
||||
qDebug()<<"connect path"<<m_connectPath;
|
||||
|
||||
qDebug()<<"state:"<<m_connectState;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef KYLINCONNECTITEM_H
|
||||
#define KYLINCONNECTITEM_H
|
||||
|
||||
#include <QString>
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
|
||||
class KyConnectItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KyConnectItem(QObject *parent = nullptr);
|
||||
~KyConnectItem();
|
||||
|
||||
public:
|
||||
void dumpInfo();
|
||||
|
||||
public:
|
||||
QString m_connectName;
|
||||
QString m_connectUuid;
|
||||
QString m_connectPath;
|
||||
|
||||
QString m_ifaceName;
|
||||
|
||||
NetworkManager::ActiveConnection::State m_connectState; //deactive、activing and actived
|
||||
|
||||
NetworkManager::ConnectionSettings::ConnectionType m_itemType; //wired or wireless vpn etc
|
||||
};
|
||||
|
||||
#endif // KYLINWIREDCONNECTITEM_H
|
|
@ -0,0 +1,288 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "kylinconnectoperation.h"
|
||||
|
||||
#include <NetworkManagerQt/AdslDevice>
|
||||
#include <NetworkManagerQt/WiredDevice>
|
||||
#include <NetworkManagerQt/Ipv4Setting>
|
||||
#include <NetworkManagerQt/Ipv6Setting>
|
||||
#include <NetworkManagerQt/WiredSetting>
|
||||
|
||||
KyConnectOperation::KyConnectOperation()
|
||||
{
|
||||
m_networkResourceInstance = KyNetworkResourceManager::getInstance();
|
||||
}
|
||||
|
||||
KyConnectOperation::~KyConnectOperation()
|
||||
{
|
||||
m_networkResourceInstance = nullptr;
|
||||
}
|
||||
|
||||
void KyConnectOperation::ipv4SettingSet(
|
||||
NetworkManager::Ipv4Setting::Ptr &ipv4Setting,
|
||||
const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
ipv4Setting->setInitialized(true);
|
||||
|
||||
if (CONFIG_IP_DHCP == connectSettingsInfo.m_ipv4ConfigIpType) {
|
||||
ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Automatic);
|
||||
return;
|
||||
} else {
|
||||
ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Manual);
|
||||
}
|
||||
|
||||
if (!connectSettingsInfo.m_ipv4Dns.empty()) {
|
||||
ipv4Setting->setDns(connectSettingsInfo.m_ipv4Dns);
|
||||
}
|
||||
|
||||
if (!connectSettingsInfo.m_ipv4Address.empty()) {
|
||||
ipv4Setting->setAddresses(connectSettingsInfo.m_ipv4Address);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void KyConnectOperation::ipv6SettingSet(
|
||||
NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
|
||||
const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
ipv6Setting->setInitialized(true);
|
||||
|
||||
if (CONFIG_IP_DHCP == connectSettingsInfo.m_ipv6ConfigIpType) {
|
||||
ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Automatic);
|
||||
return;
|
||||
}
|
||||
|
||||
ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Manual);
|
||||
if (!connectSettingsInfo.m_ipv6Dns.empty()) {
|
||||
ipv6Setting->setDns(connectSettingsInfo.m_ipv6Dns);
|
||||
}
|
||||
|
||||
if (!connectSettingsInfo.m_ipv6Address.empty()) {
|
||||
ipv6Setting->setAddresses(connectSettingsInfo.m_ipv6Address);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyConnectOperation::connectSettingSet(
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings,
|
||||
const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
connectionSettings->setId(connectSettingsInfo.m_connectName);
|
||||
connectionSettings->setUuid(NetworkManager::ConnectionSettings::createNewUuid());
|
||||
connectionSettings->setAutoconnect(true);
|
||||
connectionSettings->setAutoconnectPriority(0);
|
||||
if (!connectSettingsInfo.m_ifaceName.isEmpty()) {
|
||||
connectionSettings->setInterfaceName(connectSettingsInfo.m_ifaceName);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void KyConnectOperation::createConnect(KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
qDebug()<<"create connect";
|
||||
connectSettingsInfo.dumpInfo();
|
||||
NetworkManager::ConnectionSettings::Ptr wiredConnectionSettings = NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wired));
|
||||
connectSettingSet(wiredConnectionSettings, connectSettingsInfo);
|
||||
|
||||
NetworkManager::Ipv4Setting::Ptr ipv4Setting = wiredConnectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast<NetworkManager::Ipv4Setting>();
|
||||
ipv4SettingSet(ipv4Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::Ipv6Setting::Ptr ipv6Setting = wiredConnectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast<NetworkManager::Ipv6Setting>();
|
||||
ipv6SettingSet(ipv6Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::WiredSetting::Ptr wiredSetting = wiredConnectionSettings->setting(NetworkManager::Setting::Wired).dynamicCast<NetworkManager::WiredSetting>();
|
||||
wiredSetting->setInitialized(true);
|
||||
|
||||
QDBusPendingCallWatcher * watcher;
|
||||
watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(wiredConnectionSettings->toMap()), this};
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * watcher) {
|
||||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("create wired connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->createConnectionError(errorMessage);
|
||||
} else {
|
||||
qDebug()<<"create wired connect complete";
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void KyConnectOperation::updateConnect(const QString &connectUuid, const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
qDebug()<<"update connect"<<connectUuid;
|
||||
NetworkManager::Connection::Ptr connectPtr =
|
||||
NetworkManager::findConnectionByUuid(connectUuid);
|
||||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + connectUuid;
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
connectionSettings->setId(connectSettingsInfo.m_connectName);
|
||||
connectionSettings->setInterfaceName(connectSettingsInfo.m_ifaceName);
|
||||
|
||||
NetworkManager::Ipv4Setting::Ptr ipv4Setting = connectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast<NetworkManager::Ipv4Setting>();
|
||||
ipv4SettingSet(ipv4Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::Ipv6Setting::Ptr ipv6Setting = connectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast<NetworkManager::Ipv6Setting>();
|
||||
ipv6SettingSet(ipv6Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::WiredSetting::Ptr wiredSetting = connectionSettings->setting(NetworkManager::Setting::Wired).dynamicCast<NetworkManager::WiredSetting>();
|
||||
wiredSetting->setInitialized(true);
|
||||
|
||||
connectPtr->update(connectionSettings->toMap());
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyConnectOperation::deleteConnect(const QString &connectUuid)
|
||||
{
|
||||
qDebug()<<"delete connect uuid " << connectUuid;
|
||||
|
||||
NetworkManager::Connection::Ptr connectPtr =
|
||||
NetworkManager::findConnectionByUuid(connectUuid);
|
||||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + connectUuid;
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT deleteConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
connectPtr->remove();
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyConnectOperation::activateConnection(const QString connectUuid)
|
||||
{
|
||||
QString connectPath = "";
|
||||
QString deviceIdentifier = "";
|
||||
QString connectName = "";
|
||||
QString deviceName = "";
|
||||
QString specificObject = "";
|
||||
NetworkManager::Connection::Ptr connectPtr = nullptr;
|
||||
|
||||
qDebug()<<"it will activate connect"<<connectUuid;
|
||||
connectPtr = NetworkManager::findConnectionByUuid(connectUuid);
|
||||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = "the connect uuid " + connectUuid + "is not exsit";
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT activateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (NetworkManager::ConnectionSettings::Wired != connectPtr->settings()->connectionType()) {
|
||||
QString errorMessage = tr("the connect type is")
|
||||
+ connectPtr->settings()->connectionType()
|
||||
+ tr(", but it is not wired");
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT activateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
connectPath = connectPtr->path();
|
||||
connectName = connectPtr->name();
|
||||
deviceName = connectPtr->settings()->interfaceName();
|
||||
|
||||
for (auto const & dev : m_networkResourceInstance->m_devices) {
|
||||
for (auto const & dev_conn : dev->availableConnections()) {
|
||||
if (dev_conn == connectPtr) {
|
||||
deviceIdentifier = dev->uni();
|
||||
deviceName = dev->interfaceName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceIdentifier.isEmpty() && !deviceName.isEmpty()) {
|
||||
auto dev = m_networkResourceInstance->findDeviceInterface(deviceName);
|
||||
if (!dev.isNull()) {
|
||||
deviceIdentifier = dev->uni();
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceIdentifier.isEmpty()) {
|
||||
QString errorMessage = tr("device Identifier is empty, its name") + deviceName;
|
||||
qWarning() << errorMessage;
|
||||
Q_EMIT activateConnectionError(errorMessage);
|
||||
return ;
|
||||
}
|
||||
|
||||
qDebug() <<"active wired connect: path "<< connectPath
|
||||
<< "device identify " << deviceIdentifier
|
||||
<< "connect name " << connectName
|
||||
<< "device name" << deviceName
|
||||
<< "specific parameter"<< specificObject;
|
||||
|
||||
QDBusPendingCallWatcher * watcher;
|
||||
watcher = new QDBusPendingCallWatcher{NetworkManager::activateConnection(connectPath, deviceIdentifier, specificObject), this};
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this, connectName, deviceName] (QDBusPendingCallWatcher * watcher) {
|
||||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("activate connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->activateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning()<<"active wired connect complete.";
|
||||
}
|
||||
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyConnectOperation::deactivateConnection(const QString activeConnectName, const QString &activeConnectUuid)
|
||||
{
|
||||
NetworkManager::ActiveConnection::Ptr activateConnectPtr = nullptr;
|
||||
|
||||
qDebug()<<"deactivetate connect name"<<activeConnectName<<"uuid"<<activeConnectUuid;
|
||||
activateConnectPtr = m_networkResourceInstance->getActiveConnect(activeConnectUuid);
|
||||
if (nullptr == activateConnectPtr) {
|
||||
QString errorMessage = tr("it can not find the activate connect")
|
||||
+ activeConnectName + tr("uuid") + activeConnectUuid;
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT deactivateConnectionError(errorMessage);
|
||||
return ;
|
||||
}
|
||||
|
||||
qDebug() <<"dead active connection path:"<< activateConnectPtr->path();
|
||||
QDBusPendingReply<> reply = NetworkManager::deactivateConnection(activateConnectPtr->path());
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this, activateConnectPtr] (QDBusPendingCallWatcher * watcher) {
|
||||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("deactivation of connection")
|
||||
+ activateConnectPtr->connection()->name() + tr("failed:")
|
||||
+ watcher->error().message();
|
||||
|
||||
qWarning()<<errorMessage;
|
||||
emit this->deactivateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning() << "deactive connect operation finished" << activateConnectPtr->connection()->name();
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef KYLINCONNECTOPERATION_H
|
||||
#define KYLINCONNECTOPERATION_H
|
||||
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
#include "kylinconnectsetting.h"
|
||||
|
||||
class KyConnectOperation : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KyConnectOperation();
|
||||
~KyConnectOperation();
|
||||
|
||||
public:
|
||||
void createConnect(KyConnectSetting &connectSettingsInfo);
|
||||
void updateConnect(const QString &connectUuid, const KyConnectSetting &connectSettingsInfo);
|
||||
void deleteConnect(const QString &connectUuid);
|
||||
void activateConnection(const QString connectUuid);
|
||||
void deactivateConnection(const QString activeConnectName, const QString &activeConnectUuid);
|
||||
|
||||
private:
|
||||
void connectSettingSet(
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings,
|
||||
const KyConnectSetting &connectSettingsInfo);
|
||||
void ipv4SettingSet(NetworkManager::Ipv4Setting::Ptr &ipv4Setting,
|
||||
const KyConnectSetting &connectSettingsInfo);
|
||||
void ipv6SettingSet(NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
|
||||
const KyConnectSetting &connectSettingsInfo);
|
||||
inline void errorProcess(QString errorMessage);
|
||||
|
||||
signals:
|
||||
void createConnectionError(QString errorMessage);
|
||||
void updateConnectionError(QString errorMessage);
|
||||
void deleteConnectionError(QString errorMessage);
|
||||
void activateConnectionError(QString errorMessage);
|
||||
void deactivateConnectionError(QString errorMessage);
|
||||
|
||||
private:
|
||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||
};
|
||||
|
||||
#endif // KYLINCONNECTOPERATION_H
|
|
@ -25,6 +25,79 @@ KyConnectResourse::~KyConnectResourse()
|
|||
}
|
||||
}
|
||||
|
||||
KyConnectItem *KyConnectResourse::getConnectionItem(NetworkManager::Connection::Ptr connectPtr)
|
||||
{
|
||||
if (nullptr == connectPtr) {
|
||||
qWarning()<<"[KyConnectResourse]"<<"the connect is empty";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
KyConnectItem *connectionItem = new KyConnectItem();
|
||||
connectionItem->m_connectName = connectPtr->name();
|
||||
connectionItem->m_connectUuid = connectPtr->uuid();
|
||||
connectionItem->m_connectPath = connectPtr->path();
|
||||
|
||||
NetworkManager::ConnectionSettings::Ptr settingPtr = connectPtr->settings();
|
||||
connectionItem->m_ifaceName = settingPtr->interfaceName();
|
||||
|
||||
connectionItem->m_connectState = NetworkManager::ActiveConnection::State::Deactivated;
|
||||
|
||||
return connectionItem;
|
||||
}
|
||||
|
||||
void KyConnectResourse::getConnectionList(QString DeviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
QList<KyConnectItem *> &connectItemList)
|
||||
{
|
||||
NetworkManager::Connection::List connectList;
|
||||
|
||||
qDebug()<<"[KyConnectResourse]"<<"get connections item, device"
|
||||
<<DeviceName << "connect type" << connectionType;
|
||||
|
||||
connectList.clear();
|
||||
connectList = m_networkResourceInstance->getConnectList();
|
||||
|
||||
if (connectList.empty()) {
|
||||
qWarning()<<"[KyConnectResourse]"<<"get connection failed, the connect list is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkManager::Connection::Ptr connectPtr = nullptr;
|
||||
for (int index = 0; index < connectList.size(); index++) {
|
||||
connectPtr = connectList.at(index);
|
||||
if (connectionType != connectPtr->settings()->connectionType()) {
|
||||
qDebug()<<"[KyConnectResourse]"<<"connect name:" << connectPtr->name()
|
||||
<<"connect type:"<<connectPtr->settings()->connectionType();
|
||||
continue;
|
||||
}
|
||||
|
||||
QString connectInterface = connectPtr->settings()->interfaceName();
|
||||
if (!connectInterface.isEmpty()
|
||||
&& DeviceName != connectInterface) {
|
||||
qDebug()<<"[KyConnectResourse]" << "connect name:"<< connectPtr->name()
|
||||
<< "connect device name" << connectInterface;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_networkResourceInstance->isActiveConnection(connectPtr->uuid())) {
|
||||
qDebug()<<"[KyConnectResourse]"<<connectPtr->name()<<"is active connection";
|
||||
continue;
|
||||
}
|
||||
|
||||
KyConnectItem *connectItem = getConnectionItem(connectPtr);
|
||||
if (nullptr != connectItem) {
|
||||
connectItem->m_itemType = connectionType;
|
||||
connectItemList << connectItem;
|
||||
connectItem->dumpInfo();
|
||||
}
|
||||
|
||||
connectPtr = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void KyConnectResourse::getWiredConnections(QList<KyWiredConnectItem *> &wiredConnectItemList)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -93,6 +166,8 @@ KyWiredConnectItem *KyConnectResourse::getWiredConnectItem(NetworkManager::Conne
|
|||
return wiredItem;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void KyConnectResourse::getConnectIp(
|
||||
NetworkManager::ConnectionSettings::Ptr settingPtr,
|
||||
QString &ipv4Address,
|
||||
|
@ -113,7 +188,8 @@ void KyConnectResourse::getConnectIp(
|
|||
}
|
||||
|
||||
NetworkManager::Ipv6Setting::Ptr ipv6Setting = settingPtr->setting(NetworkManager::Setting::Ipv6).dynamicCast<NetworkManager::Ipv6Setting>();
|
||||
if (NetworkManager::Ipv4Setting::Manual == ipv6Setting->method()) {
|
||||
if (nullptr !=ipv6Setting
|
||||
&& NetworkManager::Ipv4Setting::Manual == ipv6Setting->method()) {
|
||||
QList<NetworkManager::IpAddress> ipv6AddressList = ipv6Setting->addresses();
|
||||
NetworkManager::IpAddress settingIpv6Address = ipv6AddressList.at(0);
|
||||
if (settingIpv6Address.isValid()) {
|
||||
|
@ -166,14 +242,14 @@ void KyConnectResourse::getIpv6ConnectSetting(
|
|||
|
||||
void KyConnectResourse::getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting)
|
||||
{
|
||||
qDebug()<< connectUuid <<"get connect setting info";
|
||||
qDebug() <<"[KyConnectResourse]" << connectUuid <<"get connect setting info, connect uuid";
|
||||
|
||||
NetworkManager::Connection::Ptr connectPtr =
|
||||
m_networkResourceInstance->getConnect(connectUuid);
|
||||
|
||||
if (nullptr == connectPtr
|
||||
|| !connectPtr->isValid()) {
|
||||
qWarning() << "it can not find valid connection" << connectUuid;
|
||||
qWarning() <<"[KyConnectResourse]" << "it can not find valid connection" << connectUuid;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -294,7 +370,14 @@ KyBluetoothConnectItem *KyConnectResourse::getBluetoothConnectItem(NetworkManage
|
|||
NetworkManager::BluetoothSetting::Ptr bluetoothSetting =
|
||||
settingPtr->setting(NetworkManager::Setting::Bluetooth).dynamicCast<NetworkManager::BluetoothSetting>();
|
||||
bluetoothItem->m_deviceAddress = bluetoothSetting->bluetoothAddress();
|
||||
qDebug()<<"bluetooth device address:"<<bluetoothItem->m_deviceAddress;
|
||||
QByteArray btAddrArray = bluetoothSetting->bluetoothAddress();
|
||||
for (int index = 0; index < btAddrArray.size(); ++index) {
|
||||
qDebug("bt address %d %s", index, btAddrArray[index]);
|
||||
}
|
||||
// qDebug()<<"bt address 0:"<< btAddrArray[0];
|
||||
// qDebug()<<"bt address 1:"<< btAddrArray[1];
|
||||
// qDebug()<<"array size:"<<btAddrArray.size();
|
||||
qDebug()<<"bluetooth device address:"<<bluetoothItem->m_deviceAddress.toInt(nullptr, 16);
|
||||
|
||||
return bluetoothItem;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QString>
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
#include "kylinwiredconnectitem.h"
|
||||
#include "kylinconnectitem.h"
|
||||
#include "kylinvpnconnectitem.h"
|
||||
#include "kylinbluetoothconnectitem.h"
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
|
@ -17,16 +17,20 @@ public:
|
|||
~KyConnectResourse();
|
||||
|
||||
public:
|
||||
void getWiredConnections(QList<KyWiredConnectItem *> &wiredConnectItemList);
|
||||
void getConnectionList(QString DeviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
QList<KyConnectItem *> &connectItemList);
|
||||
// void getWiredConnections(QList<KyWiredConnectItem *> &wiredConnectItemList);
|
||||
void getVpnConnections(QList<KyVpnConnectItem *> &vpnConnectItemList);
|
||||
void getBluetoothConnections(QList<KyBluetoothConnectItem *> &bluetoothConnectItemList);
|
||||
void getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting);
|
||||
|
||||
private:
|
||||
KyConnectItem *getConnectionItem(NetworkManager::Connection::Ptr connectPtr);
|
||||
void getConnectIp(NetworkManager::ConnectionSettings::Ptr settingPtr,
|
||||
QString &ipv4Address,
|
||||
QString &ipv6Address);
|
||||
KyWiredConnectItem *getWiredConnectItem(NetworkManager::Connection::Ptr connectPtr);
|
||||
// KyWiredConnectItem *getWiredConnectItem(NetworkManager::Connection::Ptr connectPtr);
|
||||
|
||||
void getVpnConnectData(NetworkManager::ConnectionSettings::Ptr settingPtr,
|
||||
KyVpnConnectItem *vpnItem);
|
||||
|
|
|
@ -19,42 +19,61 @@ KyNetworkDeviceResourse::~KyNetworkDeviceResourse()
|
|||
m_networkResourceInstance = nullptr;
|
||||
}
|
||||
|
||||
void KyNetworkDeviceResourse::getWiredDevices(QStringList &wiredDeviceList)
|
||||
void KyNetworkDeviceResourse::getNetworkDevices(QStringList &networkDeviceList)
|
||||
{
|
||||
qDebug()<<"[KyNetworkDeviceResourse]"<<"get device list";
|
||||
NetworkManager::Device::List networkDeviceList
|
||||
NetworkManager::Device::List deviceList
|
||||
= m_networkResourceInstance->getNetworkDeviceList();
|
||||
|
||||
if (networkDeviceList.isEmpty()) {
|
||||
if (deviceList.isEmpty()) {
|
||||
qDebug()<<"[KyNetworkDeviceResourse]"<<"network device is not exist.";
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkManager::Device::Ptr devicePtr = nullptr;
|
||||
for (int index = 0; index < networkDeviceList.size(); ++index) {
|
||||
devicePtr = networkDeviceList.at(index);
|
||||
if (NetworkManager::Device::Type::Ethernet == devicePtr->type()) {
|
||||
wiredDeviceList<<devicePtr->interfaceName();
|
||||
}
|
||||
for (int index = 0; index < deviceList.size(); ++index) {
|
||||
devicePtr = deviceList.at(index);
|
||||
networkDeviceList<<devicePtr->interfaceName();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void KyNetworkDeviceResourse::getWiredHardwareInfo(QString ifaceName, KyWiredConnectItem *wiredItem)
|
||||
void KyNetworkDeviceResourse::getHardwareInfo(QString ifaceName, QString &hardAddress, int &bandWith)
|
||||
{
|
||||
qDebug()<<"[KyNetworkDeviceResourse]"<<"get wired hardware info"<<ifaceName;
|
||||
qDebug() << "[KyNetworkDeviceResourse]" << "get wired hardware info"<<ifaceName;
|
||||
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->getNetworkDevice(ifaceName);
|
||||
|
||||
if (nullptr != connectDevice && connectDevice->isValid()
|
||||
&& NetworkManager::Device::Ethernet == connectDevice->type()) {
|
||||
if (nullptr == connectDevice || !connectDevice->isValid()) {
|
||||
qWarning()<<"[KyNetworkDeviceResourse]"<<"get hardware info failed, the device" << ifaceName << "is not existed";
|
||||
}
|
||||
|
||||
switch (connectDevice->type()) {
|
||||
case NetworkManager::Device::Ethernet:
|
||||
{
|
||||
NetworkManager::WiredDevice *wiredDevicePtr =
|
||||
qobject_cast<NetworkManager::WiredDevice *>(connectDevice.data());
|
||||
wiredItem->m_hardAddress = wiredDevicePtr->hardwareAddress();
|
||||
wiredItem->m_bandWith = wiredDevicePtr->bitRate();
|
||||
} else {
|
||||
qWarning()<<"[KyNetworkDeviceResourse]"<<"getwiredhardwareinfo failed, the device" << ifaceName << "is not existed";
|
||||
hardAddress = wiredDevicePtr->hardwareAddress();
|
||||
bandWith = wiredDevicePtr->bitRate();
|
||||
break;
|
||||
}
|
||||
case NetworkManager::Device::Wifi:
|
||||
{
|
||||
NetworkManager::WirelessDevice *wirelessDevicePtr =
|
||||
qobject_cast<NetworkManager::WirelessDevice *>(connectDevice.data());
|
||||
hardAddress = wirelessDevicePtr->hardwareAddress();
|
||||
bandWith = wirelessDevicePtr->bitRate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
hardAddress = "";
|
||||
bandWith = 0;
|
||||
qWarning()<<"the network device type is undefined"<<connectDevice->type();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -105,7 +124,8 @@ void KyNetworkDeviceResourse::setDeviceRefreshRate(QString deviceName, int ms)
|
|||
return;
|
||||
}
|
||||
|
||||
void KyNetworkDeviceResourse::DeviceSpeed(QString deviceName, KyWiredConnectItem *wiredItem)
|
||||
#if 0
|
||||
void KyNetworkDeviceResourse::DeviceSpeed(QString deviceName, KyConnectItem *wiredItem)
|
||||
{
|
||||
// qDebug()<<"[KyNetworkDeviceResourse]"<<deviceName<<"get deivce up and down speed.";
|
||||
|
||||
|
@ -119,5 +139,5 @@ void KyNetworkDeviceResourse::DeviceSpeed(QString deviceName, KyWiredConnectItem
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QString>
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
#include "kylinwiredconnectitem.h"
|
||||
#include "kylinconnectitem.h"
|
||||
|
||||
class KyNetworkDeviceResourse : public QObject
|
||||
{
|
||||
|
@ -23,11 +23,11 @@ signals:
|
|||
void deviceMacAddressChanaged(QString deviceName, const QString &hwAddress);
|
||||
|
||||
public:
|
||||
void getWiredDevices(QStringList &wiredDeviceList);
|
||||
void getWiredHardwareInfo(QString ifaceName, KyWiredConnectItem *wiredItem);
|
||||
void getNetworkDevices(QStringList &networkDeviceList);
|
||||
void getHardwareInfo(QString ifaceName, QString &hardAddress, int &bandWith);
|
||||
NetworkManager::Device::State getDeviceState(QString deviceName);
|
||||
bool wiredDeviceCarriered(QString deviceName);
|
||||
void DeviceSpeed(QString deviceName, KyWiredConnectItem *wiredItem);
|
||||
//void DeviceSpeed(QString deviceName, KyWiredConnectItem *wiredItem);
|
||||
void setDeviceRefreshRate(QString deviceName, int ms);
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
|
||||
#include "kylinwiredconnectitem.h"
|
||||
|
||||
KyWiredConnectItem::KyWiredConnectItem(QObject *parent):QObject(parent)
|
||||
{
|
||||
m_connectName = "";
|
||||
m_connectUuid = "";
|
||||
m_ifaceName = "";
|
||||
|
||||
m_ipv4 = "";
|
||||
m_ipv6 = "";
|
||||
m_hardAddress = "";
|
||||
|
||||
m_bandWith = "";
|
||||
m_upSpeed = 0;
|
||||
m_downSpeed = 0;
|
||||
|
||||
m_state = NetworkManager::ActiveConnection::State::Unknown; //deactive、activing and actived
|
||||
m_itemType = ""; //activeconnect or connect
|
||||
}
|
||||
|
||||
KyWiredConnectItem::~KyWiredConnectItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void KyWiredConnectItem::dumpInfo()
|
||||
{
|
||||
qDebug()<<"wired connection item info:";
|
||||
qDebug()<<"connect name:"<<m_connectName;
|
||||
qDebug()<<"connect uuid:"<<m_connectUuid;
|
||||
qDebug()<<"iface name:"<<m_ifaceName;
|
||||
|
||||
qDebug()<<"ipv4 address:"<<m_ipv4;
|
||||
qDebug()<<"ipv6 address:"<<m_ipv6;
|
||||
qDebug()<<"hard address:"<<m_hardAddress;
|
||||
|
||||
qDebug()<<"band width:"<< m_bandWith;
|
||||
qDebug()<<"up speed:"<<m_upSpeed;
|
||||
qDebug()<<"down speed:"<<m_downSpeed;
|
||||
|
||||
qDebug()<<"state:"<<m_state;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#ifndef KYLINWIREDCONNECTITEM_H
|
||||
#define KYLINWIREDCONNECTITEM_H
|
||||
|
||||
#include <QString>
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
|
||||
class KyWiredConnectItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KyWiredConnectItem(QObject *parent = nullptr);
|
||||
~KyWiredConnectItem();
|
||||
|
||||
public:
|
||||
void dumpInfo();
|
||||
|
||||
public:
|
||||
QString m_connectName;
|
||||
QString m_connectUuid;
|
||||
QString m_ifaceName;
|
||||
|
||||
QString m_ipv4;
|
||||
QString m_ipv6;
|
||||
QString m_hardAddress;
|
||||
|
||||
QString m_bandWith;
|
||||
qulonglong m_upSpeed;
|
||||
qulonglong m_downSpeed;
|
||||
|
||||
NetworkManager::ActiveConnection::State m_state; //deactive、activing and actived
|
||||
QString m_itemType; //activeconnect or connect
|
||||
};
|
||||
|
||||
#endif // KYLINWIREDCONNECTITEM_H
|
|
@ -26,100 +26,18 @@
|
|||
|
||||
KyWiredConnectOperation::KyWiredConnectOperation()
|
||||
{
|
||||
m_networkResourceInstance = KyNetworkResourceManager::getInstance();
|
||||
}
|
||||
|
||||
KyWiredConnectOperation::~KyWiredConnectOperation()
|
||||
{
|
||||
m_networkResourceInstance = nullptr;
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::ipv4SettingSet(
|
||||
NetworkManager::Ipv4Setting::Ptr &ipv4Setting,
|
||||
const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
ipv4Setting->setInitialized(true);
|
||||
|
||||
if (CONFIG_IP_DHCP == connectSettingsInfo.m_ipv4ConfigIpType) {
|
||||
ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Automatic);
|
||||
return;
|
||||
} else {
|
||||
ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Manual);
|
||||
}
|
||||
|
||||
if (!connectSettingsInfo.m_ipv4Dns.empty()) {
|
||||
ipv4Setting->setDns(connectSettingsInfo.m_ipv4Dns);
|
||||
}
|
||||
|
||||
if (!connectSettingsInfo.m_ipv4Address.empty()) {
|
||||
ipv4Setting->setAddresses(connectSettingsInfo.m_ipv4Address);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void KyWiredConnectOperation::ipv6SettingSet(
|
||||
NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
|
||||
const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
ipv6Setting->setInitialized(true);
|
||||
|
||||
if (CONFIG_IP_DHCP == connectSettingsInfo.m_ipv6ConfigIpType) {
|
||||
ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Automatic);
|
||||
return;
|
||||
}
|
||||
|
||||
ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Manual);
|
||||
if (!connectSettingsInfo.m_ipv6Dns.empty()) {
|
||||
ipv6Setting->setDns(connectSettingsInfo.m_ipv6Dns);
|
||||
}
|
||||
|
||||
if (!connectSettingsInfo.m_ipv6Address.empty()) {
|
||||
ipv6Setting->setAddresses(connectSettingsInfo.m_ipv6Address);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::connectSettingSet(
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings,
|
||||
const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
connectionSettings->setId(connectSettingsInfo.m_connectName);
|
||||
connectionSettings->setUuid(NetworkManager::ConnectionSettings::createNewUuid());
|
||||
connectionSettings->setAutoconnect(true);
|
||||
connectionSettings->setAutoconnectPriority(0);
|
||||
connectionSettings->setInterfaceName(connectSettingsInfo.m_ifaceName);
|
||||
return;
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::createWiredConnect(KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
qDebug()<<"create wired connect";
|
||||
connectSettingsInfo.dumpInfo();
|
||||
NetworkManager::ConnectionSettings::Ptr wiredConnectionSettings = NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wired));
|
||||
connectSettingSet(wiredConnectionSettings, connectSettingsInfo);
|
||||
|
||||
NetworkManager::Ipv4Setting::Ptr ipv4Setting = wiredConnectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast<NetworkManager::Ipv4Setting>();
|
||||
ipv4SettingSet(ipv4Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::Ipv6Setting::Ptr ipv6Setting = wiredConnectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast<NetworkManager::Ipv6Setting>();
|
||||
ipv6SettingSet(ipv6Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::WiredSetting::Ptr wiredSetting = wiredConnectionSettings->setting(NetworkManager::Setting::Wired).dynamicCast<NetworkManager::WiredSetting>();
|
||||
wiredSetting->setInitialized(true);
|
||||
|
||||
QDBusPendingCallWatcher * watcher;
|
||||
watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(wiredConnectionSettings->toMap()), this};
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * watcher) {
|
||||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("create wired connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->createConnectionError(errorMessage);
|
||||
} else {
|
||||
qDebug()<<"create wired connect complete";
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
createConnect(connectSettingsInfo);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -127,29 +45,8 @@ void KyWiredConnectOperation::createWiredConnect(KyConnectSetting &connectSettin
|
|||
void KyWiredConnectOperation::updateWiredConnect(const QString &connectUuid, const KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
qDebug()<<"update connect"<<connectUuid;
|
||||
NetworkManager::Connection::Ptr connectPtr =
|
||||
NetworkManager::findConnectionByUuid(connectUuid);
|
||||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + connectUuid;
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
connectionSettings->setId(connectSettingsInfo.m_connectName);
|
||||
connectionSettings->setInterfaceName(connectSettingsInfo.m_ifaceName);
|
||||
|
||||
NetworkManager::Ipv4Setting::Ptr ipv4Setting = connectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast<NetworkManager::Ipv4Setting>();
|
||||
ipv4SettingSet(ipv4Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::Ipv6Setting::Ptr ipv6Setting = connectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast<NetworkManager::Ipv6Setting>();
|
||||
ipv6SettingSet(ipv6Setting, connectSettingsInfo);
|
||||
|
||||
NetworkManager::WiredSetting::Ptr wiredSetting = connectionSettings->setting(NetworkManager::Setting::Wired).dynamicCast<NetworkManager::WiredSetting>();
|
||||
wiredSetting->setInitialized(true);
|
||||
|
||||
connectPtr->update(connectionSettings->toMap());
|
||||
updateConnect(connectUuid, connectSettingsInfo);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
@ -158,30 +55,36 @@ void KyWiredConnectOperation::deleteWiredConnect(const QString &connectUuid)
|
|||
{
|
||||
qDebug()<<"delete wired connect uuid " << connectUuid;
|
||||
|
||||
NetworkManager::Connection::Ptr connectPtr =
|
||||
NetworkManager::findConnectionByUuid(connectUuid);
|
||||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + connectUuid;
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT deleteConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
connectPtr->remove();
|
||||
deleteConnect(connectUuid);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::activateWiredConnection(const QString connectUuid)
|
||||
{
|
||||
activateConnection(connectUuid);
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::deactivateWiredConnection(const QString activeConnectName, const QString &activeConnectUuid)
|
||||
{
|
||||
qDebug()<<"deactivetate connect name"<<activeConnectName<<"uuid"<<activeConnectUuid;
|
||||
|
||||
deactivateConnection(activeConnectName, activeConnectUuid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::activateVpnConnection(const QString connectUuid)
|
||||
{
|
||||
QString connectPath = "";
|
||||
QString deviceIdentifier = "";
|
||||
QString connectName = "";
|
||||
QString deviceName = "";
|
||||
//QString deviceName = "";
|
||||
QString specificObject = "";
|
||||
NetworkManager::Connection::Ptr connectPtr = nullptr;
|
||||
|
||||
qDebug()<<"it will activate connect"<<connectUuid;
|
||||
qDebug()<<"it will activate vpn connect"<<connectUuid;
|
||||
connectPtr = NetworkManager::findConnectionByUuid(connectUuid);
|
||||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = "the connect uuid " + connectUuid + "is not exsit";
|
||||
|
@ -190,10 +93,10 @@ void KyWiredConnectOperation::activateWiredConnection(const QString connectUuid)
|
|||
return;
|
||||
}
|
||||
|
||||
if (NetworkManager::ConnectionSettings::Wired != connectPtr->settings()->connectionType()) {
|
||||
if (NetworkManager::ConnectionSettings::Vpn != connectPtr->settings()->connectionType()) {
|
||||
QString errorMessage = tr("the connect type is")
|
||||
+ connectPtr->settings()->connectionType()
|
||||
+ tr(", but it is not wired");
|
||||
+ tr(", but it is not vpn");
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT activateConnectionError(errorMessage);
|
||||
return;
|
||||
|
@ -201,85 +104,28 @@ void KyWiredConnectOperation::activateWiredConnection(const QString connectUuid)
|
|||
|
||||
connectPath = connectPtr->path();
|
||||
connectName = connectPtr->name();
|
||||
deviceName = connectPtr->settings()->interfaceName();
|
||||
|
||||
for (auto const & dev : m_networkResourceInstance->m_devices) {
|
||||
for (auto const & dev_conn : dev->availableConnections()) {
|
||||
if (dev_conn == connectPtr) {
|
||||
deviceIdentifier = dev->uni();
|
||||
deviceName = dev->interfaceName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceIdentifier.isEmpty() && !deviceName.isEmpty()) {
|
||||
auto dev = m_networkResourceInstance->findDeviceInterface(deviceName);
|
||||
if (!dev.isNull()) {
|
||||
deviceIdentifier = dev->uni();
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceIdentifier.isEmpty()) {
|
||||
QString errorMessage = tr("device Identifier is empty, its name") + deviceName;
|
||||
qWarning() << errorMessage;
|
||||
Q_EMIT activateConnectionError(errorMessage);
|
||||
return ;
|
||||
}
|
||||
//deviceName = connectPtr->settings()->interfaceName();
|
||||
specificObject = deviceIdentifier = QStringLiteral("/");
|
||||
|
||||
qDebug() <<"active wired connect: path "<< connectPath
|
||||
<< "device identify " << deviceIdentifier
|
||||
<< "connect name " << connectName
|
||||
<< "device name" << deviceName
|
||||
// << "device name" << deviceName
|
||||
<< "specific parameter"<< specificObject;
|
||||
|
||||
QDBusPendingCallWatcher * watcher;
|
||||
watcher = new QDBusPendingCallWatcher{NetworkManager::activateConnection(connectPath, deviceIdentifier, specificObject), this};
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this, connectName, deviceName] (QDBusPendingCallWatcher * watcher) {
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this, connectName] (QDBusPendingCallWatcher * watcher) {
|
||||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("activate connection failed: ") + watcher->error().message();
|
||||
QString errorMessage = tr("activate vpn connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->activateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning()<<"active wired connect complete.";
|
||||
qWarning()<<"active vpn connect complete.";
|
||||
}
|
||||
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::deactivateWiredConnection(const QString activeConnectName, const QString &activeConnectUuid)
|
||||
{
|
||||
NetworkManager::ActiveConnection::Ptr activateConnectPtr = nullptr;
|
||||
|
||||
qDebug()<<"deactivetate connect name"<<activeConnectName<<"uuid"<<activeConnectUuid;
|
||||
activateConnectPtr = m_networkResourceInstance->getActiveConnect(activeConnectUuid);
|
||||
if (nullptr == activateConnectPtr) {
|
||||
QString errorMessage = tr("it can not find the activate connect")
|
||||
+ activeConnectName + tr("uuid") + activeConnectUuid;
|
||||
qWarning()<<errorMessage;
|
||||
Q_EMIT deactivateConnectionError(errorMessage);
|
||||
return ;
|
||||
}
|
||||
|
||||
qDebug() <<"dead active connection path:"<< activateConnectPtr->path();
|
||||
QDBusPendingReply<> reply = NetworkManager::deactivateConnection(activateConnectPtr->path());
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this, activateConnectPtr] (QDBusPendingCallWatcher * watcher) {
|
||||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("deactivation of connection")
|
||||
+ activateConnectPtr->connection()->name() + tr("failed:")
|
||||
+ watcher->error().message();
|
||||
|
||||
qWarning()<<errorMessage;
|
||||
emit this->deactivateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning() << "deactive connect operation finished" << activateConnectPtr->connection()->name();
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
#include "kylinconnectsetting.h"
|
||||
#include "kylinconnectoperation.h"
|
||||
|
||||
class KyWiredConnectOperation : public QObject
|
||||
class KyWiredConnectOperation : public KyConnectOperation
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -16,27 +17,8 @@ public:
|
|||
void updateWiredConnect(const QString &connectUuid, const KyConnectSetting &connectSettingsInfo);
|
||||
void deleteWiredConnect(const QString &connectUuid);
|
||||
void activateWiredConnection(const QString connectUuid);
|
||||
void activateVpnConnection(const QString connectUuid);
|
||||
void deactivateWiredConnection(const QString activeConnectName, const QString &activeConnectUuid);
|
||||
|
||||
private:
|
||||
void connectSettingSet(
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings,
|
||||
const KyConnectSetting &connectSettingsInfo);
|
||||
void ipv4SettingSet(NetworkManager::Ipv4Setting::Ptr &ipv4Setting,
|
||||
const KyConnectSetting &connectSettingsInfo);
|
||||
void ipv6SettingSet(NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
|
||||
const KyConnectSetting &connectSettingsInfo);
|
||||
inline void errorProcess(QString errorMessage);
|
||||
|
||||
signals:
|
||||
void createConnectionError(QString errorMessage);
|
||||
void updateConnectionError(QString errorMessage);
|
||||
void deleteConnectionError(QString errorMessage);
|
||||
void activateConnectionError(QString errorMessage);
|
||||
void deactivateConnectionError(QString errorMessage);
|
||||
|
||||
private:
|
||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||
};
|
||||
|
||||
#endif // KYLINWIREDCONNECTOPERATION_H
|
||||
|
|
|
@ -30,8 +30,10 @@ KyWiredWidget::~KyWiredWidget()
|
|||
void KyWiredWidget::constructWiredActiveConnectList()
|
||||
{
|
||||
qDebug()<<"constructWiredActiveConnectList";
|
||||
QList<KyWiredConnectItem *> wiredActiveConnect;
|
||||
m_activeConnectResource->getWiredActivateConnect(wiredActiveConnect);
|
||||
QList<KyConnectItem *> wiredActiveConnect;
|
||||
m_activeConnectResource->getActiveConnectionList("enp2s0",
|
||||
NetworkManager::ConnectionSettings::ConnectionType::Wired,
|
||||
wiredActiveConnect);
|
||||
if (wiredActiveConnect.isEmpty()) {
|
||||
OneLancForm *activeWiredForm = new OneLancForm(this, nullptr);
|
||||
activeWiredForm->constructActiveConnectionEmptyItem();
|
||||
|
@ -56,8 +58,10 @@ void KyWiredWidget::setType(WIDGETTYPE type)
|
|||
void KyWiredWidget::constructWiredConnectList()
|
||||
{
|
||||
qDebug()<<"constructWiredConnectList.....";
|
||||
QList<KyWiredConnectItem *> wiredConnections;
|
||||
m_connectResource->getWiredConnections(wiredConnections);
|
||||
QList<KyConnectItem *> wiredConnections;
|
||||
m_connectResource->getConnectionList("enp2s0",
|
||||
NetworkManager::ConnectionSettings::ConnectionType::Wired,
|
||||
wiredConnections);
|
||||
if (!wiredConnections.isEmpty()) {
|
||||
for (int index = 0; index < wiredConnections.size(); ++index) {
|
||||
resize(W_LIST_WIDGET, height() + H_NORMAL_ITEM);
|
||||
|
@ -176,7 +180,8 @@ void KyWiredWidget::updateDeviceRefreshRate(QString deviceName, int ms)
|
|||
return;
|
||||
}
|
||||
|
||||
void KyWiredWidget::updateNetworkSpeed(KyWiredConnectItem *wiredItem)
|
||||
#if 0
|
||||
void KyWiredWidget::updateNetworkSpeed(KyConnectItem *wiredItem)
|
||||
{
|
||||
qulonglong txBytes = wiredItem->m_upSpeed;
|
||||
qulonglong rxBytes = wiredItem->m_downSpeed;
|
||||
|
@ -199,3 +204,4 @@ void KyWiredWidget::updateNetworkSpeed(KyWiredConnectItem *wiredItem)
|
|||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "kylinactiveconnectresource.h"
|
||||
#include "kylinconnectresource.h"
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
#include "kylinwiredconnectitem.h"
|
||||
#include "kylinconnectitem.h"
|
||||
#include "onelancform.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
void constructWiredActiveConnectList();
|
||||
|
||||
void updateDeviceRefreshRate(QString deviceName, int ms);
|
||||
void updateNetworkSpeed(KyWiredConnectItem *wiredItem);
|
||||
void updateNetworkSpeed(KyConnectItem *wiredItem);
|
||||
|
||||
private:
|
||||
void updateWiredActiveConnection();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
OneLancForm::OneLancForm(QWidget *parent, KyWiredConnectItem *wiredConnectItem) :
|
||||
OneLancForm::OneLancForm(QWidget *parent, KyConnectItem *wiredConnectItem) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OneLancForm)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ OneLancForm::OneLancForm(QWidget *parent, KyWiredConnectItem *wiredConnectItem)
|
|||
m_updateSpeedTimer = new QTimer(this);
|
||||
connect(m_updateSpeedTimer, &QTimer::timeout, this, &OneLancForm::updateNetworkSpeed);
|
||||
if (nullptr != m_wiredConnectItem
|
||||
&& NetworkManager::ActiveConnection::State::Activated == m_wiredConnectItem->m_state) {
|
||||
&& NetworkManager::ActiveConnection::State::Activated == m_wiredConnectItem->m_connectState) {
|
||||
m_updateSpeedTimer->start(1000);
|
||||
}
|
||||
|
||||
|
@ -143,8 +143,8 @@ void OneLancForm::constructActiveConnectionItem(int index)
|
|||
tr("Ethernet"), m_wiredConnectItem->m_connectUuid,
|
||||
m_wiredConnectItem->m_ifaceName);//第二个参数本来是strLanName,但目前不需要翻译
|
||||
setIcon(true);
|
||||
setLanInfo(m_wiredConnectItem->m_ipv4, m_wiredConnectItem->m_ipv6,
|
||||
m_wiredConnectItem->m_bandWith, m_wiredConnectItem->m_hardAddress);
|
||||
//setLanInfo(m_wiredConnectItem->m_ipv4, m_wiredConnectItem->m_ipv6,
|
||||
// m_wiredConnectItem->m_bandWith, m_wiredConnectItem->m_hardAddress);
|
||||
//setConnedString(true, tr("NetOn,IfName:"), m_wiredConnectItem->m_ifaceName);
|
||||
setConnedString(1, tr("NetOn,"), "");
|
||||
isConnected = true;
|
||||
|
@ -162,8 +162,8 @@ void OneLancForm::constructConnectionItem(int index)
|
|||
m_wiredConnectItem->m_ifaceName);
|
||||
setIcon(true);
|
||||
setLine(true);
|
||||
setLanInfo(m_wiredConnectItem->m_ipv4, m_wiredConnectItem->m_ipv6,
|
||||
tr("Disconnected"), m_wiredConnectItem->m_hardAddress);
|
||||
//setLanInfo(m_wiredConnectItem->m_ipv4, m_wiredConnectItem->m_ipv6,
|
||||
// tr("Disconnected"), m_wiredConnectItem->m_hardAddress);
|
||||
setConnedString(0, tr("Disconnected"), "");//"未连接"
|
||||
move(L_VERTICAL_LINE_TO_ITEM, index * H_NORMAL_ITEM);
|
||||
setSelected(false, false);
|
||||
|
@ -607,8 +607,8 @@ void OneLancForm::stopWaiting()
|
|||
void OneLancForm::updateNetworkSpeed()
|
||||
{
|
||||
KyWiredWidget *wiredWidget = (KyWiredWidget *)parentWidget();
|
||||
wiredWidget->updateDeviceRefreshRate(m_wiredConnectItem->m_ifaceName, 1000);
|
||||
wiredWidget->updateNetworkSpeed(m_wiredConnectItem);
|
||||
// wiredWidget->updateDeviceRefreshRate(m_wiredConnectItem->m_ifaceName, 1000);
|
||||
// wiredWidget->updateNetworkSpeed(m_wiredConnectItem);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "kylinwiredconnectoperation.h"
|
||||
#include "backthread.h"
|
||||
#include "ksimplenm.h"
|
||||
#include "kylinwiredconnectitem.h"
|
||||
#include "kylinconnectitem.h"
|
||||
|
||||
|
||||
#include <QtDBus/QDBusConnection>
|
||||
|
@ -63,7 +63,7 @@ class OneLancForm : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OneLancForm(QWidget *parent = 0, KyWiredConnectItem *wiredConnectItem = 0);
|
||||
explicit OneLancForm(QWidget *parent = 0, KyConnectItem *wiredConnectItem = 0);
|
||||
~OneLancForm();
|
||||
|
||||
public:
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
KyWiredConnectOperation *m_wiredConnectOperation = nullptr;
|
||||
|
||||
QString leQssLow, leQssHigh;
|
||||
KyWiredConnectItem *m_wiredConnectItem = nullptr;
|
||||
KyConnectItem *m_wiredConnectItem = nullptr;
|
||||
|
||||
signals:
|
||||
void selectedOneLanForm(QString lanName, QString uniqueName);
|
||||
|
|
Loading…
Reference in New Issue