Merge branch '1025' into 'dbus-interface'

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

See merge request kylin-desktop/kylin-nm!367
This commit is contained in:
w x 2021-10-28 12:35:22 +00:00
commit 05323e4953
4 changed files with 18 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); NetworkManager::ActiveConnection::Ptr activeConnectionPtr = m_networkResourceInstance->getActiveConnect(uuid);
if (!activeConnectionPtr.isNull()) { if (!activeConnectionPtr.isNull()) {
QStringList interfaces = activeConnectionPtr->devices(); QStringList interfaces = activeConnectionPtr->devices();
if (interfaces.size() > 0) {
QString ifaceUni = interfaces.at(0); QString ifaceUni = interfaces.at(0);
NetworkManager::Device:: Ptr devicePtr = NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni); m_networkResourceInstance->findDeviceUni(ifaceUni);
deviceName = devicePtr->interfaceName(); deviceName = devicePtr->interfaceName();
return; return;
} else {
qDebug() << LOG_FLAG << "get device of active connection failed.";
}
} }
NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->getConnect(uuid); 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(); QList<KyWirelessNetItem>::iterator iter = m_WifiNetworkList[devIface].begin();
while (iter != m_WifiNetworkList[devIface].end()) { while (iter != m_WifiNetworkList[devIface].end()) {
if (iter->m_NetSsid == net->ssid()) { 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()) { if (iter->m_signalStrength != net->signalStrength()) {
iter->m_signalStrength = net->signalStrength(); iter->m_signalStrength = net->signalStrength();
emit signalStrengthChange(devIface, net->ssid(), iter->m_signalStrength); emit signalStrengthChange(devIface, net->ssid(), iter->m_signalStrength);

View File

@ -171,7 +171,8 @@ void LanPage::onSwithGsettingsChanged(const QString &key)
void LanPage::onLanSwitchClicked() 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) { if (m_devList.count() == 0) {
this->showDesktopNotify(tr("No ethernet device avaliable")); this->showDesktopNotify(tr("No ethernet device avaliable"));
@ -184,16 +185,6 @@ void LanPage::onLanSwitchClicked()
m_switchGsettings->set(WIRED_SWITCH,false); 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) void LanPage::getEnabledDevice(QStringList &enableDeviceList)

View File

@ -538,6 +538,8 @@ void WlanPage::updateWlanListItem(QString ssid)
if (p_listWidgetItem) { if (p_listWidgetItem) {
WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem);
p_wlanItem->updateWirelessNetItem(wirelessNetItem); p_wlanItem->updateWirelessNetItem(wirelessNetItem);
p_wlanItem->updateConnectState(Deactivated);
emit this->wlanConnectChanged(Deactivated);
} }
} }

View File

@ -86,9 +86,11 @@ void SwitchButton::startAnimation() { //滑动按钮动作播放
/* 按钮按下处理 */ /* 按钮按下处理 */
void SwitchButton::mousePressEvent(QMouseEvent *event) { void SwitchButton::mousePressEvent(QMouseEvent *event) {
Q_UNUSED(event); Q_UNUSED(event);
if (!m_enabled) // if (!m_enabled)
return QWidget::mousePressEvent(event); // return QWidget::mousePressEvent(event);
if (m_enabled) {
m_bIsOn = !m_bIsOn; m_bIsOn = !m_bIsOn;
}
Q_EMIT clicked(m_bIsOn); Q_EMIT clicked(m_bIsOn);