From f6e55a1818d45e26ac19e964aaf225046b3baeee Mon Sep 17 00:00:00 2001 From: kangshuning Date: Thu, 28 Oct 2021 12:44:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9C=AA=E6=8F=92=E5=85=A5=E6=9C=89?= =?UTF-8?q?=E7=BA=BF=E7=BD=91=E5=8D=A1=E6=B6=88=E6=81=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?&=E6=97=A0=E7=BA=BF=E5=BF=98=E8=AE=B0=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E5=90=8E=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dbus-interface/kywirelessnetresource.cpp | 14 +++++++++----- src/frontend/tab-pages/lanpage.cpp | 13 ++----------- src/frontend/tab-pages/wlanpage.cpp | 1 + src/frontend/tools/switchbutton.cpp | 8 +++++--- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/backend/dbus-interface/kywirelessnetresource.cpp b/src/backend/dbus-interface/kywirelessnetresource.cpp index 7503e9d3..65a5d4e7 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.cpp +++ b/src/backend/dbus-interface/kywirelessnetresource.cpp @@ -268,11 +268,15 @@ void KyWirelessNetResource::getDeviceByUuid(const QString uuid, QString &deviceN NetworkManager::ActiveConnection::Ptr activeConnectionPtr = m_networkResourceInstance->getActiveConnect(uuid); if (!activeConnectionPtr.isNull()) { QStringList interfaces = activeConnectionPtr->devices(); - QString ifaceUni = interfaces.at(0); - NetworkManager::Device:: Ptr devicePtr = + if (interfaces.size() > 0) { + QString ifaceUni = interfaces.at(0); + NetworkManager::Device:: Ptr devicePtr = m_networkResourceInstance->findDeviceUni(ifaceUni); - deviceName = devicePtr->interfaceName(); - return; + deviceName = devicePtr->interfaceName(); + return; + } else { + qDebug() << LOG_FLAG << "get device of active connection failed."; + } } NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->getConnect(uuid); @@ -407,7 +411,7 @@ void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::Wireless QList::iterator iter = m_WifiNetworkList[devIface].begin(); while (iter != m_WifiNetworkList[devIface].end()) { if (iter->m_NetSsid == net->ssid()) { - qDebug()<< LOG_FLAG <<"recive properity changed signal, sender is" << iter->m_NetSsid; +// qDebug()<< LOG_FLAG <<"recive properity changed signal, sender is" << iter->m_NetSsid; if (iter->m_signalStrength != net->signalStrength()) { iter->m_signalStrength = net->signalStrength(); emit signalStrengthChange(devIface, net->ssid(), iter->m_signalStrength); diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index 846b2800..60b79154 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -171,7 +171,8 @@ void LanPage::onSwithGsettingsChanged(const QString &key) void LanPage::onLanSwitchClicked() { - qDebug()<<"[LanPage] On lan switch button clicked! Status:" <getSwitchStatus(); + qDebug()<<"[LanPage] On lan switch button clicked! Status:" <getSwitchStatus() + <<"devices count:"<showDesktopNotify(tr("No ethernet device avaliable")); @@ -184,16 +185,6 @@ void LanPage::onLanSwitchClicked() m_switchGsettings->set(WIRED_SWITCH,false); } } - -// if (m_netSwitch->getSwitchStatus()) { -// if (m_devList.count() > 0) { -// m_switchGsettings->set(WIRED_SWITCH, true); -// } else { -// this->showDesktopNotify(tr("No ethernet device avaliable")); -// } -// } else { -// m_switchGsettings->set(WIRED_SWITCH, false); -// } } void LanPage::getEnabledDevice(QStringList &enableDeviceList) diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 6151a26f..7adfaa7a 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -537,6 +537,7 @@ void WlanPage::updateWlanListItem(QString ssid) if (p_listWidgetItem) { WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); p_wlanItem->updateWirelessNetItem(wirelessNetItem); + p_wlanItem->updateConnectState(Deactivated); } } diff --git a/src/frontend/tools/switchbutton.cpp b/src/frontend/tools/switchbutton.cpp index 357da9e7..003dd884 100644 --- a/src/frontend/tools/switchbutton.cpp +++ b/src/frontend/tools/switchbutton.cpp @@ -86,9 +86,11 @@ void SwitchButton::startAnimation() { //滑动按钮动作播放 /* 按钮按下处理 */ void SwitchButton::mousePressEvent(QMouseEvent *event) { Q_UNUSED(event); - if (!m_enabled) - return QWidget::mousePressEvent(event); - m_bIsOn = !m_bIsOn; +// if (!m_enabled) +// return QWidget::mousePressEvent(event); + if (m_enabled) { + m_bIsOn = !m_bIsOn; + } Q_EMIT clicked(m_bIsOn); From 1874320f75ed88dc34949c9ad3f9fa5af372a6b6 Mon Sep 17 00:00:00 2001 From: kangshuning Date: Thu, 28 Oct 2021 14:05:39 +0800 Subject: [PATCH 2/2] mainwindow ChangeTrayIcon --- src/frontend/tab-pages/wlanpage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 7adfaa7a..fec5b6bf 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -538,6 +538,7 @@ void WlanPage::updateWlanListItem(QString ssid) WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); p_wlanItem->updateWirelessNetItem(wirelessNetItem); p_wlanItem->updateConnectState(Deactivated); + emit this->wlanConnectChanged(Deactivated); } }