有线开关逻辑修改
This commit is contained in:
parent
b37de39bf2
commit
acf263ccfc
|
@ -34,6 +34,7 @@ DeviceFrame::DeviceFrame(QString devName, QWidget *parent) : QFrame(parent)
|
|||
deviceLabel = new QLabel(this);
|
||||
dropDownLabel = new DrownLabel(devName, this);
|
||||
deviceSwitch = new KSwitchButton(this);
|
||||
deviceSwitch->installEventFilter(this);
|
||||
|
||||
deviceLayout->addWidget(deviceLabel);
|
||||
deviceLayout->addStretch();
|
||||
|
@ -41,9 +42,14 @@ DeviceFrame::DeviceFrame(QString devName, QWidget *parent) : QFrame(parent)
|
|||
deviceLayout->addWidget(deviceSwitch);
|
||||
}
|
||||
|
||||
DeviceFrame::~DeviceFrame()
|
||||
bool DeviceFrame::eventFilter(QObject *w,QEvent *e)
|
||||
{
|
||||
|
||||
if (w == deviceSwitch) {
|
||||
if (e->type() == QMouseEvent::MouseButtonRelease) {
|
||||
emit deviceSwitchClicked(!deviceSwitch->isChecked());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceFrame::paintEvent(QPaintEvent *event)
|
||||
|
|
|
@ -34,10 +34,9 @@ using namespace kdk;
|
|||
|
||||
class DeviceFrame : public QFrame
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeviceFrame(QString devName, QWidget *parent = nullptr);
|
||||
~DeviceFrame();
|
||||
public:
|
||||
QLabel * deviceLabel = nullptr;
|
||||
KSwitchButton * deviceSwitch = nullptr;
|
||||
|
@ -45,11 +44,15 @@ public:
|
|||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
bool eventFilter(QObject *w,QEvent *e);
|
||||
|
||||
private:
|
||||
bool isDropDown = false;
|
||||
int frameSize;
|
||||
|
||||
signals:
|
||||
void deviceSwitchClicked(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif // DEVICEFRAME_H
|
||||
|
|
|
@ -49,11 +49,6 @@ ItemFrame::ItemFrame(QString devName, QWidget *parent) : QFrame(parent)
|
|||
connect(deviceFrame->dropDownLabel, &DrownLabel::labelClicked, this, &ItemFrame::onDrownLabelClicked);
|
||||
}
|
||||
|
||||
ItemFrame::~ItemFrame()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ItemFrame::onDrownLabelClicked()
|
||||
{
|
||||
if (!deviceFrame->dropDownLabel->isChecked) {
|
||||
|
|
|
@ -31,7 +31,6 @@ class ItemFrame : public QFrame
|
|||
Q_OBJECT
|
||||
public:
|
||||
ItemFrame(QString devName, QWidget *parent = nullptr);
|
||||
~ItemFrame();
|
||||
//单设备整体layout
|
||||
QVBoxLayout * deviceLanLayout = nullptr;
|
||||
//单设备名称+下拉按钮Frame+d单设备开关
|
||||
|
|
|
@ -501,10 +501,14 @@ void NetConnect::addDeviceFrame(QString devName)
|
|||
deviceFrameMap.insert(devName, itemFrame);
|
||||
qDebug() << "[NetConnect]deviceFrameMap insert" << devName;
|
||||
|
||||
connect(itemFrame->deviceFrame->deviceSwitch, &KSwitchButton::stateChanged, this, [=] (bool checked) {
|
||||
connect(itemFrame->deviceFrame, &DeviceFrame::deviceSwitchClicked ,this, [=] (bool checked) {
|
||||
qDebug() << "[NetConnect]call setDeviceEnable" << devName << checked << __LINE__;
|
||||
m_interface->call(QStringLiteral("setDeviceEnable"), devName, checked);
|
||||
qDebug() << "[NetConnect]call setDeviceEnable Respond" << __LINE__;
|
||||
});
|
||||
|
||||
connect(itemFrame->deviceFrame->deviceSwitch, &KSwitchButton::stateChanged, this, [=] (bool checked) {
|
||||
|
||||
if (checked) {
|
||||
qDebug() << "[NetConnect]set " << devName << "status" << true;
|
||||
itemFrame->lanItemFrame->show();
|
||||
|
@ -600,6 +604,15 @@ void NetConnect::onDeviceStatusChanged()
|
|||
setSwitchStatus();
|
||||
}
|
||||
|
||||
QMap<QString, ItemFrame *>::iterator iter;
|
||||
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
|
||||
if (deviceStatusMap.contains(iter.key())) {
|
||||
qDebug() <<"======" << iter.key() << iter.value()->deviceFrame->deviceSwitch->isChecked() <<deviceStatusMap[iter.key()];
|
||||
if (iter.value()->deviceFrame->deviceSwitch->isChecked() != deviceStatusMap[iter.key()]) {
|
||||
iter.value()->deviceFrame->deviceSwitch->setChecked(deviceStatusMap[iter.key()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetConnect::onDeviceNameChanged(QString oldName, QString newName, int type)
|
||||
|
|
|
@ -76,7 +76,7 @@ private:
|
|||
KyBluetoothConnectItem *getBtActiveConnectItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr);
|
||||
KyApConnectItem *getApActiveConnectItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void activeConnectAdd(QString activeConnectUuid);
|
||||
void updateActiveConnect(QString activeConnectUuid);
|
||||
void activeConnectRemove(QString activeConnectUuid);
|
||||
|
|
|
@ -201,7 +201,7 @@ void KyConnectOperation::activateConnection(const QString connectUuid, const QSt
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("activate connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->activateConnectionError(errorMessage);
|
||||
Q_EMIT this->activateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning()<<"active wired connect complete.";
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ void KyConnectOperation::deactivateConnection(const QString activeConnectName, c
|
|||
+ watcher->error().message();
|
||||
|
||||
qWarning()<<errorMessage;
|
||||
emit this->deactivateConnectionError(errorMessage);
|
||||
Q_EMIT this->deactivateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning() << "deactive connect operation finished" << activateConnectPtr->connection()->name();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
bool bAutoConnect);
|
||||
inline void errorProcess(QString errorMessage);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void createConnectionError(QString errorMessage);
|
||||
void updateConnectionError(QString errorMessage);
|
||||
void deleteConnectionError(QString errorMessage);
|
||||
|
|
|
@ -78,7 +78,7 @@ private:
|
|||
void getIpv6ConnectSetting(NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
|
||||
KyConnectSetting &connectSetting);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void connectionAdd(QString uuid);
|
||||
void connectionUpdate(QString uuid);
|
||||
void connectionRemove(QString path);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
#include "kywirelessnetitem.h"
|
||||
#include "kylinutil.h"
|
||||
|
||||
#define VIRTURAL_DEVICE_PATH "/sys/devices/virtual/net"
|
||||
#define LOG_FLAG "KyNetworkDeviceResourse"
|
||||
|
@ -47,6 +48,8 @@ KyNetworkDeviceResourse::KyNetworkDeviceResourse(QObject *parent) : QObject(pare
|
|||
this, &KyNetworkDeviceResourse::deviceMacAddressChanage);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceActiveChanage,
|
||||
this, &KyNetworkDeviceResourse::deviceActiveChanage);
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceManagedChange,
|
||||
this, &KyNetworkDeviceResourse::deviceManagedChange);
|
||||
|
||||
}
|
||||
|
||||
|
@ -308,7 +311,7 @@ int KyNetworkDeviceResourse::getWirelessDeviceCapability(const QString deviceNam
|
|||
void KyNetworkDeviceResourse::onDeviceAdd(QString deviceName, QString uni, NetworkManager::Device::Type deviceType)
|
||||
{
|
||||
m_deviceMap.insert(uni, deviceName);
|
||||
emit deviceAdd(deviceName, deviceType);
|
||||
Q_EMIT deviceAdd(deviceName, deviceType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -316,7 +319,7 @@ void KyNetworkDeviceResourse::onDeviceAdd(QString deviceName, QString uni, Netwo
|
|||
void KyNetworkDeviceResourse::onDeviceRemove(QString deviceName, QString uni)
|
||||
{
|
||||
m_deviceMap.remove(uni);
|
||||
emit deviceRemove(deviceName);
|
||||
Q_EMIT deviceRemove(deviceName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -327,7 +330,7 @@ void KyNetworkDeviceResourse::onDeviceUpdate(QString interface, QString dbusPath
|
|||
if (m_deviceMap[dbusPath] != interface) {
|
||||
QString oldName = m_deviceMap[dbusPath];
|
||||
m_deviceMap[dbusPath] = interface;
|
||||
emit deviceNameUpdate(oldName, interface);
|
||||
Q_EMIT deviceNameUpdate(oldName, interface);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,3 +361,29 @@ bool KyNetworkDeviceResourse::deviceIsWired(QString deviceName)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
void KyNetworkDeviceResourse::setDeviceManaged(QString devName, bool managed)
|
||||
{
|
||||
QString dbusPath;
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->findDeviceInterface(devName);
|
||||
if (connectDevice->isValid()) {
|
||||
dbusPath = connectDevice->uni();
|
||||
} else {
|
||||
qWarning()<<"[KyNetworkDeviceResourse] can not find device " << devName;
|
||||
return;
|
||||
}
|
||||
setDeviceManagedByGDbus(dbusPath, managed);
|
||||
}
|
||||
|
||||
bool KyNetworkDeviceResourse::getDeviceManaged(QString deviceName)
|
||||
{
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->findDeviceInterface(deviceName);
|
||||
if (connectDevice->isValid()) {
|
||||
return connectDevice->managed();
|
||||
} else {
|
||||
qWarning()<<"[KyNetworkDeviceResourse] can not find device " << deviceName;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
explicit KyNetworkDeviceResourse(QObject *parent = nullptr);
|
||||
~KyNetworkDeviceResourse();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void deviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
||||
void deviceRemove(QString deviceName);
|
||||
void deviceUpdate(QString deviceName);
|
||||
|
@ -44,8 +44,9 @@ signals:
|
|||
void deviceBitRateChanage(QString deviceName, int bitRate);
|
||||
void deviceMacAddressChanage(QString deviceName, const QString &hwAddress);
|
||||
void deviceActiveChanage(QString deviceName, bool deivceActive);
|
||||
void deviceManagedChange(QString deviceName, bool managed);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void onDeviceAdd(QString deviceName, QString uni, NetworkManager::Device::Type deviceType);
|
||||
void onDeviceRemove(QString deviceName, QString uni);
|
||||
void onDeviceUpdate(QString interface, QString dbusPath);
|
||||
|
@ -64,6 +65,9 @@ public:
|
|||
|
||||
void setDeviceRefreshRate(QString deviceName, int ms);
|
||||
|
||||
void setDeviceManaged(QString devName, bool managed);
|
||||
bool getDeviceManaged(QString devName);
|
||||
|
||||
private:
|
||||
KyWiredConnectOperation wiredOperation;
|
||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||
|
|
|
@ -55,6 +55,11 @@ KyNetworkResourceManager::KyNetworkResourceManager(QObject *parent) : QObject(pa
|
|||
QString("/org/freedesktop/DBus"),
|
||||
QString("org.freedesktop.DBus"),
|
||||
QString("NameOwnerChanged"), this, SLOT(onServiceAppear(QString,QString,QString)));
|
||||
|
||||
QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"),
|
||||
QString("/org/freedesktop/NetworkManager"),
|
||||
QString("org.freedesktop.NetworkManager"),
|
||||
QString("PropertiesChanged"), this, SLOT(onPropertiesChanged(QVariantMap)));
|
||||
}
|
||||
|
||||
void KyNetworkResourceManager::onInitNetwork()
|
||||
|
@ -154,7 +159,7 @@ void KyNetworkResourceManager::removeConnection(int pos)
|
|||
QString path = m_connections.at(pos)->path();
|
||||
NetworkManager::Connection::Ptr conn = m_connections.takeAt(pos);
|
||||
conn->disconnect(this);
|
||||
emit connectionRemove(path);
|
||||
Q_EMIT connectionRemove(path);
|
||||
}
|
||||
|
||||
void KyNetworkResourceManager::clearConnections()
|
||||
|
@ -225,12 +230,12 @@ void KyNetworkResourceManager::addDevice(NetworkManager::Device::Ptr device)
|
|||
#endif
|
||||
connect(device.data(), &NetworkManager::Device::activeConnectionChanged, this, &KyNetworkResourceManager::onDeviceActiveChanage);
|
||||
connect(device.data(), &NetworkManager::Device::interfaceNameChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::managedChanged, this, &KyNetworkResourceManager::onDeviceManagedChange);
|
||||
#if 0
|
||||
connect(device.data(), &NetworkManager::Device::ipV4AddressChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::ipV4ConfigChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::ipV6ConfigChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::ipInterfaceChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::managedChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::physicalPortIdChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::mtuChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
connect(device.data(), &NetworkManager::Device::nmPluginMissingChanged, this, &KyNetworkResourceManager::onDeviceUpdated);
|
||||
|
@ -318,7 +323,7 @@ void KyNetworkResourceManager::insertWifiNetworks()
|
|||
for (auto const & net : w_dev->networks()) {
|
||||
if (!net.isNull()) {
|
||||
addWifiNetwork(net);
|
||||
emit wifiNetworkAdded(device->interfaceName(),net->ssid());
|
||||
Q_EMIT wifiNetworkAdded(device->interfaceName(),net->ssid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -542,6 +547,17 @@ void KyNetworkResourceManager::onServiceAppear(QString interface, QString oldOwn
|
|||
}
|
||||
}
|
||||
|
||||
void KyNetworkResourceManager::onPropertiesChanged(QVariantMap qvm)
|
||||
{
|
||||
for(QString keyStr : qvm.keys()) {
|
||||
//收到wifi开关打开或关闭的信号后,进行处理
|
||||
if (keyStr == "WiredEnabled") {
|
||||
bool wiredEnable = qvm.value("WiredEnabled").toBool();
|
||||
Q_EMIT wiredEnabledChanged(wiredEnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KyNetworkResourceManager::onConnectionUpdated()
|
||||
{
|
||||
NetworkManager::Connection *connectPtr =
|
||||
|
@ -549,7 +565,7 @@ void KyNetworkResourceManager::onConnectionUpdated()
|
|||
if (nullptr != connectPtr && connectPtr->isValid()) {
|
||||
qDebug()<< LOG_FLAG <<"connection will Update, connection name"<<connectPtr->name()
|
||||
<< "connection uuid" << connectPtr->uuid();
|
||||
emit connectionUpdate(connectPtr->uuid());
|
||||
Q_EMIT connectionUpdate(connectPtr->uuid());
|
||||
} else {
|
||||
qWarning()<< LOG_FLAG
|
||||
<<"onConnectionUpdate failed, the connect is invalid";
|
||||
|
@ -560,7 +576,7 @@ void KyNetworkResourceManager::onConnectionUpdated()
|
|||
|
||||
void KyNetworkResourceManager::onActiveConnectionUpdated()
|
||||
{
|
||||
//emit activeConnectionUpdate(qobject_cast<NetworkManager::ActiveConnection *>(sender()));
|
||||
//Q_EMIT activeConnectionUpdate(qobject_cast<NetworkManager::ActiveConnection *>(sender()));
|
||||
}
|
||||
|
||||
void KyNetworkResourceManager::onActiveConnectionChangedReason(
|
||||
|
@ -572,7 +588,7 @@ void KyNetworkResourceManager::onActiveConnectionChangedReason(
|
|||
if (nullptr != activeConnect && activeConnect->isValid()) {
|
||||
qDebug()<< LOG_FLAG <<"connect uuid"<<activeConnect->uuid()
|
||||
<<"state change"<<state << "chanage reason:"<<reason;
|
||||
emit activeConnectStateChangeReason(activeConnect->uuid(), state, reason);
|
||||
Q_EMIT activeConnectStateChangeReason(activeConnect->uuid(), state, reason);
|
||||
} else {
|
||||
qWarning() << LOG_FLAG << "onActiveConnectionChangedReason failed, the connection is invalid.";
|
||||
}
|
||||
|
@ -594,7 +610,7 @@ void KyNetworkResourceManager::onActiveConnectionChanged(
|
|||
::usleep(EMIT_DELAY);
|
||||
}
|
||||
|
||||
emit activeConnectStateChangeReason(activeConnect->uuid(), state,
|
||||
Q_EMIT activeConnectStateChangeReason(activeConnect->uuid(), state,
|
||||
NetworkManager::ActiveConnection::Reason::UknownReason);
|
||||
} else {
|
||||
qWarning() << LOG_FLAG << "onActiveConnectionChanged failed, the connection is invalid.";
|
||||
|
@ -612,7 +628,7 @@ void KyNetworkResourceManager::onVpnActiveConnectChanagedReason(NetworkManager::
|
|||
if (nullptr != activeConnect && activeConnect->isValid()) {
|
||||
qDebug()<<"vpn connect uuid" << activeConnect->uuid()
|
||||
<<"state change " <<state <<"reason " << reason;
|
||||
emit vpnActiveConnectStateChangeReason(activeConnect->uuid(), state, reason);
|
||||
Q_EMIT vpnActiveConnectStateChangeReason(activeConnect->uuid(), state, reason);
|
||||
} else {
|
||||
qWarning() << LOG_FLAG << "onVpnActiveConnectChanagedReason failed, the connection is invalid.";
|
||||
}
|
||||
|
@ -634,7 +650,7 @@ void KyNetworkResourceManager::onDeviceActiveChanage()
|
|||
qDebug()<< LOG_FLAG << "device active change, device name " << deviceName
|
||||
<< "active state" << isActive;
|
||||
|
||||
emit deviceActiveChanage(deviceName, isActive);
|
||||
Q_EMIT deviceActiveChanage(deviceName, isActive);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -649,11 +665,24 @@ void KyNetworkResourceManager::onDeviceUpdated()
|
|||
QString deviceName = p_device->interfaceName();
|
||||
QString deviceUni = p_device->uni();
|
||||
|
||||
emit deviceUpdate(deviceName, deviceUni);
|
||||
Q_EMIT deviceUpdate(deviceName, deviceUni);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void KyNetworkResourceManager::onDeviceManagedChange()
|
||||
{
|
||||
NetworkManager::Device *p_device = qobject_cast<NetworkManager::Device *>(sender());
|
||||
if (nullptr == p_device) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString deviceName = p_device->interfaceName();
|
||||
bool managed = p_device->managed();
|
||||
|
||||
Q_EMIT deviceManagedChange(deviceName, managed);
|
||||
}
|
||||
|
||||
void KyNetworkResourceManager::onDeviceCarrierChanage(bool pluged)
|
||||
{
|
||||
NetworkManager::WiredDevice * networkDevice
|
||||
|
@ -661,7 +690,7 @@ void KyNetworkResourceManager::onDeviceCarrierChanage(bool pluged)
|
|||
|
||||
qDebug()<< LOG_FLAG<<"device carrier chanage"<< pluged;
|
||||
if (nullptr !=networkDevice && networkDevice->isValid()) {
|
||||
emit deviceCarrierChanage(networkDevice->interfaceName(), pluged);
|
||||
Q_EMIT deviceCarrierChanage(networkDevice->interfaceName(), pluged);
|
||||
} else {
|
||||
qWarning()<< LOG_FLAG<<"onDeviceCarrierChanage failed.";
|
||||
}
|
||||
|
@ -676,7 +705,7 @@ void KyNetworkResourceManager::onDeviceBitRateChanage(int bitRate)
|
|||
|
||||
if (nullptr != networkDevice
|
||||
&& networkDevice->isValid()) {
|
||||
emit deviceBitRateChanage(networkDevice->interfaceName(), bitRate);
|
||||
Q_EMIT deviceBitRateChanage(networkDevice->interfaceName(), bitRate);
|
||||
} else {
|
||||
qWarning()<< LOG_FLAG <<"the device is not invalid with bitrate" << bitRate;
|
||||
}
|
||||
|
@ -690,7 +719,7 @@ void KyNetworkResourceManager::onDeviceMacAddressChanage(const QString &hwAddres
|
|||
= qobject_cast<NetworkManager::WiredDevice *>(sender());
|
||||
|
||||
if (nullptr !=networkDevice && networkDevice->isValid()) {
|
||||
emit deviceMacAddressChanage(networkDevice->interfaceName(), hwAddress);
|
||||
Q_EMIT deviceMacAddressChanage(networkDevice->interfaceName(), hwAddress);
|
||||
} else {
|
||||
qWarning()<< LOG_FLAG <<"the device is not invalid with mac" << hwAddress;
|
||||
}
|
||||
|
@ -729,7 +758,7 @@ void KyNetworkResourceManager::onWifiNetworkAdd(NetworkManager::Device * dev, QS
|
|||
NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint();
|
||||
QByteArray rawSsid = accessPoitPtr->rawSsid();
|
||||
QString wifiSsid = getSsidFromByteArray(rawSsid);
|
||||
emit wifiNetworkAdded(dev->interfaceName(), wifiSsid);
|
||||
Q_EMIT wifiNetworkAdded(dev->interfaceName(), wifiSsid);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -744,7 +773,7 @@ void KyNetworkResourceManager::onWifiNetworkUpdate(NetworkManager::WirelessNetwo
|
|||
auto index = std::find(m_wifiNets.cbegin(), m_wifiNets.cend(), net);
|
||||
if (m_wifiNets.cend() != index) {
|
||||
if (net->accessPoints().isEmpty()) {
|
||||
//emit
|
||||
//Q_EMIT
|
||||
bool bFlag = false;
|
||||
QString devIface;
|
||||
NetworkManager::Device::Ptr dev = findDeviceUni(net->device());
|
||||
|
@ -761,17 +790,17 @@ void KyNetworkResourceManager::onWifiNetworkUpdate(NetworkManager::WirelessNetwo
|
|||
if(bFlag) {
|
||||
//device invalid
|
||||
qDebug() << LOG_FLAG << "wifiNetworkDeviceDisappear";
|
||||
emit wifiNetworkDeviceDisappear();
|
||||
Q_EMIT wifiNetworkDeviceDisappear();
|
||||
} else {
|
||||
qDebug()<< LOG_FLAG << "wifiNetwork disappear" << net << net->ssid();
|
||||
NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint();
|
||||
QByteArray rawSsid = accessPoitPtr->rawSsid();
|
||||
QString wifiSsid = getSsidFromByteArray(rawSsid);
|
||||
emit wifiNetworkRemoved(devIface, wifiSsid);
|
||||
Q_EMIT wifiNetworkRemoved(devIface, wifiSsid);
|
||||
}
|
||||
} else {
|
||||
qDebug()<< LOG_FLAG << "wifiNetworkPropertyChange " << net << net->ssid();
|
||||
emit wifiNetworkPropertyChange(net);
|
||||
Q_EMIT wifiNetworkPropertyChange(net);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,7 +823,7 @@ void KyNetworkResourceManager::onWifiNetworkRemove(NetworkManager::Device * dev,
|
|||
NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint();
|
||||
QByteArray rawSsid = accessPoitPtr->rawSsid();
|
||||
QString wifiSsid = getSsidFromByteArray(rawSsid);
|
||||
emit wifiNetworkRemoved(dev->interfaceName(), wifiSsid);
|
||||
Q_EMIT wifiNetworkRemoved(dev->interfaceName(), wifiSsid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -810,7 +839,7 @@ void KyNetworkResourceManager::onWifiNetworkAppeared(QString const & ssid)
|
|||
QString deviceName = p_device->interfaceName();
|
||||
QString deviceUni = p_device->uni();
|
||||
|
||||
emit deviceUpdate(deviceName, deviceUni);
|
||||
Q_EMIT deviceUpdate(deviceName, deviceUni);
|
||||
} else {
|
||||
qWarning()<< LOG_FLAG << "onWifiNetworkAppeared failed.";
|
||||
}
|
||||
|
@ -827,7 +856,7 @@ void KyNetworkResourceManager::onWifiNetworkDisappeared(QString const & ssid)
|
|||
QString deviceName = p_device->interfaceName();
|
||||
QString deviceUni = p_device->uni();
|
||||
|
||||
emit deviceUpdate(deviceName, deviceUni);
|
||||
Q_EMIT deviceUpdate(deviceName, deviceUni);
|
||||
} else {
|
||||
qWarning()<< LOG_FLAG << "onWifiNetworkDisappeared failed.";
|
||||
}
|
||||
|
@ -863,7 +892,7 @@ void KyNetworkResourceManager::onDeviceAdded(QString const & uni)
|
|||
|
||||
if (0 > m_devices.indexOf(networkDevice)) {
|
||||
addDevice(networkDevice);
|
||||
emit deviceAdd(networkDevice->interfaceName(), networkDevice->uni(), networkDevice->type());
|
||||
Q_EMIT deviceAdd(networkDevice->interfaceName(), networkDevice->uni(), networkDevice->type());
|
||||
} else {
|
||||
qWarning() << networkDevice->interfaceName() <<"the device is exist in network device list.";
|
||||
}
|
||||
|
@ -885,7 +914,7 @@ void KyNetworkResourceManager::onDeviceRemoved(QString const & uni)
|
|||
if (m_devices.cend() != index) {
|
||||
const int pos = index - m_devices.cbegin();
|
||||
removeDevice(pos);
|
||||
emit deviceRemove(networkDevice->interfaceName(), networkDevice->uni());
|
||||
Q_EMIT deviceRemove(networkDevice->interfaceName(), networkDevice->uni());
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -908,11 +937,11 @@ void KyNetworkResourceManager::onActiveConnectionAdded(QString const & path)
|
|||
|
||||
if (0 > m_activeConns.indexOf(activeConnectPtr)) {
|
||||
addActiveConnection(activeConnectPtr);
|
||||
emit activeConnectionAdd(activeConnectPtr->uuid());
|
||||
Q_EMIT activeConnectionAdd(activeConnectPtr->uuid());
|
||||
} else {
|
||||
//TODO: onActiveConnectionUpdate
|
||||
qWarning() << "[KyNetworkResourceManager]" << "update active connection to do";
|
||||
//emit activeConnectionUpdate(conn->uuid());
|
||||
//Q_EMIT activeConnectionUpdate(conn->uuid());
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -933,7 +962,7 @@ void KyNetworkResourceManager::onActiveConnectionRemoved(QString const & path)
|
|||
if (m_activeConns.cend() != index) {
|
||||
const int pos = index - m_activeConns.cbegin();
|
||||
removeActiveConnection(pos);
|
||||
emit activeConnectionRemove(activeConnectPtr->uuid());
|
||||
Q_EMIT activeConnectionRemove(activeConnectPtr->uuid());
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -961,7 +990,7 @@ void KyNetworkResourceManager::onConnectionAdded(QString const & path)
|
|||
|
||||
if (0 > m_connections.indexOf(connectPtr)) {
|
||||
addConnection(connectPtr);
|
||||
emit connectionAdd(connectPtr->uuid());
|
||||
Q_EMIT connectionAdd(connectPtr->uuid());
|
||||
} else {
|
||||
//TODO::updateconnect
|
||||
qWarning() << "[KyNetworkResourceManager]" << connectPtr->uuid() <<" connect is exist in connect list.";
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
bool NetworkManagerIsInited();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void connectionAdd(QString uuid);
|
||||
void connectionUpdate(QString uuid);
|
||||
void connectionRemove(QString path);
|
||||
|
@ -112,6 +112,7 @@ signals:
|
|||
void deviceAdd(QString deviceName, QString uni, NetworkManager::Device::Type deviceType);
|
||||
void deviceUpdate(QString deviceName, QString deviceUni);
|
||||
void deviceRemove(QString deviceName, QString uni);
|
||||
void deviceManagedChange(QString deviceName, bool managed);
|
||||
|
||||
void deviceActiveChanage(QString deviceName, bool deviceActive);
|
||||
void deviceCarrierChanage(QString deviceName, bool pluged);
|
||||
|
@ -124,6 +125,7 @@ signals:
|
|||
void wifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
|
||||
void wifiNetworkDeviceDisappear();
|
||||
void wifiEnabledChanged(bool);
|
||||
void wiredEnabledChanged(bool);
|
||||
|
||||
void activeConnectionsReset();
|
||||
void activeConnectionAdd(QString uuid);
|
||||
|
@ -138,13 +140,14 @@ signals:
|
|||
|
||||
void connectivityChanged(NetworkManager::Connectivity connectivity);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void onInitNetwork();
|
||||
void setWirelessNetworkEnabled(bool enabled);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void insertWifiNetworks();
|
||||
void onServiceAppear(QString, QString, QString);
|
||||
void onPropertiesChanged(QVariantMap qvm);
|
||||
//connection
|
||||
void onConnectionUpdated();
|
||||
//void onConnectionRemoved();
|
||||
|
@ -163,6 +166,7 @@ private slots:
|
|||
void onDeviceActiveChanage();
|
||||
|
||||
void onDeviceUpdated();
|
||||
void onDeviceManagedChange();
|
||||
void onDeviceCarrierChanage(bool pluged);
|
||||
void onDeviceBitRateChanage(int bitRate);
|
||||
void onDeviceMacAddressChanage(const QString &hwAddress);
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
#include "kylinutil.h"
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
#include <glib-2.0/glib.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define LOG_FLAG "[kylin-util]"
|
||||
|
||||
QString getConnectTypeByDbus(QString &connectPath)
|
||||
|
@ -54,10 +59,7 @@ QString getConnectTypeByDbus(QString &connectPath)
|
|||
|
||||
connectType = connectMap.value(KEY_CONNECT_TYPE).toString();
|
||||
|
||||
// qDebug() << LOG_FLAG << "connection type" << connectType;
|
||||
|
||||
return connectType;
|
||||
|
||||
}
|
||||
|
||||
QString getSsidFromByteArray(QByteArray &rawSsid)
|
||||
|
@ -87,18 +89,131 @@ QString getSsidFromByteArray(QByteArray &rawSsid)
|
|||
{
|
||||
wifiSsid = rawSsid;
|
||||
}
|
||||
|
||||
// if (!QString::fromUtf8(rawSsid).contains("?")) {
|
||||
// QTextCodec *p_textGBK = QTextCodec::codecForName("GB2312");
|
||||
// wifiSsid = p_textGBK->toUnicode(rawSsid);
|
||||
|
||||
// qDebug() << LOG_FLAG <<"gb2312 to string ssid" << wifiSsid;
|
||||
// //qDebug() << LOG_FLAG << "-------------> GB2312 " << byteArrayGB;
|
||||
// } else {
|
||||
// wifiSsid = QString::fromUtf8(rawSsid);
|
||||
|
||||
// qDebug()<< LOG_FLAG <<" UTF-8 ssid: " <<wifiSsid;
|
||||
// //qDebug()<< "-------------> UTF-8 " << bytearray;
|
||||
// }
|
||||
return wifiSsid;
|
||||
}
|
||||
|
||||
void setWiredEnabledByGDbus(bool enabled)
|
||||
{
|
||||
GDBusProxy *props_proxy;
|
||||
GVariant *ret = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
/* Create a D-Bus object proxy for the active connection object's properties */
|
||||
props_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
NULL,
|
||||
"org.freedesktop.NetworkManager",
|
||||
"/org/freedesktop/NetworkManager",
|
||||
"org.freedesktop.DBus.Properties",
|
||||
NULL, NULL);
|
||||
g_assert (props_proxy);
|
||||
|
||||
/* Get the object path of the Connection details */
|
||||
ret = g_dbus_proxy_call_sync (props_proxy,
|
||||
"Set",
|
||||
g_variant_new ("(ssv)",
|
||||
"org.freedesktop.NetworkManager",
|
||||
"WiredEnabled",
|
||||
g_variant_new_boolean(enabled)),
|
||||
G_DBUS_CALL_FLAGS_NONE, -1,
|
||||
NULL, &error);
|
||||
if (!ret) {
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
qDebug() << "failed to setWiredEnabledByGDbus";
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
g_variant_unref (ret);
|
||||
g_object_unref (props_proxy);
|
||||
}
|
||||
|
||||
bool getWiredEnabledByGDbus()
|
||||
{
|
||||
GDBusProxy *props_proxy;
|
||||
GVariant *ret = NULL, *path_value = NULL;
|
||||
GError *error = NULL;
|
||||
gboolean bRet = false;
|
||||
|
||||
/* Create a D-Bus object proxy for the active connection object's properties */
|
||||
props_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
NULL,
|
||||
"org.freedesktop.NetworkManager",
|
||||
"/org/freedesktop/NetworkManager",
|
||||
"org.freedesktop.DBus.Properties",
|
||||
NULL, NULL);
|
||||
g_assert (props_proxy);
|
||||
|
||||
/* Get the object path of the Connection details */
|
||||
ret = g_dbus_proxy_call_sync (props_proxy,
|
||||
"Get",
|
||||
g_variant_new ("(ss)",
|
||||
"org.freedesktop.NetworkManager",
|
||||
"WiredEnabled"),
|
||||
G_DBUS_CALL_FLAGS_NONE, -1,
|
||||
NULL, &error);
|
||||
if (!ret) {
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
qDebug() << "failed to setWiredEnabledByGDbus";
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_variant_get (ret, "(v)", &path_value);
|
||||
if (!g_variant_is_of_type (path_value, G_VARIANT_TYPE_BOOLEAN)) {
|
||||
g_warning ("Unexpected type returned getting Connection property: %s",
|
||||
g_variant_get_type_string (path_value));
|
||||
goto out;
|
||||
}
|
||||
|
||||
bRet = g_variant_get_boolean (path_value);
|
||||
|
||||
out:
|
||||
if (path_value)
|
||||
g_variant_unref (path_value);
|
||||
if (ret)
|
||||
g_variant_unref (ret);
|
||||
g_object_unref (props_proxy);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
void setDeviceManagedByGDbus(QString dbusPath, bool managed)
|
||||
{
|
||||
GDBusProxy *props_proxy;
|
||||
GVariant *ret = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
/* Create a D-Bus object proxy for the active connection object's properties */
|
||||
props_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
NULL,
|
||||
"org.freedesktop.NetworkManager",
|
||||
dbusPath.toStdString().c_str(),
|
||||
"org.freedesktop.DBus.Properties",
|
||||
NULL, NULL);
|
||||
g_assert (props_proxy);
|
||||
|
||||
/* Get the object path of the Connection details */
|
||||
ret = g_dbus_proxy_call_sync (props_proxy,
|
||||
"Set",
|
||||
g_variant_new ("(ssv)",
|
||||
"org.freedesktop.NetworkManager.Device",
|
||||
"Managed",
|
||||
g_variant_new_boolean(managed)),
|
||||
G_DBUS_CALL_FLAGS_NONE, -1,
|
||||
NULL, &error);
|
||||
if (!ret) {
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
qDebug() << "failed to setWiredEnabledByGDbus";
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
g_variant_unref (ret);
|
||||
g_object_unref (props_proxy);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,5 +35,8 @@
|
|||
|
||||
QString getConnectTypeByDbus(QString &connectPath);
|
||||
QString getSsidFromByteArray(QByteArray &rawSsid);
|
||||
void setWiredEnabledByGDbus(bool enabled);
|
||||
void setDeviceManagedByGDbus(QString dbusPath, bool managed);
|
||||
bool getWiredEnabledByGDbus();
|
||||
|
||||
#endif // KYLINUTIL_H
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "kylinwiredconnectoperation.h"
|
||||
#include "kylinutil.h"
|
||||
|
||||
#include <NetworkManagerQt/AdslDevice>
|
||||
#include <NetworkManagerQt/WiredDevice>
|
||||
|
@ -26,13 +27,24 @@
|
|||
|
||||
KyWiredConnectOperation::KyWiredConnectOperation(QObject *parent) : KyConnectOperation(parent)
|
||||
{
|
||||
|
||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::wiredEnabledChanged,
|
||||
this, &KyWiredConnectOperation::wiredEnabledChanged);
|
||||
}
|
||||
|
||||
KyWiredConnectOperation::~KyWiredConnectOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::setWiredEnabled(bool enabled)
|
||||
{
|
||||
setWiredEnabledByGDbus(enabled);
|
||||
}
|
||||
|
||||
bool KyWiredConnectOperation::getWiredEnabled()
|
||||
{
|
||||
return getWiredEnabledByGDbus();
|
||||
}
|
||||
|
||||
void KyWiredConnectOperation::createWiredConnect(KyConnectSetting &connectSettingsInfo)
|
||||
{
|
||||
qDebug()<<"[KyWiredConnectOperation]" << "create connect ";
|
||||
|
@ -56,7 +68,7 @@ void KyWiredConnectOperation::createWiredConnect(KyConnectSetting &connectSettin
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("create wired connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->createConnectionError(errorMessage);
|
||||
Q_EMIT this->createConnectionError(errorMessage);
|
||||
} else {
|
||||
qDebug()<<"create wired connect complete";
|
||||
}
|
||||
|
@ -74,7 +86,7 @@ void KyWiredConnectOperation::updateWiredConnect(const QString &connectUuid, con
|
|||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + connectUuid;
|
||||
qWarning()<<errorMessage;
|
||||
emit updateConnectionError(errorMessage);
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -197,7 +209,7 @@ void KyWiredConnectOperation::activateVpnConnection(const QString connectUuid)
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("activate vpn connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->activateConnectionError(errorMessage);
|
||||
Q_EMIT this->activateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning()<<"active vpn connect complete.";
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ public:
|
|||
~KyWiredConnectOperation();
|
||||
|
||||
public:
|
||||
//无线开关
|
||||
void setWiredEnabled(bool enabled);
|
||||
bool getWiredEnabled();
|
||||
|
||||
void createWiredConnect(KyConnectSetting &connectSettingsInfo);
|
||||
void updateWiredConnect(const QString &connectUuid, const KyConnectSetting &connectSettingsInfo);
|
||||
void deleteWiredConnect(const QString &connectUuid);
|
||||
|
@ -47,6 +51,9 @@ public:
|
|||
int closeWiredNetworkWithDevice(QString deviceName);
|
||||
int openWiredNetworkWithDevice(QString deviceName);
|
||||
|
||||
Q_SIGNALS:
|
||||
void wiredEnabledChanged(bool);
|
||||
|
||||
private:
|
||||
void getActiveConnection(QString &deviceName, QString &connectUuid);
|
||||
void saveActiveConnection(QString &deviceName, QString &connectUuid);
|
||||
|
|
|
@ -185,7 +185,7 @@ void KyWirelessConnectOperation::addConnect(const KyWirelessConnectSetting &conn
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("create wireless connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->createConnectionError(errorMessage);
|
||||
Q_EMIT this->createConnectionError(errorMessage);
|
||||
} else {
|
||||
qDebug()<<"create wireless connect complete";
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void KyWirelessConnectOperation::addTlsConnect(const KyWirelessConnectSetting &c
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("create wireless tls connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->createConnectionError(errorMessage);
|
||||
Q_EMIT this->createConnectionError(errorMessage);
|
||||
} else {
|
||||
qDebug()<<"create wireless connect complete";
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ void KyWirelessConnectOperation::addPeapConnect(const KyWirelessConnectSetting &
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("create wireless peap connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->createConnectionError(errorMessage);
|
||||
Q_EMIT this->createConnectionError(errorMessage);
|
||||
} else {
|
||||
qDebug()<<"create wireless connect complete";
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ void KyWirelessConnectOperation::addTtlsConnect(const KyWirelessConnectSetting &
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("create wireless ttls connection failed: ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->createConnectionError(errorMessage);
|
||||
Q_EMIT this->createConnectionError(errorMessage);
|
||||
} else {
|
||||
qDebug()<<"create wireless connect complete";
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ void KyWirelessConnectOperation::setWirelessAutoConnect(const QString &uuid, boo
|
|||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + uuid;
|
||||
qWarning()<<errorMessage;
|
||||
emit updateConnectionError(errorMessage);
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
|
@ -391,7 +391,7 @@ void KyWirelessConnectOperation::updateIpv4AndIpv6SettingInfo(const QString &uui
|
|||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + uuid;
|
||||
qWarning()<<errorMessage;
|
||||
emit updateConnectionError(errorMessage);
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
|
@ -408,7 +408,7 @@ void KyWirelessConnectOperation::updateWirelessPersonalConnect(const QString &uu
|
|||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + uuid;
|
||||
qWarning()<<errorMessage;
|
||||
emit updateConnectionError(errorMessage);
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
|
@ -435,7 +435,7 @@ void KyWirelessConnectOperation::updateWirelessEnterPriseTlsConnect(const QStrin
|
|||
if (connectPtr.isNull()) {
|
||||
QString errorMessage = tr("it can not find connection") + uuid;
|
||||
qWarning()<<errorMessage;
|
||||
emit updateConnectionError(errorMessage);
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
|
@ -453,7 +453,7 @@ void KyWirelessConnectOperation::updateWirelessEnterPrisePeapConnect(const QStri
|
|||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + uuid;
|
||||
qWarning()<<errorMessage;
|
||||
emit updateConnectionError(errorMessage);
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
|
@ -471,7 +471,7 @@ void KyWirelessConnectOperation::updateWirelessEnterPriseTtlsConnect(const QStri
|
|||
if (nullptr == connectPtr) {
|
||||
QString errorMessage = tr("it can not find connection") + uuid;
|
||||
qWarning()<<errorMessage;
|
||||
emit updateConnectionError(errorMessage);
|
||||
Q_EMIT updateConnectionError(errorMessage);
|
||||
return;
|
||||
}
|
||||
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||
|
@ -503,7 +503,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessConnect(QString & devIface,
|
|||
|
||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||
if (dev.isNull()) {
|
||||
emit addAndActivateConnectionError("can not find device");
|
||||
Q_EMIT addAndActivateConnectionError("can not find device");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessConnect(QString & devIface,
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = watcher->error().message();
|
||||
qDebug() << "activation of connection failed " << errorMessage;
|
||||
emit addAndActivateConnectionError(errorMessage);
|
||||
Q_EMIT addAndActivateConnectionError(errorMessage);
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
@ -610,7 +610,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapM
|
|||
|
||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||
if (dev.isNull()) {
|
||||
emit addAndActivateConnectionError("can not find device");
|
||||
Q_EMIT addAndActivateConnectionError("can not find device");
|
||||
return;
|
||||
}
|
||||
dev_uni = dev->uni();
|
||||
|
@ -631,7 +631,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapM
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = watcher->error().message();
|
||||
qDebug() << "addAndActiveWirelessEnterPriseTlsConnect failed " << errorMessage;
|
||||
emit addAndActivateConnectionError(errorMessage);
|
||||
Q_EMIT addAndActivateConnectionError(errorMessage);
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
@ -664,7 +664,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPrisePeapConnect(KyEap
|
|||
|
||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||
if (dev.isNull()) {
|
||||
emit addAndActivateConnectionError("can not find device");
|
||||
Q_EMIT addAndActivateConnectionError("can not find device");
|
||||
return;
|
||||
}
|
||||
dev_uni = dev->uni();
|
||||
|
@ -685,7 +685,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPrisePeapConnect(KyEap
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = watcher->error().message();
|
||||
qDebug() << "addAndActiveWirelessEnterPrisePeapConnect failed " << errorMessage;
|
||||
emit addAndActivateConnectionError(errorMessage);
|
||||
Q_EMIT addAndActivateConnectionError(errorMessage);
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
@ -717,7 +717,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEap
|
|||
|
||||
auto dev = m_networkResourceInstance->findDeviceInterface(devIface);
|
||||
if (dev.isNull()) {
|
||||
emit addAndActivateConnectionError("can not find device");
|
||||
Q_EMIT addAndActivateConnectionError("can not find device");
|
||||
return;
|
||||
}
|
||||
dev_uni = dev->uni();
|
||||
|
@ -739,7 +739,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEap
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = watcher->error().message();
|
||||
qDebug() << "addAndActiveWirelessEnterPriseTtlsConnect failed " << errorMessage;
|
||||
emit addAndActivateConnectionError(errorMessage);
|
||||
Q_EMIT addAndActivateConnectionError(errorMessage);
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
@ -748,7 +748,7 @@ void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEap
|
|||
//无线网络开关设置
|
||||
void KyWirelessConnectOperation::setWirelessEnabled(bool enabled)
|
||||
{
|
||||
emit enabledWirelessNetwork(enabled);
|
||||
Q_EMIT enabledWirelessNetwork(enabled);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ void KyWirelessConnectOperation::activeWirelessAp(const QString apUuid, const QS
|
|||
if (devicePtr.isNull()) {
|
||||
QString errorMsg ="Create hotspot faild. " + apDevice + " is not existed";
|
||||
qWarning()<< errorMsg;
|
||||
emit addAndActivateConnectionError(errorMsg);
|
||||
Q_EMIT addAndActivateConnectionError(errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -892,7 +892,7 @@ void KyWirelessConnectOperation::activeWirelessAp(const QString apUuid, const QS
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMsg = "Create hotspot faild. " + watcher->error().message();
|
||||
qWarning() << errorMsg;
|
||||
emit addAndActivateConnectionError(errorMsg);
|
||||
Q_EMIT addAndActivateConnectionError(errorMsg);
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
|
@ -1032,7 +1032,7 @@ void KyWirelessConnectOperation::activateApConnectionByUuid(const QString apUuid
|
|||
if (watcher->isError() || !watcher->isValid()) {
|
||||
QString errorMessage = tr("Create hotspot faild. ") + watcher->error().message();
|
||||
qWarning()<<errorMessage;
|
||||
emit this->activateConnectionError(errorMessage);
|
||||
Q_EMIT this->activateConnectionError(errorMessage);
|
||||
} else {
|
||||
qWarning()<<"active wired connect complete.";
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ private:
|
|||
const QString apDevice,
|
||||
const QString wirelessBand);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void wifiEnabledChanged(bool);
|
||||
void enabledWirelessNetwork(bool enabled);
|
||||
void addAndActivateConnectionError(QString errorMessage);
|
||||
|
|
|
@ -406,7 +406,7 @@ void KyWirelessNetResource::onWifiNetworkAdded(QString devIfaceName, QString ssi
|
|||
m_WifiNetworkList.insert(devIfaceName,list);
|
||||
}
|
||||
|
||||
emit wifiNetworkAdd(devIfaceName, item);
|
||||
Q_EMIT wifiNetworkAdd(devIfaceName, item);
|
||||
}
|
||||
|
||||
void KyWirelessNetResource::onWifiNetworkRemoved(QString devIfaceName, QString ssid)
|
||||
|
@ -422,7 +422,7 @@ void KyWirelessNetResource::onWifiNetworkRemoved(QString devIfaceName, QString s
|
|||
if (m_WifiNetworkList.value(devIfaceName).isEmpty()) {
|
||||
m_WifiNetworkList.remove(devIfaceName);
|
||||
}
|
||||
emit wifiNetworkRemove(devIfaceName,ssid);
|
||||
Q_EMIT wifiNetworkRemove(devIfaceName,ssid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,12 +448,12 @@ void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::Wireless
|
|||
// qDebug()<< LOG_FLAG <<"recive properity changed signal, sender is" << iter->m_NetSsid;
|
||||
if (iter->m_signalStrength != net->signalStrength()) {
|
||||
iter->m_signalStrength = net->signalStrength();
|
||||
emit signalStrengthChange(devIface, wifiSsid, iter->m_signalStrength);
|
||||
Q_EMIT signalStrengthChange(devIface, wifiSsid, iter->m_signalStrength);
|
||||
}
|
||||
|
||||
if (iter->m_bssid != accessPointPtr->hardwareAddress()) {
|
||||
iter->m_bssid = accessPointPtr->hardwareAddress();
|
||||
emit bssidChange(devIface, wifiSsid, iter->m_bssid);
|
||||
Q_EMIT bssidChange(devIface, wifiSsid, iter->m_bssid);
|
||||
}
|
||||
|
||||
QString secuType = enumToQstring(accessPointPtr->capabilities(),
|
||||
|
@ -461,7 +461,7 @@ void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::Wireless
|
|||
accessPointPtr->rsnFlags());
|
||||
if (iter->m_secuType != secuType) {
|
||||
iter->m_secuType = secuType;
|
||||
emit secuTypeChange(devIface, wifiSsid, secuType);
|
||||
Q_EMIT secuTypeChange(devIface, wifiSsid, secuType);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -655,7 +655,7 @@ void KyWirelessNetResource::onConnectionAdd(QString uuid)
|
|||
for(auto var = map.cbegin(); var != map.cend(); var++) {
|
||||
QString devIfaceName = var.key();
|
||||
QString ssid = var.value();
|
||||
emit connectionAdd(devIfaceName, ssid);
|
||||
Q_EMIT connectionAdd(devIfaceName, ssid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +693,7 @@ void KyWirelessNetResource::onConnectionRemove(QString path)
|
|||
for(auto var = map.cbegin(); var != map.cend(); var++) {
|
||||
QString devIfaceName = var.key();
|
||||
QString ssid = var.value();
|
||||
emit connectionRemove(devIfaceName, ssid);
|
||||
Q_EMIT connectionRemove(devIfaceName, ssid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -716,7 +716,7 @@ void KyWirelessNetResource::onConnectionUpdate(QString uuid)
|
|||
|
||||
m_WifiNetworkList.clear();
|
||||
kyWirelessNetItemListInit();
|
||||
emit wifiNetworkUpdate();
|
||||
Q_EMIT wifiNetworkUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
QString getDeviceIFace(NetworkManager::WirelessNetwork::Ptr net);
|
||||
QString getDeviceIFace(NetworkManager::ActiveConnection::Ptr actConn, QString &wirelessNetResourcessid);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void onWifiNetworkAdded(QString, QString);
|
||||
void onWifiNetworkRemoved(QString, QString);
|
||||
void onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
|
||||
|
@ -74,7 +74,7 @@ public slots:
|
|||
void onDeviceRemove(QString deviceName);
|
||||
void onDeviceNameUpdate(QString oldName, QString newName);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void signalStrengthChange(QString, QString, int);
|
||||
void bssidChange(QString, QString, QString);
|
||||
void secuTypeChange(QString, QString, QString);
|
||||
|
|
|
@ -95,7 +95,6 @@ void DbusAdaptor::setWirelessSwitchEnable(bool enable)
|
|||
void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
|
||||
{
|
||||
parent()->setWiredDeviceEnable(devName, enable);
|
||||
saveDeviceEnableState(devName, enable);
|
||||
}
|
||||
|
||||
//设置默认网卡
|
||||
|
|
|
@ -85,7 +85,7 @@ void DlgHotspotCreate::mouseMoveEvent(QMouseEvent *event){
|
|||
void DlgHotspotCreate::on_btnCancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
emit btnHotspotState();
|
||||
Q_EMIT btnHotspotState();
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::on_btnOk_clicked()
|
||||
|
@ -101,7 +101,7 @@ void DlgHotspotCreate::on_btnOk_clicked()
|
|||
Utils::m_system(str.toUtf8().data());
|
||||
|
||||
this->close();
|
||||
emit updateHotspotList();
|
||||
Q_EMIT updateHotspotList();
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::on_checkBoxPwd_stateChanged(int arg1)
|
||||
|
|
|
@ -35,10 +35,10 @@ public:
|
|||
explicit DlgHotspotCreate(QString wiFiCardName, QWidget *parent = nullptr);
|
||||
~DlgHotspotCreate();
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void changeDialog();
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void on_btnCancel_clicked();
|
||||
|
||||
void on_btnOk_clicked();
|
||||
|
@ -61,7 +61,7 @@ private:
|
|||
QPoint winPos;
|
||||
QPoint dragPos;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void updateHotspotList();
|
||||
void btnHotspotState();
|
||||
};
|
||||
|
|
|
@ -41,11 +41,11 @@ public:
|
|||
private:
|
||||
// QString m_name;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// Q_SCRIPTABLE void nameChanged(QString);
|
||||
// Q_SCRIPTABLE void computerinfo(QString);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
|
||||
Q_SCRIPTABLE void systemRun(QString cmd);
|
||||
Q_SCRIPTABLE QStringList getWifiInfo(QString wifiName);
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
|
||||
static int m_system(char *cmd);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void onRequestSendDesktopNotify(QString message);
|
||||
|
||||
};
|
||||
|
|
|
@ -66,7 +66,7 @@ EnterpriseWlanDialog::~EnterpriseWlanDialog() {
|
|||
|
||||
void EnterpriseWlanDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
emit this->enterpriseWlanDialogClose(false);
|
||||
Q_EMIT this->enterpriseWlanDialogClose(false);
|
||||
return QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,12 +72,12 @@ private:
|
|||
QPushButton *m_cancelBtn = nullptr;
|
||||
QPushButton *m_connectBtn = nullptr;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onBtnConnectClicked();
|
||||
void onEapTypeChanged(const KyEapMethodType &type);
|
||||
void onPaletteChanged();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void enterpriseWlanDialogClose(bool);
|
||||
};
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void LanListItem::onInfoButtonClicked()
|
|||
});
|
||||
|
||||
netDetail->show();
|
||||
emit this->detailShow(true);
|
||||
Q_EMIT this->detailShow(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
private:
|
||||
void connectItemCopy(const KyConnectItem *lanConnectItem);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onInfoButtonClicked();
|
||||
void onNetButtonClicked();
|
||||
void onMenuTriggered(QAction *action);
|
||||
|
|
|
@ -75,12 +75,12 @@ private:
|
|||
void initUI();
|
||||
void initConnection();
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
virtual void onNetButtonClicked() = 0;
|
||||
void onPaletteChanged();
|
||||
virtual void onMenuTriggered(QAction *action)=0;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void detailShow(bool isShow);
|
||||
};
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ void WlanListItem::setExpanded(const bool &expanded)
|
|||
setFixedHeight(NORMAL_HEIGHT);
|
||||
}
|
||||
|
||||
emit this->itemHeightChanged(expanded, m_wirelessNetItem.m_NetSsid);
|
||||
Q_EMIT this->itemHeightChanged(expanded, m_wirelessNetItem.m_NetSsid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void WlanListItem::onInfoButtonClicked()
|
|||
}
|
||||
});
|
||||
netDetail->show();
|
||||
emit this->detailShow(true);
|
||||
Q_EMIT this->detailShow(true);
|
||||
}
|
||||
|
||||
void WlanListItem::onNetButtonClicked()
|
||||
|
|
|
@ -84,7 +84,7 @@ protected:
|
|||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void itemHeightChanged(const bool isExpanded, const QString &ssid);
|
||||
|
||||
private:
|
||||
|
@ -120,10 +120,10 @@ private:
|
|||
bool m_forgetConnection = false;
|
||||
bool m_isApMode = false;
|
||||
|
||||
protected slots:
|
||||
protected Q_SLOTS:
|
||||
void onInfoButtonClicked();
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onNetButtonClicked();
|
||||
void onPwdEditorTextChanged();
|
||||
void onConnectButtonClicked();
|
||||
|
|
|
@ -32,7 +32,7 @@ WlanMoreItem::~WlanMoreItem() {
|
|||
}
|
||||
|
||||
void WlanMoreItem::onNetButtonClicked() {
|
||||
emit hiddenWlanClicked();
|
||||
Q_EMIT hiddenWlanClicked();
|
||||
}
|
||||
|
||||
void WlanMoreItem::onRightButtonClicked() {
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
void onNetButtonClicked();
|
||||
void onMenuTriggered(QAction *action);
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void hiddenWlanClicked();
|
||||
};
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void MainWindow::showMainwindow()
|
|||
this->showByWaylandHelper();
|
||||
this->raise();
|
||||
this->activateWindow();
|
||||
emit this->mainWindowVisibleChanged(true);
|
||||
Q_EMIT this->mainWindowVisibleChanged(true);
|
||||
#ifdef WITHKYSEC
|
||||
if (!kysec_is_disabled() && kysec_get_3adm_status() && (getuid() || geteuid())){
|
||||
if (nullptr != m_wlanWidget) {
|
||||
|
@ -105,7 +105,7 @@ void MainWindow::showMainwindow()
|
|||
void MainWindow::hideMainwindow()
|
||||
{
|
||||
this->hide();
|
||||
emit this->mainWindowVisibleChanged(false);
|
||||
Q_EMIT this->mainWindowVisibleChanged(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -476,12 +476,12 @@ void MainWindow::resetWindowTheme()
|
|||
if(currentTheme == "ukui-dark" || currentTheme == "ukui-black"){
|
||||
app->setStyle(new CustomStyle("ukui-dark"));
|
||||
qDebug() << "Has set color theme to ukui-dark." << Q_FUNC_INFO << __LINE__;
|
||||
emit qApp->paletteChanged(qApp->palette());
|
||||
Q_EMIT qApp->paletteChanged(qApp->palette());
|
||||
return;
|
||||
}
|
||||
app->setStyle(new CustomStyle("ukui-light"));
|
||||
qDebug() << "Has set color theme to " << currentTheme << Q_FUNC_INFO << __LINE__;
|
||||
emit qApp->paletteChanged(qApp->palette());
|
||||
Q_EMIT qApp->paletteChanged(qApp->palette());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -558,7 +558,7 @@ void MainWindow::onThemeChanged(const QString &key)
|
|||
qDebug() << "Received signal of theme changed, will reset theme." << Q_FUNC_INFO << __LINE__;
|
||||
// resetWindowTheme();
|
||||
paintWithTrans();
|
||||
emit qApp->paletteChanged(qApp->palette());
|
||||
Q_EMIT qApp->paletteChanged(qApp->palette());
|
||||
} else {
|
||||
qDebug() << "Received signal of theme changed, key=" << key << " will do nothing." << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
|||
{
|
||||
if (event->type() == QEvent::ActivationChange) {
|
||||
if(QApplication::activeWindow() != this) {
|
||||
hideMainwindow();
|
||||
// hideMainwindow();
|
||||
}
|
||||
}
|
||||
return QMainWindow::eventFilter(watched,event);
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
void keyRingInit();
|
||||
void keyRingClear();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
//设备插拔
|
||||
void deviceStatusChanged();
|
||||
//设备名称变化
|
||||
|
@ -131,7 +131,7 @@ signals:
|
|||
void mainWindowVisibleChanged(const bool &visible);
|
||||
//列表排序
|
||||
void timeToUpdate();
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
@ -195,10 +195,10 @@ private:
|
|||
// QMap<QString, NetDetail*> m_addOtherPagePtrMap;
|
||||
QMap<QString, JoinHiddenWiFiPage*> m_addOtherPagePtrMap;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void onShowMainWindow(int type);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onTransChanged();
|
||||
void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
void onShowMainwindowActionTriggled();
|
||||
|
|
|
@ -55,10 +55,10 @@ private:
|
|||
KBorderlessButton *m_congigBtn = nullptr;
|
||||
QVBoxLayout *m_vBoxLayout = nullptr;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onConfigButtonClicked();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void publicConfig();
|
||||
void privateConfig();
|
||||
};
|
||||
|
|
|
@ -164,7 +164,7 @@ void CreatNetPage::setLineEnabled(bool check) {
|
|||
}
|
||||
|
||||
void CreatNetPage::setEnableOfSaveBtn() {
|
||||
emit setCreatePageState(checkConnectBtnIsEnabled());
|
||||
Q_EMIT setCreatePageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
bool CreatNetPage::getTextEditState(QString text)
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
bool netMaskIsValide(QString text);
|
||||
QString getNetMaskText(QString text);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void setEnableOfSaveBtn();
|
||||
void configChanged(int index);
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -309,7 +309,7 @@ void DetailPage::setEnableOfSaveBtn() {
|
|||
if (m_IsCreate) {
|
||||
saveEnable = !m_SSIDEdit->text().isEmpty();
|
||||
}
|
||||
emit setDetailPageState(saveEnable);
|
||||
Q_EMIT setDetailPageState(saveEnable);
|
||||
}
|
||||
|
||||
//获取列表信息
|
||||
|
|
|
@ -111,11 +111,11 @@ private:
|
|||
QString m_formerSSID;
|
||||
QString m_formerIPV6;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void setEnableOfSaveBtn();
|
||||
void on_btnCopyNetDetail_clicked();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void setDetailPageState(bool);
|
||||
|
||||
};
|
||||
|
|
|
@ -58,8 +58,6 @@ private:
|
|||
|
||||
void initUI();
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // DetailWidget_H
|
||||
|
|
|
@ -320,7 +320,7 @@ void Ipv4Page::setLineEnabled(bool check) {
|
|||
}
|
||||
|
||||
void Ipv4Page::setEnableOfSaveBtn() {
|
||||
emit setIpv4PageState(checkConnectBtnIsEnabled());
|
||||
Q_EMIT setIpv4PageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
bool Ipv4Page::getTextEditState(QString text)
|
||||
|
|
|
@ -82,7 +82,7 @@ private:
|
|||
bool checkConnectBtnIsEnabled();
|
||||
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void setEnableOfSaveBtn();
|
||||
void configChanged(int index);
|
||||
void onAddressTextChanged();
|
||||
|
|
|
@ -253,7 +253,7 @@ void Ipv6Page::setControlEnabled(bool check)
|
|||
|
||||
void Ipv6Page::setEnableOfSaveBtn()
|
||||
{
|
||||
emit setIpv6PageState(checkConnectBtnIsEnabled());
|
||||
Q_EMIT setIpv6PageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
void Ipv6Page::onAddressTextChanged()
|
||||
|
|
|
@ -80,13 +80,13 @@ private:
|
|||
|
||||
bool checkConnectBtnIsEnabled();
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void configChanged(int index);
|
||||
void setEnableOfSaveBtn();
|
||||
void onAddressTextChanged();
|
||||
void onGatewayTextChanged();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void setIpv6PageState(bool);
|
||||
};
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ JoinHiddenWiFiPage::~JoinHiddenWiFiPage()
|
|||
|
||||
void JoinHiddenWiFiPage::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
emit this->hiddenWiFiPageClose(m_devName);
|
||||
Q_EMIT this->hiddenWiFiPageClose(m_devName);
|
||||
return QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ void JoinHiddenWiFiPage::onBtnJoinClicked()
|
|||
|
||||
void JoinHiddenWiFiPage::onBtnShowListClicked()
|
||||
{
|
||||
emit showWlanList(1); //WLAN_PAGE_INDEX
|
||||
Q_EMIT showWlanList(1); //WLAN_PAGE_INDEX
|
||||
}
|
||||
|
||||
void JoinHiddenWiFiPage::onSecuTypeChanged(const KySecuType &type)
|
||||
|
|
|
@ -84,13 +84,13 @@ private:
|
|||
bool m_isSecuOk = false;
|
||||
ConInfo m_info;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onBtnJoinClicked();
|
||||
void onBtnShowListClicked();
|
||||
void onSecuTypeChanged(const KySecuType &type);
|
||||
void onEapTypeChanged(const KyEapMethodType &type);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void hiddenWiFiPageClose(QString);
|
||||
void showWlanList(int type);
|
||||
};
|
||||
|
|
|
@ -221,8 +221,8 @@ void NetDetail::paintEvent(QPaintEvent *event)
|
|||
|
||||
void NetDetail::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
emit this->detailPageClose(false);
|
||||
emit this->createPageClose(m_deviceName);
|
||||
Q_EMIT this->detailPageClose(false);
|
||||
Q_EMIT this->createPageClose(m_deviceName);
|
||||
return QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ bool NetDetail::eventFilter(QObject *w, QEvent *event)
|
|||
QKeyEvent *mEvent = static_cast<QKeyEvent *>(event);
|
||||
if (mEvent->key() == Qt::Key_Enter || mEvent->key() == Qt::Key_Return) {
|
||||
if (confimBtn->isEnabled()) {
|
||||
emit confimBtn->clicked();
|
||||
Q_EMIT confimBtn->clicked();
|
||||
}
|
||||
return true;
|
||||
} else if (mEvent->key() == Qt::Key_Escape) {
|
||||
|
|
|
@ -159,15 +159,15 @@ private:
|
|||
|
||||
ConInfo m_info;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void on_btnConfirm_clicked();
|
||||
void on_btnForget_clicked();
|
||||
void onPaletteChanged();
|
||||
|
||||
protected slots:
|
||||
protected Q_SLOTS:
|
||||
void currentRowChangeSlot(int row);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void detailPageClose(bool on);
|
||||
void createPageClose(QString);
|
||||
void currentChanged(int);
|
||||
|
|
|
@ -720,7 +720,7 @@ bool SecurityPage::checkConnectBtnIsEnabled()
|
|||
|
||||
void SecurityPage::setEnableOfSaveBtn()
|
||||
{
|
||||
emit setSecuPageState(checkConnectBtnIsEnabled());
|
||||
Q_EMIT setSecuPageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
void SecurityPage::onSecuTypeComboxIndexChanged()
|
||||
|
@ -728,17 +728,17 @@ void SecurityPage::onSecuTypeComboxIndexChanged()
|
|||
int index = secuTypeCombox->currentData().toInt();
|
||||
if (index == WPA_AND_WPA2_PERSONAL) {
|
||||
showPsk();
|
||||
emit this->secuTypeChanged(WPA_AND_WPA2_PERSONAL);
|
||||
Q_EMIT this->secuTypeChanged(WPA_AND_WPA2_PERSONAL);
|
||||
}
|
||||
else if (index == WPA3_PERSONAL) {
|
||||
showPsk();
|
||||
emit this->secuTypeChanged(WPA3_PERSONAL);
|
||||
Q_EMIT this->secuTypeChanged(WPA3_PERSONAL);
|
||||
} else if (index == WPA_AND_WPA2_ENTERPRISE) {
|
||||
onEapTypeComboxIndexChanged();
|
||||
emit this->secuTypeChanged(WPA_AND_WPA2_ENTERPRISE);
|
||||
Q_EMIT this->secuTypeChanged(WPA_AND_WPA2_ENTERPRISE);
|
||||
} else if (index == NONE) {
|
||||
showNone();
|
||||
emit this->secuTypeChanged(NONE);
|
||||
Q_EMIT this->secuTypeChanged(NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -748,14 +748,14 @@ void SecurityPage::onEapTypeComboxIndexChanged()
|
|||
int index = eapTypeCombox->currentData().toInt();
|
||||
if (index == TLS) {
|
||||
showTls();
|
||||
emit this->eapTypeChanged(TLS);
|
||||
Q_EMIT this->eapTypeChanged(TLS);
|
||||
} else if (index == PEAP) {
|
||||
showPeapOrTtls();
|
||||
eapMethodCombox->clear();
|
||||
eapMethodCombox->addItem("MSCHAPv2", MSCHAPV2_PEAP);
|
||||
eapMethodCombox->addItem("MD5", MD5_PEAP);
|
||||
eapMethodCombox->addItem("GTC", GTC_PEAP);
|
||||
emit this->eapTypeChanged(PEAP);
|
||||
Q_EMIT this->eapTypeChanged(PEAP);
|
||||
} else if (index == TTLS) {
|
||||
showPeapOrTtls();
|
||||
eapMethodCombox->clear();
|
||||
|
@ -766,7 +766,7 @@ void SecurityPage::onEapTypeComboxIndexChanged()
|
|||
eapMethodCombox->addItem("chap", CHAP);
|
||||
eapMethodCombox->addItem("md5(eap)", MD5_EAP);
|
||||
eapMethodCombox->addItem("gtc(eap)", GTC_EAP);
|
||||
emit this->eapTypeChanged(TTLS);
|
||||
Q_EMIT this->eapTypeChanged(TTLS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ private:
|
|||
bool checkConnectBtnIsEnabled();
|
||||
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onSecuTypeComboxIndexChanged();
|
||||
void onEapTypeComboxIndexChanged();
|
||||
void setEnableOfSaveBtn();
|
||||
|
@ -131,7 +131,7 @@ private slots:
|
|||
void onPwdOptionComboxIndexChanged(QString str);
|
||||
void changeColumnWidthWithSecuType();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void setSecuPageState(bool);
|
||||
void secuTypeChanged(const KySecuType &type);
|
||||
void eapTypeChanged(const KyEapMethodType &type);
|
||||
|
|
|
@ -46,7 +46,7 @@ private:
|
|||
QPushButton *m_YesBtn = nullptr;
|
||||
QPushButton *m_NoBtn = nullptr;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void setPublicNetMode();
|
||||
void setPrivateNetMode();
|
||||
};
|
||||
|
|
|
@ -68,10 +68,11 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
|
|||
|
||||
connect(m_deviceResource, &KyNetworkDeviceResourse::carrierChanage, this, &LanPage::onDeviceCarriered);
|
||||
connect(m_deviceResource, &KyNetworkDeviceResourse::deviceActiveChanage, this, &LanPage::onDeviceActiveChanage);
|
||||
connect(m_deviceResource, &KyNetworkDeviceResourse::deviceManagedChange, this, &LanPage::onDeviceManagedChange);
|
||||
|
||||
connect(m_wiredConnectOperation, &KyWiredConnectOperation::activateConnectionError, this, &LanPage::activateFailed);
|
||||
connect(m_wiredConnectOperation, &KyWiredConnectOperation::deactivateConnectionError, this, &LanPage::deactivateFailed);
|
||||
|
||||
connect(m_wiredConnectOperation, &KyWiredConnectOperation::wiredEnabledChanged, this, &LanPage::onWiredEnabledChanged);
|
||||
}
|
||||
|
||||
LanPage::~LanPage()
|
||||
|
@ -119,43 +120,22 @@ void LanPage::initLanDevice()
|
|||
|
||||
void LanPage::initLanDeviceState()
|
||||
{
|
||||
QMap<QString, bool> deviceStateMap;
|
||||
getDeviceEnableState(WIRED, deviceStateMap);
|
||||
|
||||
QStringList disableDeviceList;
|
||||
disableDeviceList.clear();
|
||||
m_disableDeviceList.clear();
|
||||
m_enableDeviceList.clear();
|
||||
for (int index = 0; index < m_devList.count(); ++index) {
|
||||
QString deviceName = m_devList.at(index);
|
||||
if (deviceStateMap.contains(deviceName)) {
|
||||
if (deviceStateMap[deviceName]) {
|
||||
m_enableDeviceList<<deviceName;
|
||||
} else {
|
||||
disableDeviceList<<deviceName;
|
||||
}
|
||||
} else {
|
||||
saveDeviceEnableState(deviceName, true);
|
||||
if (m_deviceResource->getDeviceManaged(deviceName)) {
|
||||
m_enableDeviceList<<deviceName;
|
||||
} else {
|
||||
m_disableDeviceList<<deviceName;
|
||||
}
|
||||
}
|
||||
|
||||
KyWiredConnectOperation wiredOperation;
|
||||
if (m_netSwitch->isChecked()) {
|
||||
for (int index = 0; index < disableDeviceList.count(); ++index) {
|
||||
wiredOperation.closeWiredNetworkWithDevice(disableDeviceList.at(index));
|
||||
}
|
||||
} else {
|
||||
for (int index = 0; index < m_devList.count(); ++index) {
|
||||
wiredOperation.closeWiredNetworkWithDevice(m_devList.at(index));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void LanPage::initNetSwitch()
|
||||
{
|
||||
bool wiredSwitch = true;
|
||||
bool wiredEnable = m_wiredConnectOperation->getWiredEnabled();
|
||||
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
|
@ -167,17 +147,19 @@ void LanPage::initNetSwitch()
|
|||
qDebug()<<"[LanPage] org.ukui.kylin-nm.switch is not installed!";
|
||||
}
|
||||
|
||||
if (wiredSwitch != wiredEnable) {
|
||||
m_switchGsettings->set(WIRED_SWITCH, wiredEnable);
|
||||
}
|
||||
|
||||
if (m_devList.count() == 0) {
|
||||
qDebug() << "[wiredSwitch]:init not enable when no device";
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
}
|
||||
|
||||
qDebug() << "[wiredSwitch]:init state:" << wiredSwitch;
|
||||
qDebug() << "[wiredSwitch]:init state:" << wiredEnable;
|
||||
|
||||
m_netSwitch->setChecked(wiredSwitch);
|
||||
|
||||
return;
|
||||
m_netSwitch->setChecked(wiredEnable);
|
||||
}
|
||||
|
||||
void LanPage::onSwithGsettingsChanged(const QString &key)
|
||||
|
@ -187,25 +169,14 @@ void LanPage::onSwithGsettingsChanged(const QString &key)
|
|||
bool wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool();
|
||||
qDebug()<<"[LanPage] SwitchButton statue changed to:" << wiredSwitch << m_netSwitch->isChecked();
|
||||
|
||||
if (wiredSwitch == m_netSwitch->isChecked()) {
|
||||
if (wiredSwitch != m_wiredConnectOperation->getWiredEnabled()) {
|
||||
m_wiredConnectOperation->setWiredEnabled(wiredSwitch);
|
||||
return;
|
||||
}
|
||||
|
||||
KyWiredConnectOperation wiredOperation;
|
||||
if (wiredSwitch) {
|
||||
for (int index = 0; index < m_enableDeviceList.size(); ++index) {
|
||||
qDebug()<<"[LanPage] open wired device "<< m_enableDeviceList.at(index);
|
||||
wiredOperation.openWiredNetworkWithDevice(m_enableDeviceList.at(index));
|
||||
}
|
||||
} else {
|
||||
for (int index = 0; index < m_enableDeviceList.size(); ++index) {
|
||||
qDebug()<<"[LanPage] close wired device "<< m_enableDeviceList.at(index);
|
||||
wiredOperation.closeWiredNetworkWithDevice(m_enableDeviceList.at(index));
|
||||
}
|
||||
}
|
||||
|
||||
m_netSwitch->setChecked(wiredSwitch);
|
||||
|
||||
initLanDeviceState();
|
||||
initDeviceCombox();
|
||||
initLanArea();
|
||||
}
|
||||
|
@ -213,49 +184,30 @@ void LanPage::onSwithGsettingsChanged(const QString &key)
|
|||
|
||||
void LanPage::getEnabledDevice(QStringList &enableDeviceList)
|
||||
{
|
||||
int index = 0;
|
||||
QMap<QString, bool> deviceMap;
|
||||
|
||||
if (m_devList.isEmpty()) {
|
||||
qDebug()<<"[LanPage] there is not wired device.";
|
||||
return;
|
||||
}
|
||||
|
||||
getDeviceEnableState(WIRED, deviceMap);
|
||||
for (index = 0; index < m_devList.size(); ++index) {
|
||||
if (deviceMap.contains(m_devList.at(index))) {
|
||||
if (deviceMap[m_devList.at(index)]) {
|
||||
enableDeviceList << m_devList.at(index);
|
||||
}
|
||||
} else {
|
||||
saveDeviceEnableState(m_devList.at(index), true);
|
||||
for (int index = 0; index < m_devList.size(); ++index) {
|
||||
if (m_deviceResource->getDeviceManaged(m_devList.at(index))) {
|
||||
enableDeviceList << m_devList.at(index);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void LanPage::getDisabledDevices(QStringList &disableDeviceList)
|
||||
{
|
||||
int index = 0;
|
||||
QMap<QString, bool> deviceMap;
|
||||
|
||||
if (m_devList.isEmpty()) {
|
||||
qDebug()<<"[LanPage] there is not wired device.";
|
||||
return;
|
||||
}
|
||||
|
||||
getDeviceEnableState(WIRED, deviceMap);
|
||||
for (index = 0; index < m_devList.size(); ++index) {
|
||||
if (deviceMap.contains(m_devList.at(index))) {
|
||||
if (!deviceMap[m_devList.at(index)]) {
|
||||
disableDeviceList << m_devList.at(index);
|
||||
}
|
||||
for (int index = 0; index < m_devList.size(); ++index) {
|
||||
if (!m_deviceResource->getDeviceManaged(m_devList.at(index))) {
|
||||
disableDeviceList << m_devList.at(index);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void LanPage::initDeviceCombox()
|
||||
|
@ -300,13 +252,11 @@ void LanPage::initDeviceCombox()
|
|||
} else {
|
||||
m_deviceFrame->hide();
|
||||
m_currentDeviceName = "";
|
||||
|
||||
}
|
||||
|
||||
setDefaultDevice(WIRED, m_currentDeviceName);
|
||||
connect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &LanPage::onDeviceComboxIndexChanged);
|
||||
return;
|
||||
}
|
||||
|
||||
void LanPage::addEmptyConnectItem(QMap<QString, QListWidgetItem *> &connectMap,
|
||||
|
@ -314,8 +264,6 @@ void LanPage::addEmptyConnectItem(QMap<QString, QListWidgetItem *> &connectMap,
|
|||
{
|
||||
QListWidgetItem *p_listWidgetItem = addNewItem(nullptr, lanListWidget);
|
||||
connectMap.insert(EMPTY_CONNECT_UUID, p_listWidgetItem);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -475,8 +423,8 @@ bool LanPage::removeConnectionItem(QMap<QString, QListWidgetItem *> &connectMap,
|
|||
void LanPage::onRemoveConnection(QString path) //删除时后端会自动断开激活,将其从未激活列表中删除
|
||||
{
|
||||
//for dbus
|
||||
qDebug() << "[LanPage] emit lanRemove because onRemoveConnection " << path;
|
||||
emit lanRemove(path);
|
||||
qDebug() << "[LanPage] Q_EMIT lanRemove because onRemoveConnection " << path;
|
||||
Q_EMIT lanRemove(path);
|
||||
|
||||
if (removeConnectionItem(m_inactiveConnectionMap, m_inactivatedLanListWidget, path)) {
|
||||
return;
|
||||
|
@ -518,7 +466,6 @@ void LanPage::onAddConnection(QString uuid) //新增一个有线
|
|||
if (m_inactivatedLanListWidget->count() >= MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MAX_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void LanPage::addDeviceForCombox(QString deviceName)
|
||||
|
@ -550,7 +497,6 @@ void LanPage::addDeviceForCombox(QString deviceName)
|
|||
|
||||
connect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &LanPage::onDeviceComboxIndexChanged);
|
||||
return;
|
||||
}
|
||||
|
||||
void LanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType)
|
||||
|
@ -572,17 +518,17 @@ void LanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devic
|
|||
qDebug() << "[LanPage] Begin add device:" << deviceName;
|
||||
|
||||
m_devList << deviceName;
|
||||
saveDeviceEnableState(deviceName, true);
|
||||
m_enableDeviceList<<deviceName;
|
||||
|
||||
addDeviceForCombox(deviceName);
|
||||
if (m_currentDeviceName == deviceName) {
|
||||
initLanArea();
|
||||
if (m_deviceResource->getDeviceManaged(deviceName)) {
|
||||
m_enableDeviceList << deviceName;
|
||||
addDeviceForCombox(deviceName);
|
||||
if (m_currentDeviceName == deviceName) {
|
||||
initLanArea();
|
||||
}
|
||||
} else {
|
||||
m_disableDeviceList << deviceName;
|
||||
}
|
||||
|
||||
emit deviceStatusChanged();
|
||||
|
||||
return;
|
||||
Q_EMIT deviceStatusChanged();
|
||||
}
|
||||
|
||||
void LanPage::deleteDeviceFromCombox(QString deviceName)
|
||||
|
@ -664,11 +610,11 @@ void LanPage::onDeviceRemove(QString deviceName)
|
|||
if (m_enableDeviceList.contains(deviceName)) {
|
||||
m_enableDeviceList.removeOne(deviceName);
|
||||
}
|
||||
deleteDeviceEnableState(deviceName);
|
||||
if (m_disableDeviceList.contains(deviceName)) {
|
||||
m_disableDeviceList.removeOne(deviceName);
|
||||
}
|
||||
|
||||
emit deviceStatusChanged();
|
||||
|
||||
return;
|
||||
Q_EMIT deviceStatusChanged();
|
||||
}
|
||||
|
||||
void LanPage::updateDeviceCombox(QString oldDeviceName, QString newDeviceName)
|
||||
|
@ -695,15 +641,18 @@ void LanPage::onDeviceNameUpdate(QString oldName, QString newName)
|
|||
if (m_enableDeviceList.contains(oldName)) {
|
||||
m_enableDeviceList.removeOne(oldName);
|
||||
m_enableDeviceList.append(newName);
|
||||
} else if (m_disableDeviceList.contains(oldName)) {
|
||||
m_disableDeviceList.removeOne(oldName);
|
||||
m_disableDeviceList.append(newName);
|
||||
}
|
||||
qDebug() << "[LanPage] emit deviceNameUpdate " << oldName << newName;
|
||||
qDebug() << "[LanPage] Q_EMIT deviceNameUpdate " << oldName << newName;
|
||||
|
||||
updateDeviceCombox(oldName, newName);
|
||||
if (m_currentDeviceName == newName) {
|
||||
initLanArea();
|
||||
}
|
||||
|
||||
emit deviceNameChanged(oldName, newName, WIRED);
|
||||
Q_EMIT deviceNameChanged(oldName, newName, WIRED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -713,26 +662,32 @@ void LanPage::onDeviceCarriered(QString deviceName, bool pluged)
|
|||
return;
|
||||
}
|
||||
if (m_enableDeviceList.contains(deviceName)) {
|
||||
m_wiredConnectOperation->openWiredNetworkWithDevice(deviceName);
|
||||
updateCurrentDevice(deviceName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void LanPage::onDeviceActiveChanage(QString deviceName, bool deviceActive)
|
||||
{
|
||||
if (!m_devList.contains(deviceName)) {
|
||||
return;
|
||||
}
|
||||
// if (!m_devList.contains(deviceName)) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (deviceActive) {
|
||||
if (!m_netSwitch->isChecked() || !m_enableDeviceList.contains(deviceName)) {
|
||||
qDebug()<< LOG_FLAG << "close disabled device";
|
||||
m_wiredConnectOperation->closeWiredNetworkWithDevice(deviceName);
|
||||
}
|
||||
}
|
||||
// if (deviceActive) {
|
||||
// if (!m_netSwitch->isChecked() || !m_enableDeviceList.contains(deviceName)) {
|
||||
// qDebug()<< LOG_FLAG << "close disabled device";
|
||||
// m_wiredConnectOperation->closeWiredNetworkWithDevice(deviceName);
|
||||
// }
|
||||
// }
|
||||
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
void LanPage::onDeviceManagedChange(QString deviceName, bool managed)
|
||||
{
|
||||
initLanDeviceState();
|
||||
initDeviceCombox();
|
||||
initLanArea();
|
||||
Q_EMIT deviceStatusChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -998,7 +953,7 @@ void LanPage::onConnectionStateChange(QString uuid,
|
|||
}
|
||||
}
|
||||
|
||||
emit lanActiveConnectionStateChanged(deviceName, uuid, state);
|
||||
Q_EMIT lanActiveConnectionStateChanged(deviceName, uuid, state);
|
||||
|
||||
if (p_newItem) {
|
||||
delete p_newItem;
|
||||
|
@ -1017,7 +972,7 @@ void LanPage::getWiredList(QMap<QString, QVector<QStringList> > &map)
|
|||
return;
|
||||
}
|
||||
|
||||
foreach (auto deviceName, devlist) {
|
||||
Q_FOREACH (auto deviceName, devlist) {
|
||||
QList<KyConnectItem *> activedList;
|
||||
QList<KyConnectItem *> deactivedList;
|
||||
QVector<QStringList> vector;
|
||||
|
@ -1043,7 +998,7 @@ void LanPage::sendLanUpdateSignal(KyConnectItem *p_connectItem)
|
|||
{
|
||||
QStringList info;
|
||||
info << p_connectItem->m_connectName << p_connectItem->m_connectUuid << p_connectItem->m_connectPath;
|
||||
emit lanUpdate(p_connectItem->m_ifaceName, info);
|
||||
Q_EMIT lanUpdate(p_connectItem->m_ifaceName, info);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1052,8 +1007,8 @@ void LanPage::sendLanAddSignal(KyConnectItem *p_connectItem)
|
|||
{
|
||||
QStringList info;
|
||||
info << p_connectItem->m_connectName << p_connectItem->m_connectUuid << p_connectItem->m_connectPath;
|
||||
qDebug() << "[LanPage] emit lanAdd because addConnection ";
|
||||
emit lanAdd(p_connectItem->m_ifaceName, info);
|
||||
qDebug() << "[LanPage] Q_EMIT lanAdd because addConnection ";
|
||||
Q_EMIT lanAdd(p_connectItem->m_ifaceName, info);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1066,7 +1021,7 @@ void LanPage::sendLanStateChangeSignal(QString uuid, ConnectState state)
|
|||
}
|
||||
}
|
||||
|
||||
emit this->lanConnectChanged(state);
|
||||
Q_EMIT this->lanConnectChanged(state);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1192,33 +1147,7 @@ void LanPage::onUpdateConnection(QString uuid)
|
|||
|
||||
void LanPage::setWiredDeviceEnable(const QString& devName, bool enable)
|
||||
{
|
||||
saveDeviceEnableState(devName, enable);
|
||||
|
||||
KyWiredConnectOperation wiredOperation;
|
||||
if (enable) {
|
||||
wiredOperation.openWiredNetworkWithDevice(devName);
|
||||
|
||||
m_enableDeviceList<<devName;
|
||||
|
||||
addDeviceForCombox(devName);
|
||||
if (m_currentDeviceName == devName) {
|
||||
initLanArea();
|
||||
}
|
||||
} else {
|
||||
wiredOperation.closeWiredNetworkWithDevice(devName);
|
||||
|
||||
QString nowDeviceName = m_currentDeviceName;
|
||||
deleteDeviceFromCombox(devName);
|
||||
if (nowDeviceName == devName) {
|
||||
initLanArea();
|
||||
}
|
||||
|
||||
if (m_enableDeviceList.contains(devName)) {
|
||||
m_enableDeviceList.removeOne(devName);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
m_deviceResource->setDeviceManaged(devName, enable);
|
||||
}
|
||||
|
||||
bool LanPage::eventFilter(QObject *watched, QEvent *event)
|
||||
|
@ -1238,11 +1167,12 @@ bool LanPage::eventFilter(QObject *watched, QEvent *event)
|
|||
m_netSwitch->setCheckable(false);
|
||||
} else {
|
||||
m_netSwitch->setCheckable(true);
|
||||
if (m_netSwitch->isChecked()) {
|
||||
m_switchGsettings->set(WIRED_SWITCH, false);
|
||||
} else {
|
||||
m_switchGsettings->set(WIRED_SWITCH,true);
|
||||
}
|
||||
// if (m_netSwitch->isChecked()) {
|
||||
// m_switchGsettings->set(WIRED_SWITCH, false);
|
||||
// } else {
|
||||
// m_switchGsettings->set(WIRED_SWITCH,true);
|
||||
// }
|
||||
m_wiredConnectOperation->setWiredEnabled(!m_netSwitch->isChecked());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1252,6 +1182,20 @@ bool LanPage::eventFilter(QObject *watched, QEvent *event)
|
|||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void LanPage::onWiredEnabledChanged(bool enabled)
|
||||
{
|
||||
if (m_devList.isEmpty()) {
|
||||
qDebug() << "[LanPage] have no device to use " << Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_netSwitch->isChecked() == enabled) {
|
||||
return;
|
||||
} else {
|
||||
m_switchGsettings->set(WIRED_SWITCH, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void LanPage::activateWired(const QString& devName, const QString& connUuid)
|
||||
{
|
||||
qDebug() << "[LanPage] activateWired" << devName << connUuid;
|
||||
|
|
|
@ -99,7 +99,7 @@ private:
|
|||
|
||||
void updateCurrentDevice(QString deviceName);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void lanAdd(QString devName, QStringList info);
|
||||
void lanRemove(QString dbusPath);
|
||||
void lanUpdate(QString devName, QStringList info);
|
||||
|
@ -107,7 +107,7 @@ signals:
|
|||
void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
|
||||
void lanConnectChanged(int state);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onConnectionStateChange(QString uuid, NetworkManager::ActiveConnection::State state,
|
||||
NetworkManager::ActiveConnection::Reason reason);
|
||||
|
||||
|
@ -120,6 +120,7 @@ private slots:
|
|||
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
||||
void onDeviceRemove(QString deviceName);
|
||||
void onDeviceNameUpdate(QString oldName, QString newName);
|
||||
void onDeviceManagedChange(QString deviceName, bool managed);
|
||||
|
||||
void onDeviceCarriered(QString deviceName, bool pluged);
|
||||
void onDeviceActiveChanage(QString deviceName, bool deviceActive);
|
||||
|
@ -128,6 +129,8 @@ private slots:
|
|||
|
||||
void onShowControlCenter();
|
||||
|
||||
void onWiredEnabledChanged(bool);
|
||||
|
||||
private:
|
||||
QListWidget * m_activatedLanListWidget = nullptr;
|
||||
QListWidget * m_inactivatedLanListWidget = nullptr;
|
||||
|
@ -143,6 +146,7 @@ private:
|
|||
QString m_currentDeviceName;
|
||||
QStringList m_devList;
|
||||
QStringList m_enableDeviceList;
|
||||
QStringList m_disableDeviceList;
|
||||
|
||||
QGSettings *m_switchGsettings = nullptr;
|
||||
|
||||
|
|
|
@ -231,8 +231,6 @@ void setDefaultDevice(KyDeviceType deviceType, QString deviceName)
|
|||
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool checkDeviceExist(KyDeviceType deviceType, QString deviceName)
|
||||
|
@ -259,37 +257,9 @@ bool checkDeviceExist(KyDeviceType deviceType, QString deviceName)
|
|||
return devList.contains(deviceName);
|
||||
}
|
||||
|
||||
void saveDeviceEnableState(QString deviceName, bool enable)
|
||||
{
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("CARDEABLE");
|
||||
m_settings->setValue(deviceName, enable);
|
||||
m_settings->endGroup();
|
||||
m_settings->sync();
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
void deleteDeviceEnableState(QString deviceName)
|
||||
{
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("CARDEABLE");
|
||||
m_settings->remove(deviceName);
|
||||
m_settings->endGroup();
|
||||
m_settings->sync();
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
void getDeviceEnableState(int type, QMap<QString, bool> &map)
|
||||
{
|
||||
map.clear();
|
||||
if (!QFile::exists(CONFIG_FILE_PATH)) {
|
||||
qDebug() << "CONFIG_FILE_PATH not exist";
|
||||
return;
|
||||
}
|
||||
if (type != WIRED && type != WIRELESS) {
|
||||
qDebug() << "getDeviceEnableState but wrong type";
|
||||
return;
|
||||
|
@ -300,34 +270,24 @@ void getDeviceEnableState(int type, QMap<QString, bool> &map)
|
|||
wiredDevList.clear();
|
||||
wirelessDevList.clear();
|
||||
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("CARDEABLE");
|
||||
|
||||
if (type == WIRED) {
|
||||
kdr->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, wiredDevList);
|
||||
if (!wiredDevList.isEmpty()) {
|
||||
for (int i = 0; i < wiredDevList.size(); ++i) {
|
||||
if (!m_settings->contains(wiredDevList.at(i))) {
|
||||
saveDeviceEnableState(wiredDevList.at(i),true);
|
||||
}
|
||||
bool enable = m_settings->value(wiredDevList.at(i), true).toBool();
|
||||
map.insert(wiredDevList.at(i), enable);
|
||||
QString devName = wiredDevList.at(i);
|
||||
map.insert(devName, kdr->getDeviceManaged(devName));
|
||||
}
|
||||
}
|
||||
} else if (type == WIRELESS) {
|
||||
kdr->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, wirelessDevList);
|
||||
if (!wirelessDevList.isEmpty()) {
|
||||
for (int i = 0; i < wirelessDevList.size(); ++i) {
|
||||
bool enable = m_settings->value(wirelessDevList.at(i), true).toBool();
|
||||
map.insert(wirelessDevList.at(i), enable);
|
||||
QString devName = wirelessDevList.at(i);
|
||||
map.insert(devName, kdr->getDeviceManaged(devName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_settings->endGroup();
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
delete kdr;
|
||||
kdr = nullptr;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -78,8 +78,6 @@ const QString CONFIG_FILE_PATH = QDir::homePath() + "/.config/ukui/kylin-nm.c
|
|||
bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
|
||||
QString getDefaultDeviceName(KyDeviceType deviceType);
|
||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
||||
void saveDeviceEnableState(QString deviceName, bool enable);
|
||||
void deleteDeviceEnableState(QString deviceName);
|
||||
void getDeviceEnableState(int type, QMap<QString, bool> &map);
|
||||
|
||||
class TabPage : public QWidget
|
||||
|
@ -108,7 +106,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void deviceStatusChanged();
|
||||
void deviceNameChanged(QString oldName, QString newName, int type);
|
||||
void activateFailed(QString errorMessage);
|
||||
|
@ -149,7 +147,7 @@ protected:
|
|||
QComboBox * m_deviceComboBox = nullptr;
|
||||
QLabel * m_tipsLabel = nullptr;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
virtual void onDeviceComboxIndexChanged(int currentIndex) = 0;
|
||||
void onPaletteChanged();
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ void WlanPage::constructWirelessNetArea()
|
|||
|
||||
QString activateSsid = m_activateConnectionItemMap.firstKey();
|
||||
|
||||
foreach (auto wirelessNetItem, wirelessNetItemList) {
|
||||
Q_FOREACH (auto wirelessNetItem, wirelessNetItemList) {
|
||||
if (wirelessNetItem.m_NetSsid == activateSsid) {
|
||||
continue;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
|||
<< item.m_secuType
|
||||
<< (m_connectResource->isApConnection(item.m_connectUuid) ? IsApConnection : NotApConnection)
|
||||
<< QString::number(item.getCategory(item.m_uni));
|
||||
emit wlanAdd(interface, info);
|
||||
Q_EMIT wlanAdd(interface, info);
|
||||
|
||||
if (interface != m_currentDevice) {
|
||||
qDebug() << "[WlanPage] wlan add interface not equal defaultdevice";
|
||||
|
@ -534,7 +534,7 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
|||
|
||||
void WlanPage::onWlanRemoved(QString interface, QString ssid)
|
||||
{
|
||||
emit wlanRemove(interface, ssid);
|
||||
Q_EMIT wlanRemove(interface, ssid);
|
||||
|
||||
if (interface != m_currentDevice) {
|
||||
qDebug()<<"[WlanPage] the device is not current device,"
|
||||
|
@ -583,7 +583,7 @@ void WlanPage::updateWlanListItem(QString ssid)
|
|||
WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem);
|
||||
p_wlanItem->updateWirelessNetItem(wirelessNetItem);
|
||||
p_wlanItem->updateConnectState(Deactivated);
|
||||
emit this->wlanConnectChanged(Deactivated);
|
||||
Q_EMIT this->wlanConnectChanged(Deactivated);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +633,7 @@ void WlanPage::onSecurityTypeChange(QString devName, QString ssid, QString secuT
|
|||
p_wlanItem->updateWirelessNetSecurity(ssid, secuType);
|
||||
}
|
||||
|
||||
emit secuTypeChange(devName, ssid, secuType);
|
||||
Q_EMIT secuTypeChange(devName, ssid, secuType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi
|
|||
initWlanArea();
|
||||
}
|
||||
|
||||
emit deviceStatusChanged();
|
||||
Q_EMIT deviceStatusChanged();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ void WlanPage::onDeviceRemove(QString deviceName)
|
|||
initWlanArea();
|
||||
}
|
||||
|
||||
emit deviceStatusChanged();
|
||||
Q_EMIT deviceStatusChanged();
|
||||
}
|
||||
|
||||
void WlanPage::updateDeviceForCombox(QString oldDeviceName, QString newDeviceName)
|
||||
|
@ -783,7 +783,7 @@ void WlanPage::onDeviceNameUpdate(QString oldName, QString newName)
|
|||
initWlanArea();
|
||||
}
|
||||
|
||||
emit deviceNameChanged(oldName, newName, WIRELESS);
|
||||
Q_EMIT deviceNameChanged(oldName, newName, WIRELESS);
|
||||
}
|
||||
|
||||
void WlanPage::sendApStateChangeSignal(QString uuid,
|
||||
|
@ -800,14 +800,14 @@ void WlanPage::sendApStateChangeSignal(QString uuid,
|
|||
|
||||
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||
qDebug() << "[WlanPage] hotspot Deactivated";
|
||||
emit hotspotDeactivated(deviceName, ssid);
|
||||
Q_EMIT hotspotDeactivated(deviceName, ssid);
|
||||
} else if (state == NetworkManager::ActiveConnection::State::Activated) {
|
||||
QString activePath;
|
||||
QString settingPath;
|
||||
activePath = m_activatedConnectResource->getAcitveConnectionPathByUuid(uuid);
|
||||
settingPath = m_connectResource->getApConnectionPathByUuid(uuid);
|
||||
qDebug() << "[WlanPage] hotspot activated"<<deviceName<<ssid<<uuid<<activePath<<settingPath;
|
||||
emit hotspotActivated(deviceName, ssid, uuid, activePath, settingPath);
|
||||
Q_EMIT hotspotActivated(deviceName, ssid, uuid, activePath, settingPath);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -902,8 +902,8 @@ void WlanPage::onConnectionStateChanged(QString uuid,
|
|||
m_wirelessNetResource->getSsidByUuid(uuid, ssid);
|
||||
m_wirelessNetResource->getDeviceByUuid(uuid, devName);
|
||||
|
||||
qDebug()<< LOG_FLAG << "emit wlanActiveConnectionStateChanged" << devName << ssid << state;
|
||||
emit wlanActiveConnectionStateChanged(devName, ssid, uuid, state);
|
||||
qDebug()<< LOG_FLAG << "Q_EMIT wlanActiveConnectionStateChanged" << devName << ssid << state;
|
||||
Q_EMIT wlanActiveConnectionStateChanged(devName, ssid, uuid, state);
|
||||
|
||||
if (ssid.isEmpty() || devName.isEmpty()) {
|
||||
qDebug()<< LOG_FLAG << "ssid or devicename is empty"
|
||||
|
@ -916,7 +916,7 @@ void WlanPage::onConnectionStateChanged(QString uuid,
|
|||
return;
|
||||
}
|
||||
|
||||
emit this->wlanConnectChanged(state);
|
||||
Q_EMIT this->wlanConnectChanged(state);
|
||||
|
||||
bool isApConnection = m_connectResource->isApConnection(uuid);
|
||||
|
||||
|
@ -1133,7 +1133,7 @@ void WlanPage::onRefreshIconTimer()
|
|||
return;
|
||||
}
|
||||
|
||||
emit timeToUpdate();
|
||||
Q_EMIT timeToUpdate();
|
||||
|
||||
if(!this->isVisible()) {
|
||||
return;
|
||||
|
@ -1265,7 +1265,7 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
|||
vector.append(QStringList("--"));
|
||||
}
|
||||
//未连接
|
||||
foreach (auto itemData, iter.value()) {
|
||||
Q_FOREACH (auto itemData, iter.value()) {
|
||||
if (itemData.m_NetSsid == activeSsid) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1377,7 +1377,7 @@ void WlanPage::activateWirelessConnection(const QString& devName, const QString&
|
|||
|
||||
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||
QApplication::postEvent(p_wlanItem, event);
|
||||
emit showMainWindow(WLAN_PAGE_INDEX);
|
||||
Q_EMIT showMainWindow(WLAN_PAGE_INDEX);
|
||||
} else {
|
||||
qDebug() << "[WlanPage]activateWirelessConnection no such " << ssid << "in" << devName;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
void getConnectivity(NetworkManager::Connectivity &connectivity);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void oneItemExpanded(const QString &ssid);
|
||||
void wlanAdd(QString devName, QStringList info);
|
||||
void wlanRemove(QString devName,QString ssid);
|
||||
|
@ -93,13 +93,13 @@ signals:
|
|||
|
||||
void connectivityChanged(NetworkManager::Connectivity connectivity);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void onMainWindowVisibleChanged(const bool &visible);
|
||||
void onSecurityTypeChange(QString devName, QString ssid, QString secuType);
|
||||
void requestScan();
|
||||
void onWlanPageVisibleChanged(int index);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onWlanAdded(QString interface, KyWirelessNetItem &item);
|
||||
void onWlanRemoved(QString interface, QString ssid);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
QColor m_backgroundColor;
|
||||
QColor m_foregroundColor;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onPaletteChanged();
|
||||
};
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
void setHoverColor();
|
||||
void setNormalColor();
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onPaletteChanged();
|
||||
|
||||
};
|
||||
|
|
|
@ -57,7 +57,7 @@ void LoadingDiv::switchAnimStep()
|
|||
}
|
||||
this->countCurrentTime += FRAMESPEED;
|
||||
if (this->countCurrentTime >= ALLTIME) {
|
||||
emit this->toStopLoading(); //发出信号停止主界面和托盘区的等待动画
|
||||
Q_EMIT this->toStopLoading(); //发出信号停止主界面和托盘区的等待动画
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,10 @@ class LoadingDiv : public QWidget
|
|||
public:
|
||||
explicit LoadingDiv(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void toStopLoading();
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void switchAnimStep();
|
||||
void startLoading();
|
||||
void stopLoading();
|
||||
|
|
|
@ -62,12 +62,12 @@ RadioItemButton::~RadioItemButton()
|
|||
|
||||
void RadioItemButton::startLoading()
|
||||
{
|
||||
emit this->requestStartLoading();
|
||||
Q_EMIT this->requestStartLoading();
|
||||
}
|
||||
|
||||
void RadioItemButton::stopLoading()
|
||||
{
|
||||
emit this->requestStopLoading();
|
||||
Q_EMIT this->requestStopLoading();
|
||||
}
|
||||
//设置图标
|
||||
void RadioItemButton::setButtonIcon(const QIcon &icon)
|
||||
|
@ -117,7 +117,7 @@ void RadioItemButton::onLoadingStopped()
|
|||
} else {
|
||||
m_iconLabel->setPixmap(m_pixmap);
|
||||
m_animation->stop();
|
||||
emit this->animationStoped();
|
||||
Q_EMIT this->animationStoped();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
};
|
||||
const QPixmap loadSvg(const QPixmap &source, const PixmapColor &color);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void requestStartLoading();
|
||||
void requestStopLoading();
|
||||
void animationStoped();
|
||||
|
@ -69,7 +69,7 @@ private:
|
|||
|
||||
void refreshButtonIcon();
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onLoadingStarted();
|
||||
void onLoadingStopped();
|
||||
void onPaletteChanged();
|
||||
|
|
|
@ -56,7 +56,7 @@ void SwitchButton::setSwitchStatus(bool check) {
|
|||
} else {
|
||||
m_bIsOn = 0;
|
||||
}
|
||||
emit this->switchStatusChanged();
|
||||
Q_EMIT this->switchStatusChanged();
|
||||
|
||||
m_cTimer->start(); //开始播放动画
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void on_btnCancel_clicked();
|
||||
|
||||
void on_btnOk_clicked();
|
||||
|
|
|
@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|||
TARGET = kylin-nm
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG += c++14 qt warn_on link_pkgconfig
|
||||
CONFIG += c++14 qt warn_on link_pkgconfig no_keywords
|
||||
#CONFIG += release
|
||||
|
||||
PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libnm libnma libsecret-1 gtk+-3.0 gsettings-qt libcap kysdk-qtwidgets kysdk-waylandhelper
|
||||
|
|
Loading…
Reference in New Issue