未插入有线网卡消息提示&无线忘记网络后状态更新

This commit is contained in:
kangshuning 2021-10-28 12:44:48 +08:00
parent 1d9daf0110
commit f6e55a1818
4 changed files with 17 additions and 19 deletions

View File

@ -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<KyWirelessNetItem>::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);

View File

@ -171,7 +171,8 @@ void LanPage::onSwithGsettingsChanged(const QString &key)
void LanPage::onLanSwitchClicked()
{
qDebug()<<"[LanPage] On lan switch button clicked! Status:" <<m_netSwitch->getSwitchStatus();
qDebug()<<"[LanPage] On lan switch button clicked! Status:" <<m_netSwitch->getSwitchStatus()
<<"devices count:"<<m_devList.count();
if (m_devList.count() == 0) {
this->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)

View File

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

View File

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