fix(icon):修改内网检测地址后,图标相应变化(#197648)

This commit is contained in:
jzxc95 2023-11-01 10:38:24 +08:00
parent ebfe2ebf21
commit aae488426c
8 changed files with 26 additions and 0 deletions

View File

@ -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);
}

View File

@ -86,6 +86,7 @@ Q_SIGNALS:
void connectionUpdate(QString uuid);
void connectionRemove(QString path);
void connectivityChanged(NetworkManager::Connectivity connectivity);
void connectivityCheckSpareUriChanged();
void needShowDesktop(QString);

View File

@ -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()

View File

@ -129,6 +129,7 @@ Q_SIGNALS:
void wifiNetworkDeviceDisappear();
void wifiEnabledChanged(bool);
void wiredEnabledChanged(bool);
void connectivityCheckSpareUriChanged();
void activeConnectionsReset();
void activeConnectionAdd(QString uuid);

View File

@ -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) {

View File

@ -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();

View File

@ -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()) {

View File

@ -104,6 +104,7 @@ Q_SIGNALS:
void showMainWindow(int type);
void connectivityChanged(NetworkManager::Connectivity connectivity);
void connectivityCheckSpareUriChanged();
void wirelessSwitchBtnChanged(bool state);