Merge branch 'kylin-nm-tip' into 'dbus-interface'
当虚拟网络连接的时候,托盘图标旋转的问题 See merge request kylin-desktop/kylin-nm!384
This commit is contained in:
commit
3bd1d09215
|
@ -541,27 +541,6 @@ void KyActiveConnectResourse::getApActivateConnect(QList<KyApConnectItem *> &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 <<devicePtr->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;
|
||||
}
|
||||
|
|
|
@ -35,10 +35,9 @@ public:
|
|||
|
||||
void getApActivateConnect(QList<KyApConnectItem *> &apConnectItemList);
|
||||
|
||||
bool isActiveConnection(QString uuid, QStringList &devName);
|
||||
|
||||
QString getDeviceOfActivateConnect(QString conUuid);
|
||||
|
||||
bool connectionIsVirtual(QString uuid);
|
||||
bool wiredConnectIsActived();
|
||||
bool wirelessConnectIsActived();
|
||||
|
||||
|
|
|
@ -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) {
|
||||
deviceName = getConnectionDevice(uuid);
|
||||
if (deviceName == m_currentDeviceName) {
|
||||
updateConnectionState(m_inactiveConnectionMap, m_inactivatedLanListWidget, uuid, (ConnectState)state);
|
||||
deviceName = getConnectionDevice(uuid);
|
||||
}
|
||||
} 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;
|
||||
|
|
|
@ -70,6 +70,7 @@ private:
|
|||
|
||||
void sendLanUpdateSignal(KyConnectItem *p_connectItem);
|
||||
void sendLanAddSignal(KyConnectItem *p_connectItem);
|
||||
void sendLanStateChangeSignal(QString uuid, ConnectState state);
|
||||
|
||||
void addEmptyConnectItem(QMap<QString, QListWidgetItem *> &connectMap,
|
||||
QListWidget *lanListWidget);
|
||||
|
|
Loading…
Reference in New Issue