只检测连接name和path的改变

This commit is contained in:
ksn 2021-09-23 11:17:31 +08:00
parent 0c517f952e
commit 6306683d00
2 changed files with 9 additions and 11 deletions

View File

@ -88,13 +88,13 @@ void LanListItem::onInfoButtonClicked()
void LanListItem::onLanStatusChange(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason) void LanListItem::onLanStatusChange(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason)
{ {
qDebug() <<"[LanListItem]:Connection State Change to:" << state; qDebug() <<"[LanListItem]Connection State Change to:" << state;
if (m_data->m_connectUuid == uuid) { if (m_data->m_connectUuid == uuid) {
if (state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating) { if (state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating) {
qDebug() << "[LanListItem]:Activating!Loading!" << state; qDebug() << "[LanListItem]Activating!Loading!" << state;
m_netButton->startLoading(); m_netButton->startLoading();
} else { } else {
qDebug() << "[LanListItem]:Stop!" << state; qDebug() << "[LanListItem]Stop!" << state;
m_netButton->stopLoading(); m_netButton->stopLoading();
if (state == NetworkManager::ActiveConnection::State::Activated) { if (state == NetworkManager::ActiveConnection::State::Activated) {
setIcon(true); setIcon(true);

View File

@ -15,7 +15,6 @@
#define ITEM_HEIGHT 48 #define ITEM_HEIGHT 48
const QString WIRED_SWITCH = "wiredswitch"; const QString WIRED_SWITCH = "wiredswitch";
//const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
LanPage::LanPage(QWidget *parent) : TabPage(parent) LanPage::LanPage(QWidget *parent) : TabPage(parent)
{ {
@ -297,7 +296,7 @@ void LanPage::onDeviceComboxIndexChanged(int currentIndex)
{ {
//TODO 设备变更时更新设备和列表 //TODO 设备变更时更新设备和列表
m_deviceName = m_deviceComboBox->currentText(); m_deviceName = m_deviceComboBox->currentText();
qDebug() << "[LanPage]Device Changed:" << m_deviceName; qDebug() << "[LanPage]Current Device Changed to:" << m_deviceName;
initList(m_deviceName); initList(m_deviceName);
} }
@ -360,7 +359,6 @@ void LanPage::initList(QString m_deviceName) //程序拉起,初始化显
if (!m_activedList.isEmpty()) { if (!m_activedList.isEmpty()) {
for (int i = 0; i < m_activedList.size(); i++) { for (int i = 0; i < m_activedList.size(); i++) {
KyConnectItem *activeItemData = m_activedList.at(i); KyConnectItem *activeItemData = m_activedList.at(i);
qDebug() << "[??????]" << activeItemData->m_connectName;
addNewItem(activeItemData, m_activatedLanListWidget); addNewItem(activeItemData, m_activatedLanListWidget);
m_activeMap.insert(activeItemData, m_listWidgetItem); m_activeMap.insert(activeItemData, m_listWidgetItem);
@ -525,7 +523,7 @@ void LanPage::connectionUpdateSlot(QString uuid)
bool isCurrentDevice = false; bool isCurrentDevice = false;
KyConnectItem *item = nullptr; KyConnectItem *item = nullptr;
qDebug() << "[LanPage]:Connection Changed" << Q_FUNC_INFO << __LINE__; qDebug() << "[LanPage]:Connection Changed !" << Q_FUNC_INFO << __LINE__;
if (m_activeResourse->isActiveConnection(uuid, devNameList)) { //从activeResourse里找 if (m_activeResourse->isActiveConnection(uuid, devNameList)) { //从activeResourse里找
for (int i = 0; i < devNameList.size(); ++i) { for (int i = 0; i < devNameList.size(); ++i) {
@ -577,8 +575,8 @@ void LanPage::connectionUpdateSlot(QString uuid)
qDebug() << "[LanPage]:Deactive Connection's device change, remove it" << Q_FUNC_INFO << __LINE__; qDebug() << "[LanPage]:Deactive Connection's device change, remove it" << Q_FUNC_INFO << __LINE__;
return; return;
} else { } else {
if (m_item->m_connectState == item->m_connectState) { //当前未激活连接的其他数据改变(除了激活状态外) if (m_item->m_connectName != item->m_connectName || m_item->m_connectPath != item->m_connectPath) { //当前未激活连接的其他数据改变(除了激活状态外)
qDebug() << "[LanPage]:Deactive Connection's data change expect for ConnectState" << Q_FUNC_INFO << __LINE__; qDebug() << "[LanPage]:Deactive Connection's name or path changed." << Q_FUNC_INFO << __LINE__;
qDebug() << "new:" << item->m_connectUuid << item->m_connectName << item->m_connectPath << item->m_connectState << item->m_ifaceName; qDebug() << "new:" << item->m_connectUuid << item->m_connectName << item->m_connectPath << item->m_connectState << item->m_ifaceName;
qDebug() << "old:" << m_item->m_connectUuid << m_item->m_connectName << m_item->m_connectPath << m_item->m_connectState << m_item->m_ifaceName; qDebug() << "old:" << m_item->m_connectUuid << m_item->m_connectName << m_item->m_connectPath << m_item->m_connectState << m_item->m_ifaceName;
m_inactivatedLanListWidget->removeItemWidget(iter.value()); m_inactivatedLanListWidget->removeItemWidget(iter.value());
@ -603,8 +601,8 @@ void LanPage::connectionUpdateSlot(QString uuid)
qDebug() << "[LanPage]:Active Connection's device change, remove it" << Q_FUNC_INFO << __LINE__; qDebug() << "[LanPage]:Active Connection's device change, remove it" << Q_FUNC_INFO << __LINE__;
return; return;
} else { } else {
if (m_item->m_connectState == item->m_connectState) { //当前激活连接的其他数据改变(除了激活状态外) if (m_item->m_connectName != item->m_connectName || m_item->m_connectPath != item->m_connectPath) { //当前激活连接的其他数据改变(除了激活状态外)
qDebug() << "[LanPage]:Active Connection's data change expect for ConnectState" << Q_FUNC_INFO << __LINE__; qDebug() << "[LanPage]:Active Connection's name or path changed." << Q_FUNC_INFO << __LINE__;
qDebug() << "new:" << item->m_connectUuid << item->m_connectName << item->m_connectPath << item->m_connectState << item->m_ifaceName; qDebug() << "new:" << item->m_connectUuid << item->m_connectName << item->m_connectPath << item->m_connectState << item->m_ifaceName;
qDebug() << "old:" << m_item->m_connectUuid << m_item->m_connectName << m_item->m_connectPath << m_item->m_connectState << m_item->m_ifaceName; qDebug() << "old:" << m_item->m_connectUuid << m_item->m_connectName << m_item->m_connectPath << m_item->m_connectState << m_item->m_ifaceName;
m_activatedLanListWidget->removeItemWidget(iters.value()); m_activatedLanListWidget->removeItemWidget(iters.value());