mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix(wireless): activated ap
Change-Id: Ia10b0b01499072ea8c44c61ea0a80c241baf6590
This commit is contained in:
parent
2c0b14e41b
commit
eb9ea570ff
Notes:
gerrit
2018-07-03 16:01:59 +08:00
Verified+1: <jenkins@deepin.com> Code-Review+2: hualet <mr.asianwang@gmail.com> Submitted-by: listenerri <listenerri@gmail.com> Submitted-at: Tue, 03 Jul 2018 16:01:58 +0800 Reviewed-on: https://cr.deepin.io/36194 Project: dde/dde-dock Branch: refs/heads/master
@ -107,7 +107,7 @@ WirelessList::WirelessList(WirelessDevice *deviceIter, QWidget *parent)
|
||||
|
||||
connect(m_updateAPTimer, &QTimer::timeout, this, &WirelessList::updateAPList);
|
||||
|
||||
connect(m_device, &WirelessDevice::activeConnectionChanged, m_updateAPTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
||||
connect(m_device, &WirelessDevice::activeConnectionChanged, this, &WirelessList::onActiveConnectionChanged);
|
||||
connect(m_device, static_cast<void (WirelessDevice:: *) (NetworkDevice::DeviceStatus stat) const>(&WirelessDevice::statusChanged), m_updateAPTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
||||
|
||||
connect(m_pwdDialog, &DInputDialog::textValueChanged, this, &WirelessList::onPwdDialogTextChanged);
|
||||
@ -423,3 +423,24 @@ void WirelessList::updateIndicatorPos()
|
||||
m_indicator->show();
|
||||
m_indicator->play();
|
||||
}
|
||||
|
||||
void WirelessList::onActiveConnectionChanged()
|
||||
{
|
||||
// 在这个方法中需要通过m_device->activeConnName()的信息设置m_activeAP的值
|
||||
// m_activeAP的值应该从m_apList中拿到,但在程序第一次启动后,当后端扫描无线网的数据还没有发过来,
|
||||
// 这时m_device中的ap list为空,导致本类初始化时调用loadAPList()后m_apList也是空的,
|
||||
// 那么也就无法给m_activeAP正确的值,所以在这里使用timer等待一下后端的数据,再执行遍历m_apList给m_activeAP赋值的操作
|
||||
if (m_device->enabled() && m_device->status() == NetworkDevice::Activated
|
||||
&& m_apList.size() == 0) {
|
||||
QTimer::singleShot(1000, [=]{onActiveConnectionChanged();});
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_apList.size(); ++i) {
|
||||
if (m_apList.at(i).ssid() == m_device->activeConnName()) {
|
||||
m_activeAP = m_apList.at(i);
|
||||
m_updateAPTimer->start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ private slots:
|
||||
void activateAP(const QString &apPath, const QString &ssid);
|
||||
void deactiveAP();
|
||||
void updateIndicatorPos();
|
||||
void onActiveConnectionChanged();
|
||||
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user