show device whose connection is activated
This commit is contained in:
parent
728ddafd7c
commit
61e48a3a01
|
@ -62,6 +62,16 @@ void LanPage::initLanDevice()
|
||||||
{
|
{
|
||||||
m_devList.clear();
|
m_devList.clear();
|
||||||
m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, m_devList);
|
m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, m_devList);
|
||||||
|
QList<KyConnectItem *> activedList;
|
||||||
|
|
||||||
|
for (int index = 0; index < m_devList.size(); ++index) {
|
||||||
|
m_activeResourse->getActiveConnectionList(m_devList.at(index),
|
||||||
|
NetworkManager::ConnectionSettings::Wired, activedList);
|
||||||
|
if (!activedList.isEmpty()) {
|
||||||
|
m_currentDeviceName = m_devList.at(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int index = 0; index < m_devList.size(); ++index) {
|
for (int index = 0; index < m_devList.size(); ++index) {
|
||||||
if (m_deviceResource->wiredDeviceIsCarriered(m_devList.at(index))) {
|
if (m_deviceResource->wiredDeviceIsCarriered(m_devList.at(index))) {
|
||||||
|
@ -689,8 +699,7 @@ void LanPage::onDeviceCarriered(QString deviceName, bool pluged)
|
||||||
m_wiredConnectOperation->closeWiredNetworkWithDevice(deviceName);
|
m_wiredConnectOperation->closeWiredNetworkWithDevice(deviceName);
|
||||||
} else {
|
} else {
|
||||||
m_wiredConnectOperation->openWiredNetworkWithDevice(deviceName);
|
m_wiredConnectOperation->openWiredNetworkWithDevice(deviceName);
|
||||||
int index = m_deviceComboBox->findText(deviceName);
|
updateCurrentDevice(deviceName);
|
||||||
m_deviceComboBox->setCurrentIndex(index);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -847,6 +856,20 @@ QString LanPage::getConnectionDevice(QString uuid)
|
||||||
return deviceName;
|
return deviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LanPage::updateCurrentDevice(QString deviceName)
|
||||||
|
{
|
||||||
|
if (m_currentDeviceName != deviceName) {
|
||||||
|
int index = m_deviceComboBox->findText(deviceName);
|
||||||
|
if (index < 0) {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
m_deviceComboBox->setCurrentIndex(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void LanPage::onConnectionStateChange(QString uuid,
|
void LanPage::onConnectionStateChange(QString uuid,
|
||||||
NetworkManager::ActiveConnection::State state,
|
NetworkManager::ActiveConnection::State state,
|
||||||
NetworkManager::ActiveConnection::Reason reason)
|
NetworkManager::ActiveConnection::Reason reason)
|
||||||
|
@ -873,6 +896,7 @@ void LanPage::onConnectionStateChange(QString uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceName = p_newItem->m_ifaceName;
|
deviceName = p_newItem->m_ifaceName;
|
||||||
|
updateCurrentDevice(deviceName);
|
||||||
updateActivatedConnectionArea(p_newItem);
|
updateActivatedConnectionArea(p_newItem);
|
||||||
updateConnectionState(m_activeConnectionMap, m_activatedLanListWidget, uuid, (ConnectState)state);
|
updateConnectionState(m_activeConnectionMap, m_activatedLanListWidget, uuid, (ConnectState)state);
|
||||||
} else if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
} else if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||||
|
|
|
@ -79,6 +79,8 @@ private:
|
||||||
void deleteConnectionMapItem(QMap<QString, QListWidgetItem *> &connectMap,
|
void deleteConnectionMapItem(QMap<QString, QListWidgetItem *> &connectMap,
|
||||||
QListWidget *lanListWidget, QString uuid);
|
QListWidget *lanListWidget, QString uuid);
|
||||||
|
|
||||||
|
void updateCurrentDevice(QString deviceName);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void lanAdd(QString devName, QStringList info);
|
void lanAdd(QString devName, QStringList info);
|
||||||
void lanRemove(QString dbusPath);
|
void lanRemove(QString dbusPath);
|
||||||
|
|
Loading…
Reference in New Issue