fix bug 146072

This commit is contained in:
jzxc95 2022-11-07 16:22:14 +08:00
parent dd8ae3a3b6
commit 08443a1df8
3 changed files with 21 additions and 0 deletions

View File

@ -155,6 +155,13 @@ void LanPage::initNetSwitch()
m_switchGsettings->set(WIRED_SWITCH, wiredEnable);
}
bool oldState;
if (getOldWiredSwitchState(oldState)) {
if (wiredEnable != oldState) {
m_wiredConnectOperation->setWiredEnabled(oldState);
}
}
if (m_devList.count() == 0) {
qDebug() << "[wiredSwitch]:init not enable when no device";
m_netSwitch->setChecked(false);

View File

@ -301,3 +301,16 @@ void getDeviceEnableState(int type, QMap<QString, bool> &map)
delete kdr;
kdr = nullptr;
}
bool getOldWiredSwitchState(bool state)
{
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
QVariant value = m_settings->value("lan_switch_opened");
if (!value.isValid())
return false;
state = value.toBool();
m_settings->remove("lan_switch_opened");
delete m_settings;
return true;
}

View File

@ -81,6 +81,7 @@ bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
QString getDefaultDeviceName(KyDeviceType deviceType);
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
void getDeviceEnableState(int type, QMap<QString, bool> &map);
bool getOldWiredSwitchState(bool state);
class TabPage : public QWidget
{