From 4936fa953ec6e18f554841bee9f5c532e89670d3 Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Thu, 16 Sep 2021 14:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=BF=80=E6=B4=BB=E4=BF=A1?= =?UTF-8?q?=E5=8F=B7=E9=9C=80=E8=A6=81=E8=AE=BE=E5=A4=87=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/dbus-interface/kywirelessnetresource.cpp | 4 +++- src/backend/dbus-interface/kywirelessnetresource.h | 2 +- src/frontend/list-items/wlanlistitem.cpp | 9 +++++---- src/frontend/tab-pages/wlanpage.cpp | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/backend/dbus-interface/kywirelessnetresource.cpp b/src/backend/dbus-interface/kywirelessnetresource.cpp index 7a3d3041..ab17ab71 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.cpp +++ b/src/backend/dbus-interface/kywirelessnetresource.cpp @@ -159,9 +159,10 @@ QString KyWirelessNetResource::getDeviceIFace(NetworkManager::ActiveConnection:: return sett->interfaceName(); } -void KyWirelessNetResource::getSsidByUuid(const QString uuid, QString &ssid) +void KyWirelessNetResource::getSsidByUuid(const QString uuid, QString &ssid, QString &devName) { ssid.clear(); + devName.clear(); NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->getConnect(uuid); if (connectPtr.isNull()) { return; @@ -173,6 +174,7 @@ void KyWirelessNetResource::getSsidByUuid(const QString uuid, QString &ssid) return; } ssid = wireless_sett->ssid(); + devName = connectPtr->settings()->interfaceName(); qDebug() << "getSsidByUuid success " << ssid; return; } diff --git a/src/backend/dbus-interface/kywirelessnetresource.h b/src/backend/dbus-interface/kywirelessnetresource.h index b5725f9a..c9ea8104 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.h +++ b/src/backend/dbus-interface/kywirelessnetresource.h @@ -29,7 +29,7 @@ public: void getWirelessActiveConnection(NetworkManager::ActiveConnection::State state, QMap &map); - void getSsidByUuid(const QString uuid, QString &ssid); + void getSsidByUuid(const QString uuid, QString &ssid, QString &devName); private: diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index d3b3d5c1..489d97b4 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -382,13 +382,14 @@ void WlanListItem::onConnectionRemove(QString deviceName, QString ssid) void WlanListItem::onWlanStatusChange(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason) { - QString ssid; - m_resource->getSsidByUuid(uuid,ssid); + QString ssid, devName; + m_resource->getSsidByUuid(uuid, ssid, devName); if (m_data->m_NetSsid == ssid) { qDebug() << "[WlanPage] State changed to :" << state << Q_FUNC_INFO <<__LINE__; - if (state == NetworkManager::ActiveConnection::State::Activating) { + if ((state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating) + && devName == m_wlanDevice) { m_netButton->startLoading(); - } else { + } else if (){ m_netButton->stopLoading(); } } diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 7d4a9202..07f589e1 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -430,7 +430,7 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec qDebug() << "[WlanPage] onActivatedWlanChanged but uuid is invalid"; } - m_resource->getSsidByUuid(uuid, ssid); + m_resource->getSsidByUuid(uuid, ssid, devName); qDebug() << "emit wlanActiveConnectionStateChanged" << devName << ssid << state; emit wlanActiveConnectionStateChanged(devName, ssid, state); @@ -463,7 +463,7 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec } } - if (state == NetworkManager::ActiveConnection::State::Activated) { + if (state == NetworkManager::ActiveConnection::State::Activated && defaultDevice == devName) { //onWlanRemoved(m_wlanDevice, ssid); m_activatedNetListWidget->clear(); int height = 0;