Merge pull request #60 from mammonsama666/zjp-fix

fix(add-wifi): Dialog is incorrect when choose wpa-wifi after chosen wep-wifi.
This commit is contained in:
chenlelin 2020-12-21 17:14:19 +08:00 committed by GitHub
commit aaa665f57f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 3 deletions

View File

@ -413,7 +413,7 @@ void WpaWifiDialog::activateConnection() {
qDebug() << "qDebug: 连接超时12秒超时时间"; qDebug() << "qDebug: 连接超时12秒超时时间";
}); });
//设置超时时间 //设置超时时间
timeout->start(12 * 1000); timeout->start(20 * 1000);
}); });
connect(upThread, &UpConnThread::connRes, this, [ = ](int res) { connect(upThread, &UpConnThread::connRes, this, [ = ](int res) {
qDebug()<<"qDebug: Connect result is: "<<res; qDebug()<<"qDebug: Connect result is: "<<res;

View File

@ -22,6 +22,7 @@
#include "kylinheadfile.h" #include "kylinheadfile.h"
#include "src/backthread.h" #include "src/backthread.h"
#include "src/mainwindow.h" #include "src/mainwindow.h"
#include "src/wpawifidialog.h"
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -161,8 +162,31 @@ void DlgHideWifiWpa::changeDialog()
} else if(ui->cbxSecurity->currentIndex()==2) { } else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false); QApplication::setQuitOnLastWindowClosed(false);
this->hide(); this->hide();
DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, 0, mw); WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, "");
connHidWifiEapPeap->show(); 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) { } else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false); QApplication::setQuitOnLastWindowClosed(false);
this->hide(); this->hide();