diff --git a/src/backend/dbus-interface/kylinactiveconnectresource.cpp b/src/backend/dbus-interface/kylinactiveconnectresource.cpp index 0cc05831..c367caac 100644 --- a/src/backend/dbus-interface/kylinactiveconnectresource.cpp +++ b/src/backend/dbus-interface/kylinactiveconnectresource.cpp @@ -541,27 +541,6 @@ void KyActiveConnectResourse::getApActivateConnect(QList &apC return; } -bool KyActiveConnectResourse::isActiveConnection(QString uuid, QStringList &devName) -{ - if (!m_networkResourceInstance->isActiveConnection(uuid)) { - return false; - } else { - NetworkManager::ActiveConnection::Ptr actPtr = m_networkResourceInstance->getActiveConnect(uuid); - if (actPtr.isNull()) { - return false; - } else { - QStringList interfaces = actPtr->devices(); - for (int index = 0; index < interfaces.size(); ++index) { - QString ifaceUni = interfaces.at(index); - NetworkManager::Device:: Ptr devicePtr = - m_networkResourceInstance->findDeviceUni(ifaceUni); - devName <interfaceName(); - } - return true; - } - } -} - QString KyActiveConnectResourse::getDeviceOfActivateConnect(QString conUuid) { QString deviceName = ""; @@ -583,6 +562,26 @@ QString KyActiveConnectResourse::getDeviceOfActivateConnect(QString conUuid) return deviceName; } +bool KyActiveConnectResourse::connectionIsVirtual(QString uuid) +{ + NetworkManager::ActiveConnection::Ptr activeConnectPtr = + m_networkResourceInstance->getActiveConnect(uuid); + + if (activeConnectPtr.isNull()) { + return false; + } + + QStringList interfaces = activeConnectPtr->devices(); + QString ifaceUni = interfaces.at(0); + NetworkManager::Device:: Ptr devicePtr = + m_networkResourceInstance->findDeviceUni(ifaceUni); + if (devicePtr.isNull()) { + return false; + } + + return !m_networkdevice->deviceIsWired(devicePtr->interfaceName()); +} + bool KyActiveConnectResourse::wiredConnectIsActived() { int index = 0; @@ -609,6 +608,10 @@ bool KyActiveConnectResourse::wiredConnectIsActived() continue; } + if (connectionIsVirtual(activeConnectPtr->uuid())) { + continue; + } + if (activeConnectPtr->state() == NetworkManager::ActiveConnection::State::Activated) { return true; } diff --git a/src/backend/dbus-interface/kylinactiveconnectresource.h b/src/backend/dbus-interface/kylinactiveconnectresource.h index 68102b41..3bd28cf5 100644 --- a/src/backend/dbus-interface/kylinactiveconnectresource.h +++ b/src/backend/dbus-interface/kylinactiveconnectresource.h @@ -35,10 +35,9 @@ public: void getApActivateConnect(QList &apConnectItemList); - bool isActiveConnection(QString uuid, QStringList &devName); - QString getDeviceOfActivateConnect(QString conUuid); + bool connectionIsVirtual(QString uuid); bool wiredConnectIsActived(); bool wirelessConnectIsActived(); diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index fd6e40a2..551c8fd2 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -825,7 +825,7 @@ void LanPage::onConnectionStateChange(QString uuid, return; } - emit this->lanConnectChanged(state); + sendLanStateChangeSignal(uuid, (ConnectState)state); qDebug()<<"[LanPage] connection uuid"<< uuid << "state change slot:"<< state; @@ -855,11 +855,15 @@ void LanPage::onConnectionStateChange(QString uuid, updateConnectionArea(p_newItem); updateConnectionState(m_inactiveConnectionMap, m_inactivatedLanListWidget, uuid, (ConnectState)state); } else if (state == NetworkManager::ActiveConnection::State::Activating) { - updateConnectionState(m_inactiveConnectionMap, m_inactivatedLanListWidget, uuid, (ConnectState)state); deviceName = getConnectionDevice(uuid); + if (deviceName == m_currentDeviceName) { + updateConnectionState(m_inactiveConnectionMap, m_inactivatedLanListWidget, uuid, (ConnectState)state); + } } else if (state == NetworkManager::ActiveConnection::State::Deactivating) { - updateConnectionState(m_activeConnectionMap, m_activatedLanListWidget, uuid, (ConnectState)state); deviceName = getConnectionDevice(uuid); + if (deviceName == m_currentDeviceName) { + updateConnectionState(m_activeConnectionMap, m_activatedLanListWidget, uuid, (ConnectState)state); + } } emit lanActiveConnectionStateChanged(deviceName, uuid, state); @@ -922,6 +926,19 @@ void LanPage::sendLanAddSignal(KyConnectItem *p_connectItem) return; } +void LanPage::sendLanStateChangeSignal(QString uuid, ConnectState state) +{ + if (state == Activating || state == Deactivating) { + if (m_activeResourse->connectionIsVirtual(uuid)) { + return; + } + } + + emit this->lanConnectChanged(state); + + return; +} + void LanPage::updateConnectionProperty(KyConnectItem *p_connectItem) { QString newUuid = p_connectItem->m_connectUuid; diff --git a/src/frontend/tab-pages/lanpage.h b/src/frontend/tab-pages/lanpage.h index 46098608..8e15f524 100644 --- a/src/frontend/tab-pages/lanpage.h +++ b/src/frontend/tab-pages/lanpage.h @@ -70,6 +70,7 @@ private: void sendLanUpdateSignal(KyConnectItem *p_connectItem); void sendLanAddSignal(KyConnectItem *p_connectItem); + void sendLanStateChangeSignal(QString uuid, ConnectState state); void addEmptyConnectItem(QMap &connectMap, QListWidget *lanListWidget);