From fd52d1f74145cf63e7b8f3e6d867256dc3d520fe Mon Sep 17 00:00:00 2001 From: chenlelin Date: Thu, 7 Jan 2021 14:08:37 +0800 Subject: [PATCH 1/3] Change show time of network speed --- src/mainwindow.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index dcb71143..65c9b11f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -314,6 +314,11 @@ void MainWindow::createListAreaUI() lbLoadDown->setStyleSheet("QLabel{font-size:14px;}"); lbLoadUp->setText("0KB/s"); lbLoadDown->setText("0KB/s."); + lbLoadUp->hide(); + lbLoadDown->hide(); + lbLoadUpImg->hide(); + lbLoadDownImg->hide(); + this->on_setNetSpeed(); scrollAreal->setStyleSheet("QScrollArea{border:none;}"); @@ -1205,17 +1210,6 @@ void MainWindow::onBtnNetListClicked(int flag) BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); -// lbLoadDown->show(); -// lbLoadUp->show(); -// lbLoadDownImg->show(); -// lbLoadUpImg->show(); -// if (iface->lstate != 0) { -// lbLoadDown->hide(); -// lbLoadUp->hide(); -// lbLoadDownImg->hide(); -// lbLoadUpImg->hide(); -// } - lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); @@ -1262,10 +1256,6 @@ void MainWindow::on_btnWifiList_clicked() BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); - lbLoadDown->show(); - lbLoadUp->show(); - lbLoadDownImg->show(); - lbLoadUpImg->show(); if (iface->wstate != 0) { lbLoadDown->hide(); lbLoadUp->hide(); From a333122a92615e9fd00c5d0282fc80a71a926083 Mon Sep 17 00:00:00 2001 From: zhangjiaping Date: Thu, 7 Jan 2021 14:21:03 +0800 Subject: [PATCH 2/3] fix(wifi): WifiList display incorrectly when choosen wifi can not be scanned. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 修复选择加入的wifi无法被扫描到的时候wifi列表显示错误的问题 Log: 修复选择加入的wifi无法被扫描到的时候wifi列表显示错误的问题 Bug: http://172.17.66.192/biz/bug-view-30060.html --- translations/kylin-nm_bo.ts | 147 ++++++++++++++------------- translations/kylin-nm_tr.ts | 147 ++++++++++++++------------- translations/kylin-nm_zh_CN.qm | Bin 21339 -> 21447 bytes translations/kylin-nm_zh_CN.ts | 147 ++++++++++++++------------- wireless-security/dlghidewifi.cpp | 27 ++++- wireless-security/dlghidewifiwpa.cpp | 62 ++++++++++- wireless-security/dlghidewifiwpa.h | 7 ++ 7 files changed, 326 insertions(+), 211 deletions(-) diff --git a/translations/kylin-nm_bo.ts b/translations/kylin-nm_bo.ts index 24f243f1..3eebc108 100644 --- a/translations/kylin-nm_bo.ts +++ b/translations/kylin-nm_bo.ts @@ -168,12 +168,14 @@ - + + Conn Wifi Success - + + Confirm your Wi-Fi password or usable of wireless card @@ -1093,70 +1095,77 @@ - + Add Hidden Wi-Fi - + Connection - + Wi-Fi name - + Wi-Fi security - + Password - + Cancel - + Connect - + C_reate… - + None - + WPA and WPA2 Personal - + WPA and WPA2 Enterprise - + + Conn Wifi Success - + + Confirm your Wi-Fi password or usable of wireless card + + + Selected Wifi has not been scanned. + + DlgHotspotCreate @@ -1210,170 +1219,172 @@ MainWindow - + kylin-nm - - + + Advanced - - - + + + Ethernet - + New LAN - + Hide WiFi - - + + Wifi - + HotSpot - + FlyMode - + No wireless card detected - - - - - + + + + + + Not connected - - - - - - - - - + + + + + + + + + + Disconnected - + Ethernet Networks - + Wifi Networks - + No usable network in the list - + Show MainWindow - + NetOn,IfName: - + No Other Wired Network Scheme - + No Other Wireless Network Scheme - - - - + + + + Wired connection - - - - + + + + Ethernet connection - + Without Lan Cable - + MAC Address Mismatch - + Confirm your Wi-Fi password or usable of wireless card - + Confirm your Wi-Fi password - - + + NetOn, - + Wired net is disconnected - + Wi-Fi is disconnected - + Conn Ethernet Success - + Conn Wifi Success @@ -1562,7 +1573,7 @@ - + WPA & WPA2 diff --git a/translations/kylin-nm_tr.ts b/translations/kylin-nm_tr.ts index 3c8b1862..b7c2a34b 100644 --- a/translations/kylin-nm_tr.ts +++ b/translations/kylin-nm_tr.ts @@ -182,12 +182,14 @@ - + + Conn Wifi Success Wi-Fi Bağlantısı Başarılı - + + Confirm your Wi-Fi password or usable of wireless card Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın @@ -1224,70 +1226,77 @@ Gizli Wi-Fi Ağına Bağlan - + Add Hidden Wi-Fi Gizli Wi-Fi Ekle - + Connection Bağlantı: - + Wi-Fi name Wi-Fi adı: - + Wi-Fi security Wi-Fi güvenlik: - + Password Parola: - + Cancel İptal - + Connect Bağlan - + C_reate… Oluştur... - + None Yok - + WPA and WPA2 Personal - + WPA and WPA2 Enterprise - + + Conn Wifi Success Wi-Fi Bağlantısı Başarılı - + + Confirm your Wi-Fi password or usable of wireless card Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın + + + Selected Wifi has not been scanned. + + WPA & WPA2 Personal WPA & WPA2 Kişisel @@ -1368,7 +1377,7 @@ MainWindow - + kylin-nm @@ -1377,15 +1386,15 @@ - - + + Advanced Gelişmiş - - - + + + Ethernet Kablolu Ağ @@ -1394,8 +1403,8 @@ Gizli Ağı Bağlan - - + + Wifi Wi-Fi @@ -1408,136 +1417,138 @@ Pasif - + HotSpot HotSpot - + FlyMode - + Show MainWindow Ana Pencereyi Göster - + No wireless card detected - - - - - + + + + + + Not connected Bağlanamadı - - - - - - - - - + + + + + + + + + + Disconnected Bağlantı Kesildi - + NetOn,IfName: - + No Other Wired Network Scheme Başka Kablolu Ağ Düzeni Yok - + No Other Wireless Network Scheme Başka Kablosuz Ağ Düzeni Yok - - - - + + + + Wired connection - - - - + + + + Ethernet connection - + Wired net is disconnected Kablolu ağ bağlantısı kesildi - + Wi-Fi is disconnected Kablosuz bağlantı kesildi - + Without Lan Cable - + MAC Address Mismatch - + Confirm your Wi-Fi password or usable of wireless card Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın - + Confirm your Wi-Fi password Wi-Fi parolasını doğrula - + Ethernet Networks Ethernet Ağları - + New LAN Yeni LAN - + Hide WiFi Gizli Wi-Fi - + No usable network in the list Listede kullanılabilir ağ yok - - + + NetOn, - + Wifi Networks Wi-Fi Ağları @@ -1566,7 +1577,7 @@ Kablosuz listesini şimdi güncelle - + Conn Ethernet Success Ethernet Bağlantısı Başarılı @@ -1575,7 +1586,7 @@ Ethernet Bağlantısı Hatası - + Conn Wifi Success Wi-Fi Bağlantısı Başarılı @@ -1807,7 +1818,7 @@ - + WPA & WPA2 diff --git a/translations/kylin-nm_zh_CN.qm b/translations/kylin-nm_zh_CN.qm index a6914a1f2a64826c9b994494a916a63c491a1707..d3a1e9a7b98c2a04584df9333ff0ddd9c0599763 100644 GIT binary patch delta 855 zcmXw%Ye-XZ7{;HoopZLcxvjG0C6r~Eq#5(prn6Bl+eeV^y~KmYTpkGs>)warel z0zxUE{;beZ0~Fl@Qu@Jn4ggXI_~)%a&SQnS_3dtNvLh3M*A2MiARIhREQHWC2Ji+5 zZ)w{V3f=bwK;|)6&5b~|t^Hv+w~Zxo&UlxT^9&pZ@~?4aMMFTr5pL^i8=&=Yt(|5d zubUg3Yy#2^td$FsUZ@hU_W~>OvC8B|M`WgshBy=c51Shki0IUo0p6{^m;ji|~c#&;DAle?A0s+)_x@qa>N$+K3NlR&dM zKNaQ)g1vMfpc)od#qK7pssKQ&JC65g+yT`=F~1*H_+50nA!`W6U@m>Jp36Y|s^y>F*ZaqI?_K z0nO5wjIfYr`E->DQ--KMJ56O77WU1i^&W%M{ee7&*c**U<=|MN);DjbvB42ZK~5MO zO8@bRv3tu#>MzMSdU!AO(!x$_ZOsAW^aPzE>xOA@@(=po9x1e)Rk*B6VfMHw?_w2w zU$4-XrZ96tVRp62-@kw&%`&}=KT2ISn7$Z#De90PSlOtikRkH<4ZmxorfbbbO|P}| z0wOS2D*dvrjxH}LE-cCLy{(DgR9pGD*xDv}5_j##Zun6R|NmjkFOj#%l{@4ri_c%} qw`{Jcw*4FK6bGdujmj! zEC$reZcS1Hg>Qh^ZU}8XfP4eOY%^f1a%-lc)$WK%d=JrKr`HjPmpVz8AhwSIf)3&* znofTNRkEjj? zmZ=AKdICvhLR3RJxv3G3Mjiv~HsREW9!T-xW2#bluh5<|O#3Eygu0=yN!ZwKqDm|J zgj27LyEXHkm{5EHPz{TDrgOxK77w%$JJlpQ-qL*Q}hJEds^5=(f1nCcfP-T(5HCdVb$ zN)C~#iMjZJ|cB_4X2WTAr8AD1%9yQws-I}$g)N%_& zy~vw2jrPvp#KExNb1**h5JYFgaH0tY; z{3)?nUswEJtMzxQPtqBq^&?l$Q%DnkAem)FzqLSN(oXOnlCKWPA 及 WPA2 企业 - + + Conn Wifi Success 连接无线网络成功 - + + Confirm your Wi-Fi password or usable of wireless card 请确认Wi-Fi密码或无线设备 @@ -1184,70 +1186,77 @@ 连接到隐藏 Wi-Fi 网络 - + Add Hidden Wi-Fi 加入隐藏Wi-Fi - + Connection 连接设置: - + Wi-Fi name 网络名称: - + Wi-Fi security Wi-Fi 安全性: - + Password 密码: - + Cancel 取消 - + Connect 连接 - + C_reate… 新建... - + None - + WPA and WPA2 Personal WPA 及 WPA2 个人 - + WPA and WPA2 Enterprise WPA 及 WPA2 企业 - + + Conn Wifi Success 连接无线网络成功 - + + Confirm your Wi-Fi password or usable of wireless card 请确认Wi-Fi密码或无线设备 + + + Selected Wifi has not been scanned. + 当前区域未扫描到选中的wifi + WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) @@ -1328,7 +1337,7 @@ MainWindow - + kylin-nm 网络工具 @@ -1337,15 +1346,15 @@ 网络 - - + + Advanced 设置网络 - - - + + + Ethernet 有线网络 @@ -1354,8 +1363,8 @@ 加入网络 - - + + Wifi 无线网络 @@ -1368,136 +1377,138 @@ 已关闭 - + HotSpot 个人热点 - + FlyMode 飞行模式 - + Show MainWindow 显示网络连接界面 - + No wireless card detected 未检测到无线网卡 - - - - - + + + + + + Not connected 当前未连接任何网络 - - - - - - - - - + + + + + + + + + + Disconnected 未连接 - + NetOn,IfName: 已连接,网卡: - + No Other Wired Network Scheme 列表中无其他有线网络 - + No Other Wireless Network Scheme 未检测到其他无线网络 - - - - + + + + Wired connection 有线连接 - - - - + + + + Ethernet connection 以太网连接 - + Wired net is disconnected 断开有线网络 - + Wi-Fi is disconnected 断开无线网络 - + Without Lan Cable 未插入对应网卡网线 - + MAC Address Mismatch 有线网MAC地址不匹配 - + Confirm your Wi-Fi password or usable of wireless card 请确认Wi-Fi密码或无线设备 - + Confirm your Wi-Fi password 请再次确认Wi-Fi密码 - + Ethernet Networks 可用有线网络列表 - + New LAN 新建网络 - + Hide WiFi 加入网络 - + No usable network in the list 列表暂无可连接网络 - - + + NetOn, 已连接, - + Wifi Networks 可用无线网络列表 @@ -1526,7 +1537,7 @@ 正在更新 Wi-Fi列表 - + Conn Ethernet Success 连接有线网络成功 @@ -1535,7 +1546,7 @@ 连接有线网络失败 - + Conn Wifi Success 连接无线网络成功 @@ -1759,7 +1770,7 @@ 连接 - + WPA & WPA2 WPA 及 WPA2企业 diff --git a/wireless-security/dlghidewifi.cpp b/wireless-security/dlghidewifi.cpp index b8d5e034..5f98e1e9 100644 --- a/wireless-security/dlghidewifi.cpp +++ b/wireless-security/dlghidewifi.cpp @@ -241,8 +241,31 @@ void DlgHideWifi::changeWindow(){ if (txt.indexOf("wpa-eap") != -1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); - DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, ui->cbxConn->currentIndex(), mw); - connHidWifiEapPeap->show(); +// DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, ui->cbxConn->currentIndex(), mw); +// connHidWifiEapPeap->show(); + WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, ui->cbxConn->currentText()); + 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(); + }); } }else { isUsed = ui->cbxConn->currentIndex(); diff --git a/wireless-security/dlghidewifiwpa.cpp b/wireless-security/dlghidewifiwpa.cpp index 79433346..3ca5ead0 100644 --- a/wireless-security/dlghidewifiwpa.cpp +++ b/wireless-security/dlghidewifiwpa.cpp @@ -257,8 +257,31 @@ void DlgHideWifiWpa::changeWindow() if (txt.indexOf("wpa-eap") != -1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); - DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, ui->cbxConn->currentIndex(), mw); - connHidWifiEapPeap->show(); +// DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, ui->cbxConn->currentIndex(), mw); +// connHidWifiEapPeap->show(); + WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, ui->cbxConn->currentText()); + 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(); + }); } }else { QApplication::setQuitOnLastWindowClosed(false); @@ -289,7 +312,7 @@ void DlgHideWifiWpa::on_btnConnect_clicked() QString wifiName = ui->leNetName->text(); QString wifiPassword = ui->lePassword->text(); - BackThread *bt = new BackThread(); + strWifiname = wifiName; strWifiPassword = wifiPassword; if (isUsed == 0) { @@ -326,12 +349,41 @@ void DlgHideWifiWpa::on_btnConnect_clicked() //QTimer::singleShot(8*1000, this, SLOT(on_execSecConn() )); }); } else { - bt->execConnWifi(wifiName); - QTimer::singleShot(4*1000, this, SLOT(emitSignal() )); + shellProcess = new QProcess(this); + shellProcess->start("nmcli -f ssid device wifi"); + connect(shellProcess, &QProcess::readyRead, [ = ]() { + QString output = shellProcess->readAll(); + shellOutput += output; + }); + connect(shellProcess, SIGNAL(finished(int)), this, SLOT(finishedProcess(int))); } this->close(); } +void DlgHideWifiWpa::finishedProcess(int state) { + if (! state) syslog(LOG_ERR, "Scan wifi list failed in functin on_btnConnect_clicked() in dlghidewifiwpa.cpp 359."); + wlist = shellOutput.split("\n"); + bool is_hidden = true; + foreach (QString wifi, wlist) { + if (wifi.trimmed() == ui->leNetName->text()) { + is_hidden = false; + } + } + if (! is_hidden) { + BackThread *bt = new BackThread(); + bt->execConnWifi(ui->leNetName->text()); + QTimer::singleShot(4*1000, this, SLOT(emitSignal() )); + } else { + //已保存的wifi没有在wifi列表找到(隐藏wifi保存后也会出现在wifi列表),则当前区域无法连接此wifi + syslog(LOG_DEBUG, "Choosen wifi can not be sacnned in finishedProcess() in dlghidewifiwpa.cpp 377."); + QString txt(tr("Selected Wifi has not been scanned.")); + mw->objKyDBus->showDesktopNotify(txt); + emit this->stopSignal(); + emit reSetWifiList(); + } + shellProcess->deleteLater(); +} + void DlgHideWifiWpa::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { diff --git a/wireless-security/dlghidewifiwpa.h b/wireless-security/dlghidewifiwpa.h index 1744d1d6..03c33810 100644 --- a/wireless-security/dlghidewifiwpa.h +++ b/wireless-security/dlghidewifiwpa.h @@ -22,6 +22,7 @@ #include #include #include +#include class MainWindow; @@ -58,6 +59,8 @@ private slots: void on_lePassword_textEdited(const QString &arg1); + void finishedProcess(int res); + signals: void reSetWifiList(); void stopSignal(); @@ -79,6 +82,10 @@ private: bool isPress; QPoint winPos; QPoint dragPos; + + QString shellOutput = ""; + QStringList wlist; + QProcess * shellProcess; }; #endif // DLGCONNHIDWIFIWPA_H From f6cc0d42ec340bbfd574e8e5476202a876633eda Mon Sep 17 00:00:00 2001 From: chenlelin Date: Thu, 7 Jan 2021 19:27:26 +0800 Subject: [PATCH 3/3] Fix bug wired network connect looply --- src/kylin-dbus-interface.cpp | 1 + src/mainwindow.cpp | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kylin-dbus-interface.cpp b/src/kylin-dbus-interface.cpp index c34fbafe..49269d46 100644 --- a/src/kylin-dbus-interface.cpp +++ b/src/kylin-dbus-interface.cpp @@ -1087,6 +1087,7 @@ void KylinDBus::connectWiredNet(QString netName) } dbusArgs.endArray(); + //获取到所需的信息后,接下来进行连接 QDBusReply connectionReply = m_interface.call("ActivateConnection", QVariant::fromValue(objNet), QVariant::fromValue(connWiredPath), diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 65c9b11f..cc7e7255 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1501,10 +1501,10 @@ void MainWindow::getLanListDone(QStringList slist) if (!objKyDBus->dbusLanIpv4.isEmpty()) { if (objKyDBus->dbusActiveLanIpv4 != objKyDBus->dbusLanIpv4) { //在第三方nm-connection-editor进行新的IP配置后,重新连接网络 - objKyDBus->connectWiredNet(nname); + //objKyDBus->connectWiredNet(nname); } else if ((oldActLanName == actLanSsidName.at(kk)) && (oldDbusActLanDNS != objKyDBus->dbusActLanDNS)) { //在第三方nm-connection-editor进行新的DNS配置后,重新连接网络 - objKyDBus->connectWiredNet(nname); + //objKyDBus->connectWiredNet(nname); } } @@ -1705,7 +1705,6 @@ void MainWindow::loadWifiListDone(QStringList slist) } if (wname != "" && wname != "--") { // 当前连接的wifi -// if (wname == actWifiName) { if (wname == actWifissid) { connect(ccf, SIGNAL(selectedOneWifiForm(QString,int)), this, SLOT(oneTopWifiFormSelected(QString,int))); connect(ccf, SIGNAL(disconnActiveWifi()), this, SLOT(activeWifiDisconn()));