diff --git a/src/backend/dbus-interface/kylinconnectresource.cpp b/src/backend/dbus-interface/kylinconnectresource.cpp index dea6d572..0c04e8e1 100644 --- a/src/backend/dbus-interface/kylinconnectresource.cpp +++ b/src/backend/dbus-interface/kylinconnectresource.cpp @@ -81,6 +81,7 @@ KyConnectResourse::KyConnectResourse(QObject *parent) : QObject(parent) connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionUpdate, this, &KyConnectResourse::connectionUpdate); connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityChanged, this, &KyConnectResourse::connectivityChanged); + connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityCheckSpareUriChanged, this, &KyConnectResourse::connectivityCheckSpareUriChanged); connect(m_networkResourceInstance, &KyNetworkResourceManager::needShowDesktop, this, &KyConnectResourse::needShowDesktop); } diff --git a/src/backend/dbus-interface/kylinconnectresource.h b/src/backend/dbus-interface/kylinconnectresource.h index 3ab29bd2..0af9c4b5 100644 --- a/src/backend/dbus-interface/kylinconnectresource.h +++ b/src/backend/dbus-interface/kylinconnectresource.h @@ -86,6 +86,7 @@ Q_SIGNALS: void connectionUpdate(QString uuid); void connectionRemove(QString path); void connectivityChanged(NetworkManager::Connectivity connectivity); + void connectivityCheckSpareUriChanged(); void needShowDesktop(QString); diff --git a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp index 71c3a9b9..a9fcdd8e 100644 --- a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp +++ b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp @@ -598,6 +598,12 @@ void KyNetworkResourceManager::onPropertiesChanged(QVariantMap qvm) Q_EMIT wiredEnabledChanged(wiredEnable); } } + for(QString keyStr : qvm.keys()) { + //内网检测地址变化 + if (keyStr == "ConnectivityCheckSpareUri") { + Q_EMIT connectivityCheckSpareUriChanged(); + } + } } void KyNetworkResourceManager::onConnectionUpdated() diff --git a/src/backend/dbus-interface/kylinnetworkresourcemanager.h b/src/backend/dbus-interface/kylinnetworkresourcemanager.h index 9cf59896..ad8c4bf0 100644 --- a/src/backend/dbus-interface/kylinnetworkresourcemanager.h +++ b/src/backend/dbus-interface/kylinnetworkresourcemanager.h @@ -129,6 +129,7 @@ Q_SIGNALS: void wifiNetworkDeviceDisappear(); void wifiEnabledChanged(bool); void wiredEnabledChanged(bool); + void connectivityCheckSpareUriChanged(); void activeConnectionsReset(); void activeConnectionAdd(QString uuid); diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index 52f21fc4..2818b874 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -400,6 +400,7 @@ void MainWindow::initDbusConnnect() connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::onTimeUpdateTrayIcon); connect(m_wlanWidget, &WlanPage::showMainWindow, this, &MainWindow::onShowMainWindow); connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged); + connect(m_wlanWidget, &WlanPage::connectivityCheckSpareUriChanged, this, &MainWindow::onConnectivityCheckSpareUriChanged); connect(m_lanWidget, &LanPage::lanConnectChanged, this, &MainWindow::onRefreshTrayIconTooltip); connect(m_lanWidget, &LanPage::deviceStatusChanged, this, &MainWindow::onRefreshTrayIconTooltip); @@ -901,6 +902,19 @@ void MainWindow::onConnectivityChanged(NetworkManager::Connectivity connectivity onRefreshTrayIcon(); } +void MainWindow::onConnectivityCheckSpareUriChanged() +{ + if (!m_trayIcon) { + return; + } + + if (iconStatus == ACTIVATING) { + return; + } + + onRefreshTrayIcon(); +} + void MainWindow::onTimeUpdateTrayIcon() { if (!m_trayIcon) { diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index d033bb7d..d2265735 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -226,6 +226,7 @@ private Q_SLOTS: void onLanConnectStatusToChangeTrayIcon(int state); void onWlanConnectStatusToChangeTrayIcon(int state); void onConnectivityChanged(NetworkManager::Connectivity connectivity); + void onConnectivityCheckSpareUriChanged(); void onTimeUpdateTrayIcon(); void onTabletModeChanged(bool mode); void onRefreshTrayIconTooltip(); diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index fc5aecf2..8114d15e 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -81,6 +81,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent) connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::wifiEnabledChanged, this, &WlanPage::onWifiEnabledChanged); connect(m_connectResource, &KyConnectResourse::connectivityChanged, this, &WlanPage::connectivityChanged); + connect(m_connectResource, &KyConnectResourse::connectivityCheckSpareUriChanged, this, &WlanPage::connectivityCheckSpareUriChanged); connect(m_netSwitch, &KSwitchButton::clicked, this, [=](bool checked) { //解决 switchBtn不支持点击的情况下,点击按钮,有无线网卡后不自动开启的问题 if (getSwitchBtnEnable()) { diff --git a/src/frontend/tab-pages/wlanpage.h b/src/frontend/tab-pages/wlanpage.h index 85256044..27bd5fcc 100644 --- a/src/frontend/tab-pages/wlanpage.h +++ b/src/frontend/tab-pages/wlanpage.h @@ -104,6 +104,7 @@ Q_SIGNALS: void showMainWindow(int type); void connectivityChanged(NetworkManager::Connectivity connectivity); + void connectivityCheckSpareUriChanged(); void wirelessSwitchBtnChanged(bool state);