From ab26f1eb92308a3c0edb83e4dc55b8911445a843 Mon Sep 17 00:00:00 2001 From: zhangjiaping Date: Mon, 21 Dec 2020 17:10:00 +0800 Subject: [PATCH] fix(add-wifi): Dialog is incorrect when choose wpa-wifi after chosen wep-wifi. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 修复点击加入个人wifi后点击企业Wifi弹窗有误的问题 Log: 修复点击加入个人wifi后点击企业Wifi弹窗有误的问题 Bug: - --- src/wpawifidialog.cpp | 2 +- wireless-security/dlghidewifiwpa.cpp | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/wpawifidialog.cpp b/src/wpawifidialog.cpp index 62fbd29c..0bbbabc3 100644 --- a/src/wpawifidialog.cpp +++ b/src/wpawifidialog.cpp @@ -413,7 +413,7 @@ void WpaWifiDialog::activateConnection() { qDebug() << "qDebug: 连接超时(12秒超时时间)"; }); //设置超时时间 - timeout->start(12 * 1000); + timeout->start(20 * 1000); }); connect(upThread, &UpConnThread::connRes, this, [ = ](int res) { qDebug()<<"qDebug: Connect result is: "< #include @@ -161,8 +162,31 @@ void DlgHideWifiWpa::changeDialog() } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); - DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, 0, mw); - connHidWifiEapPeap->show(); + WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, ""); + QPoint pos = QCursor::pos(); + QRect primaryGeometry; + for (QScreen *screen : qApp->screens()) { + if (screen->geometry().contains(pos)) { + primaryGeometry = screen->geometry(); + } + } + if (primaryGeometry.isEmpty()) { + primaryGeometry = qApp->primaryScreen()->geometry(); + } + wpadlg->move(primaryGeometry.width() / 2 - wpadlg->width() / 2, primaryGeometry.height() / 2 - wpadlg->height() / 2); + wpadlg->show(); + connect(wpadlg, &WpaWifiDialog::conn_done, this, [ = ]() { + QString txt(tr("Conn Wifi Success")); + mw->objKyDBus->showDesktopNotify(txt); + mw->on_btnWifiList_clicked(); + }); + connect(wpadlg, &WpaWifiDialog::conn_failed, this, [ = ]() { + QString txt(tr("Confirm your Wi-Fi password or usable of wireless card")); + mw->objKyDBus->showDesktopNotify(txt); + mw->on_btnWifiList_clicked(); + }); +// DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, 0, mw); +// connHidWifiEapPeap->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide();