Merge branch '0315-up' into 'dbus-interface'
解决状态变化顺序异常导致的托盘图标加载状态停止&&托盘交互修改 See merge request kylin-desktop/kylin-nm!560
This commit is contained in:
commit
59b0beab6e
|
@ -665,7 +665,7 @@ bool KyActiveConnectResourse::wiredConnectIsActived()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KyActiveConnectResourse::wirelessConnectIsActived()
|
bool KyActiveConnectResourse::checkWirelessStatus(NetworkManager::ActiveConnection::State state)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
NetworkManager::ActiveConnection::List activeConnectList;
|
NetworkManager::ActiveConnection::List activeConnectList;
|
||||||
|
@ -691,7 +691,7 @@ bool KyActiveConnectResourse::wirelessConnectIsActived()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeConnectPtr->state() == NetworkManager::ActiveConnection::State::Activated) {
|
if (activeConnectPtr->state() == state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
|
|
||||||
bool connectionIsVirtual(QString uuid);
|
bool connectionIsVirtual(QString uuid);
|
||||||
bool wiredConnectIsActived();
|
bool wiredConnectIsActived();
|
||||||
bool wirelessConnectIsActived();
|
bool checkWirelessStatus(NetworkManager::ActiveConnection::State state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
||||||
|
|
|
@ -401,7 +401,7 @@ void MainWindow::resetWindowTheme()
|
||||||
void MainWindow::showControlCenter()
|
void MainWindow::showControlCenter()
|
||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
if (!m_lanWidget->lanIsConnected() && m_wlanWidget->wlanIsConnected()){
|
if (!m_lanWidget->lanIsConnected() && m_wlanWidget->checkWlanStatus(NetworkManager::ActiveConnection::State::Activated)){
|
||||||
process.startDetached("ukui-control-center -m wlanconnect");
|
process.startDetached("ukui-control-center -m wlanconnect");
|
||||||
} else {
|
} else {
|
||||||
process.startDetached("ukui-control-center -m netconnect");
|
process.startDetached("ukui-control-center -m netconnect");
|
||||||
|
@ -411,15 +411,19 @@ void MainWindow::showControlCenter()
|
||||||
/**
|
/**
|
||||||
* @brief MainWindow::onTrayIconActivated 点击托盘图标的槽函数
|
* @brief MainWindow::onTrayIconActivated 点击托盘图标的槽函数
|
||||||
*/
|
*/
|
||||||
void MainWindow::onTrayIconActivated()
|
void MainWindow::onTrayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
{
|
{
|
||||||
if (this->isVisible()) {
|
if (reason == QSystemTrayIcon::ActivationReason::Context) {
|
||||||
qDebug() << "Received signal of tray icon activated, will hide mainwindow." << Q_FUNC_INFO << __LINE__;
|
m_trayIconMenu->popup(QCursor::pos());
|
||||||
hideMainwindow();
|
} else {
|
||||||
return;
|
if (this->isVisible()) {
|
||||||
|
qDebug() << "Received signal of tray icon activated, will hide mainwindow." << Q_FUNC_INFO << __LINE__;
|
||||||
|
hideMainwindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qDebug() << "Received signal of tray icon activated, will show mainwindow." << Q_FUNC_INFO << __LINE__;
|
||||||
|
this->showMainwindow();
|
||||||
}
|
}
|
||||||
qDebug() << "Received signal of tray icon activated, will show mainwindow." << Q_FUNC_INFO << __LINE__;
|
|
||||||
this->showMainwindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onShowMainwindowActionTriggled()
|
void MainWindow::onShowMainwindowActionTriggled()
|
||||||
|
@ -451,7 +455,7 @@ void MainWindow::onRefreshTrayIcon()
|
||||||
if (m_lanWidget->lanIsConnected()) {
|
if (m_lanWidget->lanIsConnected()) {
|
||||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
||||||
iconStatus = IconActiveType::LAN_CONNECTED;
|
iconStatus = IconActiveType::LAN_CONNECTED;
|
||||||
} else if (m_wlanWidget->wlanIsConnected()){
|
} else if (m_wlanWidget->checkWlanStatus(NetworkManager::ActiveConnection::State::Activated)){
|
||||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-connected-symbolic"));
|
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-connected-symbolic"));
|
||||||
iconStatus = IconActiveType::WLAN_CONNECTED;
|
iconStatus = IconActiveType::WLAN_CONNECTED;
|
||||||
} else {
|
} else {
|
||||||
|
@ -461,7 +465,7 @@ void MainWindow::onRefreshTrayIcon()
|
||||||
|
|
||||||
NetworkManager::Connectivity connecttivity;
|
NetworkManager::Connectivity connecttivity;
|
||||||
m_wlanWidget->getConnectivity(connecttivity);
|
m_wlanWidget->getConnectivity(connecttivity);
|
||||||
if (connecttivity == NetworkManager::Connectivity::Portal || connecttivity == NetworkManager::Connectivity::Limited) {
|
if (connecttivity != NetworkManager::Connectivity::Full) {
|
||||||
if (iconStatus == IconActiveType::LAN_CONNECTED) {
|
if (iconStatus == IconActiveType::LAN_CONNECTED) {
|
||||||
m_trayIcon->setIcon(QIcon::fromTheme("network-error-symbolic"));
|
m_trayIcon->setIcon(QIcon::fromTheme("network-error-symbolic"));
|
||||||
iconStatus = IconActiveType::LAN_CONNECTED_LIMITED;
|
iconStatus = IconActiveType::LAN_CONNECTED_LIMITED;
|
||||||
|
@ -504,6 +508,9 @@ void MainWindow::onWlanConnectStatusToChangeTrayIcon(int state)
|
||||||
m_wlanIsLoading = true;
|
m_wlanIsLoading = true;
|
||||||
iconTimer->start(LOADING_TRAYICON_TIMER_MS);
|
iconTimer->start(LOADING_TRAYICON_TIMER_MS);
|
||||||
} else {
|
} else {
|
||||||
|
if (m_wlanWidget->checkWlanStatus(NetworkManager::ActiveConnection::State::Activating)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_wlanIsLoading = false;
|
m_wlanIsLoading = false;
|
||||||
if (m_lanIsLoading == false) {
|
if (m_lanIsLoading == false) {
|
||||||
onRefreshTrayIcon();
|
onRefreshTrayIcon();
|
||||||
|
|
|
@ -155,7 +155,7 @@ private:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTransChanged();
|
void onTransChanged();
|
||||||
void onTrayIconActivated();
|
void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
void onShowMainwindowActionTriggled();
|
void onShowMainwindowActionTriggled();
|
||||||
void onShowSettingsActionTriggled();
|
void onShowSettingsActionTriggled();
|
||||||
void onThemeChanged(const QString &key);
|
void onThemeChanged(const QString &key);
|
||||||
|
|
|
@ -1378,9 +1378,9 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WlanPage::wlanIsConnected()
|
bool WlanPage::checkWlanStatus(NetworkManager::ActiveConnection::State state)
|
||||||
{
|
{
|
||||||
if (m_activatedConnectResource->wirelessConnectIsActived()) {
|
if (m_activatedConnectResource->checkWirelessStatus(state)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
void showDetailPage(QString devName, QString uuid);
|
void showDetailPage(QString devName, QString uuid);
|
||||||
|
|
||||||
bool wlanIsConnected();
|
bool checkWlanStatus(NetworkManager::ActiveConnection::State state);
|
||||||
|
|
||||||
void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
|
void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
|
||||||
//无线总开关
|
//无线总开关
|
||||||
|
|
Loading…
Reference in New Issue