优化代码
This commit is contained in:
parent
98e0ef5000
commit
76cec152c9
|
@ -401,7 +401,7 @@ void MainWindow::resetWindowTheme()
|
|||
void MainWindow::showControlCenter()
|
||||
{
|
||||
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");
|
||||
} else {
|
||||
process.startDetached("ukui-control-center -m netconnect");
|
||||
|
@ -451,7 +451,7 @@ void MainWindow::onRefreshTrayIcon()
|
|||
if (m_lanWidget->lanIsConnected()) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
||||
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"));
|
||||
iconStatus = IconActiveType::WLAN_CONNECTED;
|
||||
} else {
|
||||
|
@ -504,7 +504,7 @@ void MainWindow::onWlanConnectStatusToChangeTrayIcon(int state)
|
|||
m_wlanIsLoading = true;
|
||||
iconTimer->start(LOADING_TRAYICON_TIMER_MS);
|
||||
} else {
|
||||
if (m_wlanWidget->wlanIsConnecting()) {
|
||||
if (m_wlanWidget->checkWlanStatus(NetworkManager::ActiveConnection::State::Activating)) {
|
||||
return;
|
||||
}
|
||||
m_wlanIsLoading = false;
|
||||
|
|
|
@ -1378,18 +1378,9 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
|
|||
return;
|
||||
}
|
||||
|
||||
bool WlanPage::wlanIsConnected()
|
||||
bool WlanPage::checkWlanStatus(NetworkManager::ActiveConnection::State state)
|
||||
{
|
||||
if (m_activatedConnectResource->checkWirelessStatus(NetworkManager::ActiveConnection::State::Activated)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool WlanPage::wlanIsConnecting()
|
||||
{
|
||||
if (m_activatedConnectResource->checkWirelessStatus(NetworkManager::ActiveConnection::State::Activating)) {
|
||||
if (m_activatedConnectResource->checkWirelessStatus(state)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -42,8 +42,7 @@ public:
|
|||
|
||||
void showDetailPage(QString devName, QString uuid);
|
||||
|
||||
bool wlanIsConnected();
|
||||
bool wlanIsConnecting();
|
||||
bool checkWlanStatus(NetworkManager::ActiveConnection::State state);
|
||||
|
||||
void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
|
||||
//无线总开关
|
||||
|
|
Loading…
Reference in New Issue