Merge branch 'plugin-ui' into 'dbus-interface'
Fix bug 126183 拔掉无线网卡任务栏和控制面板无线网络开关显示为灰色打开样式 See merge request kylin-desktop/kylin-nm!644
This commit is contained in:
commit
2d40e117bd
|
@ -207,8 +207,8 @@ void NetConnect::initComponent() {
|
|||
getDeviceStatusMap(deviceStatusMap);
|
||||
if (deviceStatusMap.isEmpty()) {
|
||||
qDebug() << "[Netconnect] no device exist when init, set switch disable";
|
||||
wiredSwitch->setCheckable(false);
|
||||
wiredSwitch->setChecked(false);
|
||||
wiredSwitch->setCheckable(false);
|
||||
}
|
||||
initNet();
|
||||
|
||||
|
@ -593,8 +593,8 @@ void NetConnect::onDeviceStatusChanged()
|
|||
}
|
||||
deviceStatusMap = map;
|
||||
if (deviceStatusMap.isEmpty()) {
|
||||
wiredSwitch->setCheckable(false);
|
||||
wiredSwitch->setChecked(false);
|
||||
wiredSwitch->setCheckable(false);
|
||||
} else {
|
||||
wiredSwitch->setCheckable(true);
|
||||
setSwitchStatus();
|
||||
|
|
|
@ -267,8 +267,8 @@ void WlanConnect::initComponent() {
|
|||
getDeviceList(deviceList);
|
||||
if (deviceList.isEmpty()) {
|
||||
qDebug() << "[WlanConnect]no device exist when init, set switch disable";
|
||||
m_wifiSwitch->setCheckable(false);
|
||||
m_wifiSwitch->setChecked(false);
|
||||
m_wifiSwitch->setCheckable(false);
|
||||
}
|
||||
initNet();
|
||||
|
||||
|
@ -525,8 +525,8 @@ void WlanConnect::onDeviceStatusChanged()
|
|||
}
|
||||
deviceList = list;
|
||||
if (deviceList.isEmpty()) {
|
||||
m_wifiSwitch->setCheckable(false);
|
||||
m_wifiSwitch->setChecked(false);
|
||||
m_wifiSwitch->setCheckable(false);
|
||||
} else {
|
||||
m_wifiSwitch->setCheckable(true);
|
||||
setSwitchStatus();
|
||||
|
|
|
@ -629,8 +629,8 @@ void LanPage::onDeviceRemove(QString deviceName)
|
|||
|
||||
m_devList.removeOne(deviceName);
|
||||
if (m_devList.count() == 0) {
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
qDebug() << "[wiredSwitch]set not enable after device remove";
|
||||
}
|
||||
|
||||
|
@ -1183,8 +1183,8 @@ bool LanPage::eventFilter(QObject *watched, QEvent *event)
|
|||
|
||||
if (m_devList.count() == 0) {
|
||||
this->showDesktopNotify(tr("No ethernet device avaliable"), "networkwrong");
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
} else {
|
||||
m_netSwitch->setCheckable(true);
|
||||
if (m_netSwitch->isChecked()) {
|
||||
|
|
|
@ -69,8 +69,8 @@ bool WlanPage::eventFilter(QObject *w, QEvent *e)
|
|||
if (m_devList.isEmpty()) {
|
||||
showDesktopNotify(tr("No wireless network card detected"), "networkwrong");
|
||||
//检测不到无线网卡不再触发click信号
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
} else {
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(!m_netSwitch->isChecked());
|
||||
}
|
||||
|
@ -123,13 +123,15 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key)
|
|||
m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
qDebug() << LOG_FLAG << "wlan switch state" << m_wlanSwitchEnable;
|
||||
|
||||
m_netSwitch->setChecked(m_wlanSwitchEnable);
|
||||
if (m_wirelessConnectOpreation->getWirelessEnabled() != m_wlanSwitchEnable) {
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(m_wlanSwitchEnable);
|
||||
qDebug() <<"wlan switch state!=";
|
||||
}
|
||||
|
||||
m_netSwitch->setChecked(m_wlanSwitchEnable);
|
||||
initDeviceCombox();
|
||||
initWlanArea();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanPage::initWlanSwitchState()
|
||||
|
@ -139,8 +141,8 @@ void WlanPage::initWlanSwitchState()
|
|||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
if (m_switchGsettings->keys().contains(WIRELESS_SWITCH)) {
|
||||
if (m_devList.isEmpty()) {
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
} else {
|
||||
wirelessGsetting = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||
if (m_wirelessConnectOpreation->getWirelessEnabled()
|
||||
|
@ -716,8 +718,8 @@ void WlanPage::onDeviceRemove(QString deviceName)
|
|||
deleteDeviceFromCombox(deviceName);
|
||||
|
||||
if (m_devList.isEmpty()) {
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
}
|
||||
|
||||
if (originalDeviceName == deviceName) {
|
||||
|
@ -1019,6 +1021,7 @@ void WlanPage::onWifiEnabledChanged(bool isWifiOn)
|
|||
{
|
||||
//监听外部命令导致wifi状态变化,更新界面
|
||||
qDebug() << "[WlanPage] onWifiEnabledChanged wifi state" << isWifiOn;
|
||||
isWifiOn = m_wirelessConnectOpreation->getWirelessEnabled();
|
||||
|
||||
//应该先检测是否有无线网卡可用,才改变开关状态
|
||||
if (m_devList.isEmpty()) {
|
||||
|
@ -1029,9 +1032,9 @@ void WlanPage::onWifiEnabledChanged(bool isWifiOn)
|
|||
if (m_wlanSwitchEnable == isWifiOn) {
|
||||
return;
|
||||
} else {
|
||||
if (!m_netSwitch->isChecked()) {
|
||||
m_netSwitch->setChecked(true);
|
||||
}
|
||||
// if (!m_netSwitch->isChecked()) {
|
||||
// m_netSwitch->setChecked(true);
|
||||
// }
|
||||
m_switchGsettings->set(WIRELESS_SWITCH, isWifiOn);
|
||||
}
|
||||
|
||||
|
@ -1390,13 +1393,13 @@ void WlanPage::setWirelessSwitchEnable(bool enable)
|
|||
if (m_devList.isEmpty()) {
|
||||
qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__;
|
||||
//检测不到无线网卡不再触发click信号
|
||||
// m_netSwitch->setSwitchStatus(false);
|
||||
m_netSwitch->setEnabled(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
}else{
|
||||
m_wirelessConnectOpreation->setWirelessEnabled(enable);
|
||||
if (!enable) {
|
||||
// m_netSwitch->setEnabled(false);
|
||||
m_netSwitch->setChecked(false);
|
||||
m_netSwitch->setCheckable(false);
|
||||
m_activatedNetFrame->hide();
|
||||
m_activatedNetDivider->hide();
|
||||
m_inactivatedNetFrame->hide();
|
||||
|
|
|
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
|
|||
// window_hints.decorations = MWM_DECOR_BORDER;
|
||||
// XAtomHelper::getInstance()->setWindowMotifHint(w.winId(), window_hints);
|
||||
|
||||
w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint /*| Qt::X11BypassWindowManagerHint*/);
|
||||
// w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint /*| Qt::X11BypassWindowManagerHint*/);
|
||||
|
||||
|
||||
DbusAdaptor adaptor(&w);
|
||||
|
|
Loading…
Reference in New Issue