Merge pull request #81 from CrankyPants123/master
Fix bug#41156 segfault when dialog changed
This commit is contained in:
commit
b8dc9e9150
|
@ -1887,7 +1887,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
}
|
||||
QStringList wnames;
|
||||
int count = 0;
|
||||
|
||||
QString actWifiBssid = " ";
|
||||
for (int i = 1; i < slist.size(); i ++) {
|
||||
QString line = slist.at(i);
|
||||
QString wbssid = line.mid(indexBSsid, 17).trimmed();
|
||||
|
@ -1896,6 +1896,9 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
if (actWifiBssidList.contains(wbssid)) {
|
||||
actWifiName = wname;
|
||||
}
|
||||
if ("*" == line.mid(0,indexSignal).trimmed()){
|
||||
actWifiBssid = wbssid;
|
||||
}
|
||||
}
|
||||
|
||||
if (actWifiBssidList.size()==1 && actWifiBssidList.at(0)=="--") {
|
||||
|
@ -1916,7 +1919,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
continue; //若当前热点ssid名称和已经连接的wifi的ssid名称相同,但bssid不同,则跳过
|
||||
}
|
||||
}
|
||||
if (wnames.contains(wname)) {
|
||||
if (wnames.contains(wname) && wbssid != actWifiBssid) {
|
||||
continue; //过滤相同名称的wifi
|
||||
}
|
||||
|
||||
|
@ -1939,10 +1942,9 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
//只有5GHZ
|
||||
freqState = 2;
|
||||
}
|
||||
|
||||
if (wname != "" && wname != "--") {
|
||||
//qDebug() << "wifi的 bssid: " << wbssid << "当前连接的wifi的bssid: " << actWifiBssidList;
|
||||
if (actWifiBssidList.contains(wbssid) && wifiActState == 2) {
|
||||
if(actWifiBssid == wbssid && wifiActState == 2){
|
||||
//对于已经连接的wifi
|
||||
connect(ccf, SIGNAL(selectedOneWifiForm(QString,int)), this, SLOT(oneTopWifiFormSelected(QString,int)));
|
||||
connect(ccf, SIGNAL(disconnActiveWifi()), this, SLOT(activeWifiDisconn()));
|
||||
|
@ -1962,7 +1964,6 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
lbLoadUpImg->show();
|
||||
ccf->setTopItem(false);
|
||||
currSelNetName = "";
|
||||
|
||||
syslog(LOG_DEBUG, "already insert an active wifi in the top of wifi list");
|
||||
} else {
|
||||
//对于未连接的wifi
|
||||
|
|
|
@ -65,6 +65,7 @@ WpaWifiDialog::WpaWifiDialog(QWidget *parent, MainWindow *mainWindow, QString co
|
|||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")));
|
||||
// this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
|
@ -337,8 +338,8 @@ void WpaWifiDialog::changeDialog()
|
|||
if (securityCombox->currentIndex() == 0) {
|
||||
//无安全性
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
this->hide();
|
||||
DlgHideWifi *connHidWifi = new DlgHideWifi(0);
|
||||
this->close();
|
||||
DlgHideWifi *connHidWifi = new DlgHideWifi(0,mw);
|
||||
connHidWifi->show();
|
||||
connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
|
||||
}
|
||||
|
@ -346,7 +347,7 @@ void WpaWifiDialog::changeDialog()
|
|||
if (securityCombox->currentIndex() == 1) {
|
||||
//WPA 及 WPA2 个人
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
this->hide();
|
||||
this->close();
|
||||
DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(0, mw);
|
||||
connHidWifiWpa->show();
|
||||
connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
|
||||
|
|
|
@ -40,6 +40,7 @@ DlgHideWifi::DlgHideWifi(int type, MainWindow *mainWindow, QWidget *parent) :
|
|||
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) );
|
||||
//需要添加 void paintEvent(QPaintEvent *event) 函数
|
||||
|
||||
|
@ -139,13 +140,13 @@ void DlgHideWifi::changeDialog()
|
|||
qDebug()<<"it's not need to change dialog";
|
||||
} else if(ui->cbxSecurity->currentIndex()==1) {
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
this->hide();
|
||||
this->close();
|
||||
DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(0, mw);
|
||||
connHidWifiWpa->show();
|
||||
connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
|
||||
} else if(ui->cbxSecurity->currentIndex()==2) {
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
this->hide();
|
||||
this->close();
|
||||
WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, mw, "");
|
||||
QPoint pos = QCursor::pos();
|
||||
QRect primaryGeometry;
|
||||
|
|
|
@ -37,7 +37,7 @@ DlgHideWifiWpa::DlgHideWifiWpa(int type, MainWindow *mainWindow, QWidget *parent
|
|||
ui(new Ui::DlgHideWifiWpa)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) );
|
||||
|
@ -147,15 +147,15 @@ void DlgHideWifiWpa::changeDialog()
|
|||
{
|
||||
if (ui->cbxSecurity->currentIndex()==0) {
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
this->hide();
|
||||
DlgHideWifi *connHidWifi = new DlgHideWifi(0);
|
||||
this->close();
|
||||
DlgHideWifi *connHidWifi = new DlgHideWifi(0,mw);
|
||||
connHidWifi->show();
|
||||
connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
|
||||
} else if(ui->cbxSecurity->currentIndex()==1) {
|
||||
qDebug()<<"it's not need to change dialog";
|
||||
} else if(ui->cbxSecurity->currentIndex()==2) {
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
this->hide();
|
||||
this->close();
|
||||
WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, mw, "");
|
||||
QPoint pos = QCursor::pos();
|
||||
QRect primaryGeometry;
|
||||
|
|
Loading…
Reference in New Issue