interface update timely, add connect to hidden Wi-Fi

This commit is contained in:
chenlelin 2019-09-16 09:30:41 +08:00
parent e8cfa692dc
commit f93003c742
51 changed files with 10472 additions and 131 deletions

View File

@ -106,20 +106,18 @@ void BackThread::execDisWifi(){
}
void BackThread::execConnLan(QString connName){
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' > /tmp/kylin-nm-btoutput";
system(cmd.toUtf8().data());
QFile file("/tmp/kylin-nm-btoutput");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
QFile sys_carrier("/sys/class/net/enp3s0/carrier");
if(!sys_carrier.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug()<<"Can't open the file!"<<endl;
qDebug()<<"Can't open the system file carrier!"<<endl;
}
QString line = file.readLine();
file.close();
if(line.indexOf("successfully") != -1){
QString sys_line = sys_carrier.readLine();
sys_carrier.close();
if(sys_line.indexOf("1") != -1){
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "'";
system(cmd.toUtf8().data());
emit connDone(0);
}else{
} else {
emit connDone(1);
}
@ -127,7 +125,8 @@ void BackThread::execConnLan(QString connName){
}
void BackThread::execConnWifi(QString connName){
QString cmd = "/usr/share/kylin-nm/shell/connup.sh '" + connName + "'";
// QString cmd = "/usr/share/kylin-nm/shell/connup.sh '" + connName + "'";
QString cmd = "/home/chenlelin/kylin-nm/kylin-nm/connup.sh '" + connName + "'";
system(cmd.toUtf8().data());
QFile file("/tmp/kylin-nm-btoutput_");
@ -150,7 +149,6 @@ void BackThread::execConnWifi(QString connName){
}
void BackThread::execConnWifiPWD(QString connName, QString password){
qDebug()<<"once";
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli device wifi connect '" + connName + "' password '" + password + "' > /tmp/kylin-nm-btoutput";
system(cmd.toUtf8().data());

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
kylin-nm (1.0.3-0ubuntu1) eoan; urgency=medium
* Bug-fix:
- Fix the bug which can connect wired network without linking net cable
- Fix that unable update kylin-nm connect state after pluging in or out net cable
- Fix the wrong state of btnWifiList when change the usable state of Wi-Fi
* Update the display of Wi-Fi list timely by inserting a new Wi-Fi or delete a not exist Wi-Fi
* Add function to connect hidden wifi
-- handsome_feng <jianfengli@ubuntukylin.com> Wed, 11 Sep 2019 10:51:40 +0800
kylin-nm (1.0.2-0ubuntu1) eoan; urgency=medium
* Bug-fix only:

263
dlgconnhidwifi.cpp Normal file
View File

@ -0,0 +1,263 @@
#include "dlgconnhidwifi.h"
#include "kylinheadfile.h"
#include "ui_dlgconnhidwifi.h"
#include "backthread.h"
#include "mainwindow.h"
#include <unistd.h>
#include <QStandardItemModel>
DlgConnHidWifi::DlgConnHidWifi(int type, MainWindow *mainWindow, QWidget *parent) :
isUsed(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifi)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/no-pwd-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
// ui->cbxConn->setStyleSheet("QComboBox{padding-left:20px;font-size:13px;border:1px solid #aaaaaa;}"
// "QComboBox::drop-down{border:0;width:30px;}"
// "QComboBox::down-arrow{image:url(:/res/g/down_arrow.png);}");
// ui->cbxSecurity->setStyleSheet("QComboBox{padding-left:20px;font-size:13px;border:1px solid #aaaaaa;}"
// "QComboBox::drop-down{border:0;width:30px;}"
// "QComboBox::down-arrow{image:url(:/res/g/down_arrow.png);}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
connect(ui->cbxConn,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeWindow()));
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
ui->cbxSecurity->setCurrentIndex(0);
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog()));
if (isUsed == 0){
ui->btnConnect->setEnabled(false);
}else{
ui->cbxConn->setCurrentIndex(isUsed);
ui->leNetName->setText(ui->cbxConn->currentText());
ui->lbNetName->setEnabled(false);
ui->leNetName->setEnabled(false);
ui->lbSecurity->setEnabled(false);
ui->cbxSecurity->setEnabled(false);
ui->btnConnect->setEnabled(true);
}
this->setFixedSize(432,336);
this->mw = mainWindow;
}
DlgConnHidWifi::~DlgConnHidWifi()
{
delete ui;
}
void DlgConnHidWifi::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifi::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifi::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifi::changeDialog()
{
if(ui->cbxSecurity->currentIndex()==0){
qDebug()<<"it's not need to change dialog";
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0, mw);
connHidWifiWpa->show();
connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0);
connHidWifiSecTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1);
connHidWifiSecTls->show();
}
}
void DlgConnHidWifi::changeWindow(){
if (ui->cbxConn->currentIndex() == 0){
isUsed = ui->cbxConn->currentIndex();
ui->cbxConn->setCurrentIndex(0);
ui->leNetName->setText("");
ui->lbNetName->setEnabled(true);
ui->leNetName->setEnabled(true);
ui->lbSecurity->setEnabled(true);
ui->cbxSecurity->setEnabled(true);
ui->btnConnect->setEnabled(false);
}else if (ui->cbxConn->currentIndex() >= 1){
QString currStr = "nmcli connection show " + ui->cbxConn->currentText() + " >/tmp/kylin-nm-connshow";
system(currStr.toUtf8().data());
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
file.close();
if (txt.indexOf("802-11-wireless-security.key-mgmt:") != -1){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(ui->cbxConn->currentIndex(), mw);
connHidWifiWpa->show();
connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
}else {
isUsed = ui->cbxConn->currentIndex();
ui->leNetName->setText(ui->cbxConn->currentText());
ui->lbNetName->setEnabled(false);
ui->leNetName->setEnabled(false);
ui->lbSecurity->setEnabled(false);
ui->cbxSecurity->setEnabled(false);
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifi::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifi::on_btnConnect_clicked()
{
QThread *t = new QThread();
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
connect(t, SIGNAL(started()), this, SLOT(slotStartLoading()));
connect(this, SIGNAL(stopSignal()), t, SLOT(quit()));
t->start();
QString wifiName = ui->leNetName->text();
BackThread *bt = new BackThread();
strWifiname = wifiName;
//点击连接按钮以连接隐藏WiFi
if (isUsed == 0){
int x = 0;
do{
sleep(1);
QString cmd = "nmcli device wifi connect " + wifiName + " password '' hidden yes >/tmp/kylin-nm-btoutput";
system(cmd.toUtf8().data());
QFile file("/tmp/kylin-nm-btoutput");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug()<<"Can't open the file!"<<endl;
}
QString text = file.readAll();
file.close();
if(text.indexOf("Scanning not allowed") != -1){x = 1;} else { x = 0;}
} while(x);
connect(this, SIGNAL(execSecConn()), this,SLOT(on_execSecConn() ));
QTimer::singleShot(5*1000, this, SLOT(on_execSecConn() ));
} else {
bt->execConnWifi(wifiName);
connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() ));
QTimer::singleShot(4*1000, this, SLOT(emitSignal() ));
}
this->close();
}
void DlgConnHidWifi::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifi::slotStartLoading()
{
mw->startLoading();
}
void DlgConnHidWifi::on_execSecConn()
{
QString str = "nmcli device wifi connect " + strWifiname + " password ''";
system(str.toUtf8().data());
connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() ));
QTimer::singleShot(3*1000, this, SLOT(emitSignal() ));
}
void DlgConnHidWifi::emitSignal()
{
emit reSetWifiList();
mw->stopLoading();
emit this->stopSignal();
}

59
dlgconnhidwifi.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef DLGCONNHIDWIFI_H
#define DLGCONNHIDWIFI_H
#include <QDialog>
#include <QMouseEvent>
#include <QThread>
#include <QTimer>
#include <QFile>
class MainWindow;
namespace Ui {
class DlgConnHidWifi;
}
class DlgConnHidWifi : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifi(int type, MainWindow *mw = 0, QWidget *parent = 0);
~DlgConnHidWifi();
public slots:
void changeDialog();
void changeWindow();
void emitSignal();
void on_execSecConn();
void slotStartLoading();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_leNetName_textEdited(const QString &arg1);
signals:
void reSetWifiList();
void sendMessage();
void execSecConn();
void stopSignal();
private:
Ui::DlgConnHidWifi *ui;
int isUsed;//=0 current wifi not used before; >=1 used
MainWindow *mw;
QString strWifiname;
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFI_H

272
dlgconnhidwifi.ui Normal file
View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifi</class>
<widget class="QDialog" name="DlgConnHidWifi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>336</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>175</x>
<y>55</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>156</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>175</x>
<y>195</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>201</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>175</x>
<y>150</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>290</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>290</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>276</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>336</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbConn</zorder>
<zorder>cbxConn</zorder>
<zorder>lbNetName</zorder>
<zorder>cbxSecurity</zorder>
<zorder>lbSecurity</zorder>
<zorder>leNetName</zorder>
<zorder>btnConnect</zorder>
<zorder>btnCancel</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

169
dlgconnhidwifileap.cpp Normal file
View File

@ -0,0 +1,169 @@
#include "ui_dlgconnhidwifileap.h"
#include "kylinheadfile.h"
DlgConnHidWifiLeap::DlgConnHidWifiLeap(QWidget *parent) :
QDialog(parent),
ui(new Ui::DlgConnHidWifiLeap)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/no-pwd-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->lbUserName->setText(tr("Username")); //用户名:
ui->lbPassword->setText(tr("Password")); //密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
ui->cbxSecurity->setCurrentIndex(4);
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog()));
ui->btnConnect->setEnabled(false);
this->setFixedSize(432,412);
}
DlgConnHidWifiLeap::~DlgConnHidWifiLeap()
{
delete ui;
}
void DlgConnHidWifiLeap::changeDialog()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
qDebug()<<"it's not need to change dialog";
} else if(ui->cbxSecurity->currentIndex()==5) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0);
connHidWifiSecTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1);
connHidWifiSecTls->show();
}
}
void DlgConnHidWifiLeap::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiLeap::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiLeap::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword ->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiLeap::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == "" || ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leNetName->text() == "" || ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == "" || ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiLeap::on_leUserName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiLeap::on_lePassword_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}

47
dlgconnhidwifileap.h Normal file
View File

@ -0,0 +1,47 @@
#ifndef DLGCONNHIDWIFILEAP_H
#define DLGCONNHIDWIFILEAP_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiLeap;
}
class DlgConnHidWifiLeap : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiLeap(QWidget *parent = 0);
~DlgConnHidWifiLeap();
public slots:
void changeDialog();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_checkBoxPwd_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_leUserName_textEdited(const QString &arg1);
void on_lePassword_textEdited(const QString &arg1);
private:
Ui::DlgConnHidWifiLeap *ui;
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFILEAP_H

359
dlgconnhidwifileap.ui Normal file
View File

@ -0,0 +1,359 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiLeap</class>
<widget class="QDialog" name="DlgConnHidWifiLeap">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>412</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QLineEdit" name="leUserName">
<property name="geometry">
<rect>
<x>175</x>
<y>240</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>175</x>
<y>195</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>366</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>175</x>
<y>55</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbUserName">
<property name="geometry">
<rect>
<x>76</x>
<y>246</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwd">
<property name="geometry">
<rect>
<x>332</x>
<y>297</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbPassword">
<property name="geometry">
<rect>
<x>76</x>
<y>291</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>156</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>201</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>366</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="lePassword">
<property name="geometry">
<rect>
<x>175</x>
<y>285</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>175</x>
<y>150</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>352</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>412</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>leUserName</zorder>
<zorder>cbxSecurity</zorder>
<zorder>btnCancel</zorder>
<zorder>lbConn</zorder>
<zorder>cbxConn</zorder>
<zorder>lbUserName</zorder>
<zorder>lbPassword</zorder>
<zorder>lbNetName</zorder>
<zorder>lbSecurity</zorder>
<zorder>btnConnect</zorder>
<zorder>lePassword</zorder>
<zorder>leNetName</zorder>
<zorder>checkBoxPwd</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

307
dlgconnhidwifisecfast.cpp Normal file
View File

@ -0,0 +1,307 @@
#include "dlgconnhidwifisecfast.h"
#include "ui_dlgconnhidwifisecfast.h"
#include "kylinheadfile.h"
DlgConnHidWifiSecFast::DlgConnHidWifiSecFast(int type, QWidget *parent) :
WepOrWpa(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiSecFast)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->lbAuth->setText(tr("Authentication")); //认证:
ui->lbAnonyId->setText(tr("Anonymous identity")); //匿名身份:
ui->checkBoxAutoPCA->setText(tr("Allow automatic PAC pro_visioning")); //自动PAC配置:
ui->lbPCAfile->setText(tr("PAC file"));//PAC文件:
ui->lbInnerAuth->setText(tr("Inner authentication")); //内部认证:
ui->lbUserName->setText(tr("Username")); //用户名:
ui->lbPassword->setText(tr("Password")); //密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
if (WepOrWpa == 0) {
ui->cbxSecurity->setCurrentIndex(5);
} else if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(6);
}
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu()));
ui->cbxAuth->addItem("TLS");
ui->cbxAuth->addItem("LEAP");
ui->cbxAuth->addItem("PWD");
ui->cbxAuth->addItem("FAST");
ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS
ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP
ui->cbxAuth->setCurrentIndex(3);
connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth()));
ui->checkBoxAutoPCA->setCheckState(Qt::Checked);
ui->cbxAutoPCA->addItem(tr("Anonymous")); //匿名
ui->cbxAutoPCA->addItem(tr("Authenticated")); //已认证
ui->cbxAutoPCA->addItem(tr("Both")); //两者兼用
ui->cbxAutoPCA->setCurrentIndex(0);
ui->lePCAfile->setText(tr("None")); //(无)
ui->cbxInnerAuth->addItem("GTC");
ui->cbxInnerAuth->addItem("MSCHAPv2");
ui->cbxInnerAuth->setCurrentIndex(0);
ui->btnConnect->setEnabled(false);
this->setFixedSize(432,651);
}
DlgConnHidWifiSecFast::~DlgConnHidWifiSecFast()
{
delete ui;
}
void DlgConnHidWifiSecFast::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiSecFast::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiSecFast::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiLeap::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiLeap::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiLeap::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiSecFast::changeDialogSecu()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(5);
WepOrWpa = 0;
}
} else {
if (WepOrWpa == 0){
ui->cbxSecurity->setCurrentIndex(6);
WepOrWpa = 1;
}
}
}
void DlgConnHidWifiSecFast::changeDialogAuth()
{
if(ui->cbxAuth->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa);
connHidWifiSecTls->show();
} else if(ui->cbxAuth->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa);
connHidWifiSecLeap->show();
} else if(ui->cbxAuth->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa);
connHidWifiSecPwd->show();
} else if(ui->cbxAuth->currentIndex()==3) {
qDebug()<<"it's not need to change dialog";
} else if(ui->cbxAuth->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa);
connHidWifiSecTuTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa);
connHidWifiSecPeap->show();
}
}
void DlgConnHidWifiSecFast::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiSecFast::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiSecFast::on_checkBoxAutoPCA_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->cbxAutoPCA->setEnabled(false);
} else {
ui->cbxAutoPCA->setEnabled(true);
}
}
void DlgConnHidWifiSecFast::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword ->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecFast::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if(ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecFast::on_leAnonyId_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if(ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecFast::on_leUserName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if(ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecFast::on_lePassword_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if(ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}

53
dlgconnhidwifisecfast.h Normal file
View File

@ -0,0 +1,53 @@
#ifndef DLGCONNHIDWIFISECFAST_H
#define DLGCONNHIDWIFISECFAST_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiSecFast;
}
class DlgConnHidWifiSecFast : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiSecFast(int type, QWidget *parent = 0);
~DlgConnHidWifiSecFast();
public slots:
void changeDialogSecu();
void changeDialogAuth();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_checkBoxAutoPCA_stateChanged(int arg1);
void on_checkBoxPwd_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_leAnonyId_textEdited(const QString &arg1);
void on_leUserName_textEdited(const QString &arg1);
void on_lePassword_textEdited(const QString &arg1);
private:
Ui::DlgConnHidWifiSecFast *ui;
int WepOrWpa = 0;//0 WEP;1WPA
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFISECFAST_H

563
dlgconnhidwifisecfast.ui Normal file
View File

@ -0,0 +1,563 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiSecFast</class>
<widget class="QDialog" name="DlgConnHidWifiSecFast">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>651</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QCheckBox" name="checkBoxPwd">
<property name="geometry">
<rect>
<x>332</x>
<y>522</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>156</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>180</x>
<y>150</y>
<width>182</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAuth">
<property name="geometry">
<rect>
<x>180</x>
<y>240</y>
<width>182</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="lePassword">
<property name="geometry">
<rect>
<x>180</x>
<y>510</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLineEdit" name="leUserName">
<property name="geometry">
<rect>
<x>180</x>
<y>465</y>
<width>182</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbUserName">
<property name="geometry">
<rect>
<x>76</x>
<y>471</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>180</x>
<y>195</y>
<width>182</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbPassword">
<property name="geometry">
<rect>
<x>76</x>
<y>516</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>605</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>180</x>
<y>55</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>246</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>201</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>605</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbAnonyId">
<property name="geometry">
<rect>
<x>76</x>
<y>291</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leAnonyId">
<property name="geometry">
<rect>
<x>180</x>
<y>285</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxAutoPCA">
<property name="geometry">
<rect>
<x>76</x>
<y>336</y>
<width>95</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAutoPCA">
<property name="geometry">
<rect>
<x>180</x>
<y>330</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbPCAfile">
<property name="geometry">
<rect>
<x>76</x>
<y>381</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="lePCAfile">
<property name="geometry">
<rect>
<x>180</x>
<y>375</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbInnerAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>426</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxInnerAuth">
<property name="geometry">
<rect>
<x>180</x>
<y>420</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>651</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>591</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>lbNetName</zorder>
<zorder>leNetName</zorder>
<zorder>lbConn</zorder>
<zorder>cbxAuth</zorder>
<zorder>lePassword</zorder>
<zorder>leUserName</zorder>
<zorder>lbUserName</zorder>
<zorder>cbxSecurity</zorder>
<zorder>lbPassword</zorder>
<zorder>btnConnect</zorder>
<zorder>cbxConn</zorder>
<zorder>lbAuth</zorder>
<zorder>lbSecurity</zorder>
<zorder>btnCancel</zorder>
<zorder>lbAnonyId</zorder>
<zorder>leAnonyId</zorder>
<zorder>checkBoxAutoPCA</zorder>
<zorder>cbxAutoPCA</zorder>
<zorder>lbPCAfile</zorder>
<zorder>lePCAfile</zorder>
<zorder>lbInnerAuth</zorder>
<zorder>cbxInnerAuth</zorder>
<zorder>checkBoxPwd</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

240
dlgconnhidwifisecleap.cpp Normal file
View File

@ -0,0 +1,240 @@
#include "dlgconnhidwifisecleap.h"
#include "ui_dlgconnhidwifisecleap.h"
#include "kylinheadfile.h"
DlgConnHidWifiSecLeap::DlgConnHidWifiSecLeap(int type, QWidget *parent) :
WepOrWpa(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiSecLeap)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->lbAuth->setText(tr("Authentication")); //认证:
ui->lbUserName->setText(tr("Username")); //用户名:
ui->lbPassword->setText(tr("Password")); //密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
if (WepOrWpa == 0) {
ui->cbxSecurity->setCurrentIndex(5);
} else if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(6);
}
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu()));
ui->cbxAuth->addItem("TLS");
ui->cbxAuth->addItem("LEAP");
ui->cbxAuth->addItem("PWD");
ui->cbxAuth->addItem("FAST");
ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS
ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP
ui->cbxAuth->setCurrentIndex(1);
connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth()));
ui->btnConnect->setEnabled(false);
this->setFixedSize(432,471);
}
DlgConnHidWifiSecLeap::~DlgConnHidWifiSecLeap()
{
delete ui;
}
void DlgConnHidWifiSecLeap::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiSecLeap::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiSecLeap::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiSecLeap::changeDialogSecu()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(5);
WepOrWpa = 0;
}
} else {
if (WepOrWpa == 0){
ui->cbxSecurity->setCurrentIndex(6);
WepOrWpa = 1;
}
}
}
void DlgConnHidWifiSecLeap::changeDialogAuth()
{
if(ui->cbxAuth->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa);
connHidWifiSecTls->show();
} else if(ui->cbxAuth->currentIndex()==1) {
qDebug()<<"it's not need to change dialog";
} else if(ui->cbxAuth->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa);
connHidWifiSecPwd->show();
} else if(ui->cbxAuth->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa);
connHidWifiSecFast->show();
} else if(ui->cbxAuth->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa);
connHidWifiSecTuTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa);
connHidWifiSecPeap->show();
}
}
void DlgConnHidWifiSecLeap::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiSecLeap::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiSecLeap::on_checkBox_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword ->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecLeap::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecLeap::on_leUserName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecLeap::on_lePassword_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}

48
dlgconnhidwifisecleap.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef DLGCONNHIDWIFISECLEAP_H
#define DLGCONNHIDWIFISECLEAP_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiSecLeap;
}
class DlgConnHidWifiSecLeap : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiSecLeap(int type, QWidget *parent = 0);
~DlgConnHidWifiSecLeap();
public slots:
void changeDialogSecu();
void changeDialogAuth();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_checkBox_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_leUserName_textEdited(const QString &arg1);
void on_lePassword_textEdited(const QString &arg1);
private:
Ui::DlgConnHidWifiSecLeap *ui;
int WepOrWpa = 0;//0 WEP;1WPA
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFISECLEAP_H

400
dlgconnhidwifisecleap.ui Normal file
View File

@ -0,0 +1,400 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiSecLeap</class>
<widget class="QDialog" name="DlgConnHidWifiSecLeap">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>471</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>175</x>
<y>195</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="lePassword">
<property name="geometry">
<rect>
<x>175</x>
<y>330</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>332</x>
<y>342</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>156</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>201</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leUserName">
<property name="geometry">
<rect>
<x>175</x>
<y>285</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>425</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>175</x>
<y>55</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbUserName">
<property name="geometry">
<rect>
<x>76</x>
<y>291</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>425</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAuth">
<property name="geometry">
<rect>
<x>175</x>
<y>240</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>246</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>175</x>
<y>150</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbPassword">
<property name="geometry">
<rect>
<x>76</x>
<y>336</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>471</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>411</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>cbxSecurity</zorder>
<zorder>lePassword</zorder>
<zorder>checkBox</zorder>
<zorder>lbNetName</zorder>
<zorder>lbSecurity</zorder>
<zorder>leUserName</zorder>
<zorder>btnConnect</zorder>
<zorder>cbxConn</zorder>
<zorder>lbUserName</zorder>
<zorder>btnCancel</zorder>
<zorder>cbxAuth</zorder>
<zorder>lbAuth</zorder>
<zorder>leNetName</zorder>
<zorder>lbPassword</zorder>
<zorder>lbConn</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

416
dlgconnhidwifisecpeap.cpp Normal file
View File

@ -0,0 +1,416 @@
#include "dlgconnhidwifisecpeap.h"
#include "ui_dlgconnhidwifisecpeap.h"
#include "kylinheadfile.h"
DlgConnHidWifiSecPeap::DlgConnHidWifiSecPeap(int type, QWidget *parent) :
WepOrWpa(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiSecPeap)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->checkBoxPwdSec->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->lbAuth->setText(tr("Authentication")); //认证:
ui->lbAnonyId->setText(tr("Anonymous identity")); //匿名身份:
ui->lbDomain->setText(tr("Domain")); //域名:
ui->lbCA->setText(tr("CA certificate")); //CA 证书:
ui->lbCaPwd->setText(tr("CA certificate password")); //CA 证书密码:
ui->checkBoxCA->setText(tr("No CA certificate is required")); //不需要CA证书
ui->lbPEAPver->setText(tr("PEAP version")); //PEAP版本:
ui->lbInnerAuth->setText(tr("Inner authentication")); //内部认证:
ui->lbUserName->setText(tr("Username")); //用户名:
ui->lbPassword->setText(tr("Password")); //密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem("新建...");
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
if (WepOrWpa == 0) {
ui->cbxSecurity->setCurrentIndex(5);
} else if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(6);
}
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu()));
ui->cbxAuth->addItem("TLS");
ui->cbxAuth->addItem("LEAP");
ui->cbxAuth->addItem("PWD");
ui->cbxAuth->addItem("FAST");
ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS
ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP
ui->cbxAuth->setCurrentIndex(5);
connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth()));
ui->cbxCA->addItem(tr("None")); //无
ui->cbxCA->addItem(tr("Choose from file")); //从文件选择...
ui->cbxCA->setCurrentIndex(0);
ui->cbxPEAPver->addItem(tr("Automatic")); //自动
ui->cbxPEAPver->addItem(tr("Version 0")); //版本 0
ui->cbxPEAPver->addItem(tr("Version 1")); //版本 1
ui->cbxPEAPver->setCurrentIndex(0);
ui->cbxInnerAuth->addItem("MSCHAPv2");
ui->cbxInnerAuth->addItem("MDS");
ui->cbxInnerAuth->addItem("GTC");
ui->cbxInnerAuth->setCurrentIndex(0);
ui->btnConnect->setEnabled(false);
this->setFixedSize(432,680);
}
DlgConnHidWifiSecPeap::~DlgConnHidWifiSecPeap()
{
delete ui;
}
void DlgConnHidWifiSecPeap::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiSecPeap::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiSecPeap::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiSecTls::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiSecTls::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiSecTls::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiSecPeap::changeDialogSecu()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(5);
WepOrWpa = 0;
}
} else {
if (WepOrWpa == 0){
ui->cbxSecurity->setCurrentIndex(6);
WepOrWpa = 1;
}
}
}
void DlgConnHidWifiSecPeap::changeDialogAuth()
{
if(ui->cbxAuth->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa);
connHidWifiSecTls->show();
} else if(ui->cbxAuth->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa);
connHidWifiSecLeap->show();
} else if(ui->cbxAuth->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa);
connHidWifiSecPwd->show();
} else if(ui->cbxAuth->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa);
connHidWifiSecFast->show();
} else if(ui->cbxAuth->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa);
connHidWifiSecTuTls->show();
} else {
qDebug()<<"it's not need to change dialog";
}
}
void DlgConnHidWifiSecPeap::on_cbxCA_currentIndexChanged(const QString &arg1)
{
if (ui->cbxCA->currentIndex() == 0){
ui->leCaPwd->setText("");
ui->lbCaPwd->setEnabled(false);
ui->leCaPwd->setEnabled(false);
} else {
ui->leCaPwd->setText("");
ui->lbCaPwd->setEnabled(true);
ui->leCaPwd->setEnabled(true);
}
}
void DlgConnHidWifiSecPeap::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiSecPeap::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiSecPeap::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->leCaPwd->setEchoMode(QLineEdit::Password);
} else {
ui->leCaPwd->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecPeap::on_checkBoxCA_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->cbxCA->setCurrentIndex(0);
ui->leCaPwd->setText("");
ui->lbCA->setEnabled(true);
ui->cbxCA->setEnabled(true);
} else {
ui->cbxCA->setCurrentIndex(0);
ui->leCaPwd->setText("");
ui->lbCA->setEnabled(false);
ui->cbxCA->setEnabled(false);
}
}
void DlgConnHidWifiSecPeap::on_checkBoxPwdSec_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecPeap::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecPeap::on_leAnonyId_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecPeap::on_leDomain_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecPeap::on_leCaPwd_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecPeap::on_leUserName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecPeap::on_lePassword_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}

60
dlgconnhidwifisecpeap.h Normal file
View File

@ -0,0 +1,60 @@
#ifndef DLGCONNHIDWIFISECPEAP_H
#define DLGCONNHIDWIFISECPEAP_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiSecPeap;
}
class DlgConnHidWifiSecPeap : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiSecPeap(int type, QWidget *parent = 0);
~DlgConnHidWifiSecPeap();
public slots:
void changeDialogSecu();
void changeDialogAuth();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_cbxCA_currentIndexChanged(const QString &arg1);
void on_checkBoxPwd_stateChanged(int arg1);
void on_checkBoxCA_stateChanged(int arg1);
void on_checkBoxPwdSec_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_leAnonyId_textEdited(const QString &arg1);
void on_leDomain_textEdited(const QString &arg1);
void on_leCaPwd_textEdited(const QString &arg1);
void on_leUserName_textEdited(const QString &arg1);
void on_lePassword_textEdited(const QString &arg1);
private:
Ui::DlgConnHidWifiSecPeap *ui;
int WepOrWpa = 0;//0 WEP;1WPA
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFISECPEAP_H

678
dlgconnhidwifisecpeap.ui Normal file
View File

@ -0,0 +1,678 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiSecPeap</class>
<widget class="QDialog" name="DlgConnHidWifiSecPeap">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>680</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>180</x>
<y>125</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QComboBox" name="cbxCA">
<property name="geometry">
<rect>
<x>180</x>
<y>325</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leDomain">
<property name="geometry">
<rect>
<x>180</x>
<y>285</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>180</x>
<y>55</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="leCaPwd">
<property name="geometry">
<rect>
<x>180</x>
<y>365</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>634</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>180</x>
<y>165</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="leAnonyId">
<property name="geometry">
<rect>
<x>180</x>
<y>245</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxCA">
<property name="geometry">
<rect>
<x>183</x>
<y>405</y>
<width>200</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>130</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>634</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbDomain">
<property name="geometry">
<rect>
<x>76</x>
<y>290</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbCaPwd">
<property name="geometry">
<rect>
<x>76</x>
<y>370</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwdSec">
<property name="geometry">
<rect>
<x>340</x>
<y>577</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwd">
<property name="geometry">
<rect>
<x>357</x>
<y>377</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>170</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxPEAPver">
<property name="geometry">
<rect>
<x>180</x>
<y>445</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>210</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbPEAPver">
<property name="geometry">
<rect>
<x>76</x>
<y>450</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAuth">
<property name="geometry">
<rect>
<x>180</x>
<y>205</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbCA">
<property name="geometry">
<rect>
<x>76</x>
<y>330</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbAnonyId">
<property name="geometry">
<rect>
<x>76</x>
<y>250</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbPassword">
<property name="geometry">
<rect>
<x>76</x>
<y>570</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leUserName">
<property name="geometry">
<rect>
<x>180</x>
<y>525</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QComboBox" name="cbxInnerAuth">
<property name="geometry">
<rect>
<x>180</x>
<y>485</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="lePassword">
<property name="geometry">
<rect>
<x>180</x>
<y>565</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLabel" name="lbInnerAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>490</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUserName">
<property name="geometry">
<rect>
<x>76</x>
<y>530</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>680</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>620</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>leNetName</zorder>
<zorder>cbxCA</zorder>
<zorder>lbConn</zorder>
<zorder>leDomain</zorder>
<zorder>cbxConn</zorder>
<zorder>leCaPwd</zorder>
<zorder>btnConnect</zorder>
<zorder>cbxSecurity</zorder>
<zorder>leAnonyId</zorder>
<zorder>checkBoxCA</zorder>
<zorder>lbNetName</zorder>
<zorder>btnCancel</zorder>
<zorder>lbDomain</zorder>
<zorder>lbCaPwd</zorder>
<zorder>checkBoxPwd</zorder>
<zorder>lbSecurity</zorder>
<zorder>cbxPEAPver</zorder>
<zorder>lbAuth</zorder>
<zorder>lbPEAPver</zorder>
<zorder>cbxAuth</zorder>
<zorder>lbCA</zorder>
<zorder>lbAnonyId</zorder>
<zorder>lbPassword</zorder>
<zorder>leUserName</zorder>
<zorder>cbxInnerAuth</zorder>
<zorder>lePassword</zorder>
<zorder>lbInnerAuth</zorder>
<zorder>lbUserName</zorder>
<zorder>checkBoxPwdSec</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

240
dlgconnhidwifisecpwd.cpp Normal file
View File

@ -0,0 +1,240 @@
#include "dlgconnhidwifisecpwd.h"
#include "ui_dlgconnhidwifisecpwd.h"
#include "kylinheadfile.h"
DlgConnHidWifiSecPwd::DlgConnHidWifiSecPwd(int type, QWidget *parent) :
WepOrWpa(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiSecPwd)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->lbAuth->setText(tr("Authentication")); //认证:
ui->lbUserName->setText(tr("Username")); //用户名:
ui->lbPassword->setText(tr("Password")); //密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
if (WepOrWpa == 0) {
ui->cbxSecurity->setCurrentIndex(5);
} else if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(6);
}
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu()));
ui->cbxAuth->addItem("TLS");
ui->cbxAuth->addItem("LEAP");
ui->cbxAuth->addItem("PWD");
ui->cbxAuth->addItem("FAST");
ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS
ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP
ui->cbxAuth->setCurrentIndex(2);
connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth()));
ui->btnConnect->setEnabled(false);
this->setFixedSize(432,471);
}
DlgConnHidWifiSecPwd::~DlgConnHidWifiSecPwd()
{
delete ui;
}
void DlgConnHidWifiSecPwd::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiSecPwd::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiSecPwd::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiSecPwd::changeDialogSecu()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(5);
WepOrWpa = 0;
}
} else {
if (WepOrWpa == 0){
ui->cbxSecurity->setCurrentIndex(6);
WepOrWpa = 1;
}
}
}
void DlgConnHidWifiSecPwd::changeDialogAuth()
{
if(ui->cbxAuth->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa);
connHidWifiSecTls->show();
} else if(ui->cbxAuth->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa);
connHidWifiSecLeap->show();
} else if(ui->cbxAuth->currentIndex()==2) {
qDebug()<<"it's not need to change dialog";
} else if(ui->cbxAuth->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa);
connHidWifiSecFast->show();
} else if(ui->cbxAuth->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa);
connHidWifiSecTuTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa);
connHidWifiSecPeap->show();
}
}
void DlgConnHidWifiSecPwd::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiSecPwd::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiSecPwd::on_checkBox_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword ->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecPwd::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecPwd::on_leUserName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecPwd::on_lePassword_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}

49
dlgconnhidwifisecpwd.h Normal file
View File

@ -0,0 +1,49 @@
#ifndef DLGCONNHIDWIFISECPWD_H
#define DLGCONNHIDWIFISECPWD_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiSecPwd;
}
class DlgConnHidWifiSecPwd : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiSecPwd(int type, QWidget *parent = 0);
~DlgConnHidWifiSecPwd();
public slots:
void changeDialogSecu();
void changeDialogAuth();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_checkBox_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_leUserName_textEdited(const QString &arg1);
void on_lePassword_textEdited(const QString &arg1);
private:
Ui::DlgConnHidWifiSecPwd *ui;
int WepOrWpa = 0;//0 WEP;1WPA
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFISECPWD_H

400
dlgconnhidwifisecpwd.ui Normal file
View File

@ -0,0 +1,400 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiSecPwd</class>
<widget class="QDialog" name="DlgConnHidWifiSecPwd">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>471</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>336</x>
<y>346</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>425</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>471</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>175</x>
<y>150</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>246</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUserName">
<property name="geometry">
<rect>
<x>76</x>
<y>291</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>175</x>
<y>55</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>411</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>425</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>175</x>
<y>195</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="leUserName">
<property name="geometry">
<rect>
<x>175</x>
<y>285</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLineEdit" name="lePassword">
<property name="geometry">
<rect>
<x>175</x>
<y>330</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>156</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>201</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbPassword">
<property name="geometry">
<rect>
<x>76</x>
<y>336</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAuth">
<property name="geometry">
<rect>
<x>175</x>
<y>240</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<zorder>lbUpback</zorder>
<zorder>lbBottomback</zorder>
<zorder>lbBoder</zorder>
<zorder>checkBox</zorder>
<zorder>btnCancel</zorder>
<zorder>leNetName</zorder>
<zorder>lbAuth</zorder>
<zorder>lbUserName</zorder>
<zorder>lbConn</zorder>
<zorder>cbxConn</zorder>
<zorder>btnConnect</zorder>
<zorder>cbxSecurity</zorder>
<zorder>leUserName</zorder>
<zorder>lePassword</zorder>
<zorder>lbNetName</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbSecurity</zorder>
<zorder>lbPassword</zorder>
<zorder>cbxAuth</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

540
dlgconnhidwifisectls.cpp Normal file
View File

@ -0,0 +1,540 @@
#include "ui_dlgconnhidwifisectls.h"
#include "kylinheadfile.h"
DlgConnHidWifiSecTls::DlgConnHidWifiSecTls(int type, QWidget *parent) :
WepOrWpa(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiSecTls)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->lbAuth->setText(tr("Authentication")); //认证:
ui->lbIdentity->setText(tr("Identity")); //身份:
ui->lbDomain->setText(tr("Domain")); //域名:
ui->lbCA->setText(tr("CA certificate")); //CA 证书:
ui->lbCaPwd->setText(tr("CA certificate password")); //CA 证书密码:
ui->checkBoxCA->setText(tr("No CA certificate is required")); //不需要CA证书
ui->lbUserCertify->setText(tr("User certificate")); //用户证书:
ui->lbUserCertifyPwd->setText(tr("User certificate password")); //用户证书密码:
ui->lbUserPriKey->setText(tr("User private key")); //用户私钥:
ui->lbUserKeyPwd->setText(tr("User key password")); //用户密钥密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
if (WepOrWpa == 0) {
ui->cbxSecurity->setCurrentIndex(5);
} else if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(6);
}
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu()));
ui->cbxAuth->addItem("TLS");
ui->cbxAuth->addItem("LEAP");
ui->cbxAuth->addItem("PWD");
ui->cbxAuth->addItem("FAST");
ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS
ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP
ui->cbxAuth->setCurrentIndex(0);
connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth()));
ui->cbxCA->addItem(tr("None")); //无
ui->cbxCA->addItem(tr("Choose from file")); //从文件选择...
ui->cbxCA->setCurrentIndex(0);
ui->cbxUserCertify->addItem(tr("None")); //无
ui->cbxUserCertify->addItem(tr("Choose from file")); //从文件选择...
ui->cbxUserCertify->setCurrentIndex(0);
ui->cbxUserPriKey->addItem(tr("None")); //无
ui->cbxUserPriKey->addItem(tr("Choose from file")); //从文件选择...
ui->cbxUserPriKey->setCurrentIndex(0);
ui->btnConnect->setEnabled(false);
ui->lbCaPwd->setEnabled(false);
ui->leCaPwd->setEnabled(false);
ui->lbUserCertifyPwd->setEnabled(false);
ui->leUserCertifyPwd->setEnabled(false);
ui->lbUserPriKey->setEnabled(false);
ui->cbxUserPriKey->setEnabled(false);
ui->lbUserKeyPwd->setEnabled(false);
ui->leUserKeyPwd->setEnabled(false);
this->setFixedSize(432,680);
}
DlgConnHidWifiSecTls::~DlgConnHidWifiSecTls()
{
delete ui;
}
void DlgConnHidWifiSecTls::changeDialogSecu()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(5);
WepOrWpa = 0;
}
} else {
if (WepOrWpa == 0){
ui->cbxSecurity->setCurrentIndex(6);
WepOrWpa = 1;
}
}
}
void DlgConnHidWifiSecTls::changeDialogAuth()
{
if(ui->cbxAuth->currentIndex()==0){
qDebug()<<"it's not need to change dialog";
} else if(ui->cbxAuth->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa);
connHidWifiSecLeap->show();
} else if(ui->cbxAuth->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa);
connHidWifiSecPwd->show();
} else if(ui->cbxAuth->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa);
connHidWifiSecFast->show();
} else if(ui->cbxAuth->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa);
connHidWifiSecTuTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa);
connHidWifiSecPeap->show();
}
}
void DlgConnHidWifiSecTls::on_cbxCA_currentIndexChanged(const QString &arg1)
{
if (ui->cbxCA->currentIndex() == 0){
ui->leCaPwd->setText("");
ui->lbCaPwd->setEnabled(false);
ui->leCaPwd->setEnabled(false);
}else{
ui->leCaPwd->setText("");
ui->lbCaPwd->setEnabled(true);
ui->leCaPwd->setEnabled(true);
}
}
void DlgConnHidWifiSecTls::on_cbxUserCertify_currentIndexChanged(const QString &arg1)
{
if (ui->cbxUserCertify->currentIndex() == 0){
ui->leUserCertifyPwd->setText("");
ui->lbUserCertifyPwd->setEnabled(false);
ui->leUserCertifyPwd->setEnabled(false);
ui->lbUserPriKey->setEnabled(false);
ui->cbxUserPriKey->setEnabled(false);
ui->cbxUserPriKey->setCurrentIndex(0);
ui->leUserKeyPwd->setText("");
ui->lbUserKeyPwd->setEnabled(false);
ui->leUserKeyPwd->setEnabled(false);
}else{
ui->leUserCertifyPwd->setText("");
ui->lbUserCertifyPwd->setEnabled(true);
ui->leUserCertifyPwd->setEnabled(true);
ui->lbUserPriKey->setEnabled(true);
ui->cbxUserPriKey->setEnabled(true);
ui->cbxUserPriKey->setCurrentIndex(0);
ui->leUserKeyPwd->setText("");
ui->lbUserKeyPwd->setEnabled(false);
ui->leUserKeyPwd->setEnabled(false);
}
}
void DlgConnHidWifiSecTls::on_cbxUserPriKey_currentIndexChanged(const QString &arg1)
{
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->leUserKeyPwd->setText("");
ui->lbUserKeyPwd->setEnabled(false);
ui->leUserKeyPwd->setEnabled(false);
}else{
ui->leUserKeyPwd->setText("");
ui->lbUserKeyPwd->setEnabled(true);
ui->leUserKeyPwd->setEnabled(true);
}
}
void DlgConnHidWifiSecTls::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiSecTls::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiSecTls::on_checkBoxCA_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->cbxCA->setCurrentIndex(0);
ui->lbCA->setEnabled(true);
ui->cbxCA->setEnabled(true);
} else {
ui->cbxCA->setCurrentIndex(0);
ui->lbCA->setEnabled(false);
ui->cbxCA->setEnabled(false);
}
}
void DlgConnHidWifiSecTls::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->leCaPwd->setEchoMode(QLineEdit::Password);
} else {
ui->leCaPwd->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecTls::on_checkBoxPwdSec_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->leUserCertifyPwd->setEchoMode(QLineEdit::Password);
ui->leUserKeyPwd->setEchoMode(QLineEdit::Password);
} else {
ui->leUserCertifyPwd->setEchoMode(QLineEdit::Normal);
ui->leUserKeyPwd->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecTls::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leIdentity->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxCA->currentIndex() == 0){
if (ui->cbxUserCertify->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else {
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
} else {
if (ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserCertify->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else {
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
}
}
}
}
void DlgConnHidWifiSecTls::on_leIdentity_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leIdentity->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxCA->currentIndex() == 0){
if (ui->cbxUserCertify->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else {
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
} else {
if (ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserCertify->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else {
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
}
}
}
}
void DlgConnHidWifiSecTls::on_leDomain_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leIdentity->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxCA->currentIndex() == 0){
if (ui->cbxUserCertify->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else {
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
} else {
if (ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserCertify->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else {
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
}
}
}
}
void DlgConnHidWifiSecTls::on_leCaPwd_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leIdentity->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
} else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserCertify->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else {
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
}
}
void DlgConnHidWifiSecTls::on_leUserCertifyPwd_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leIdentity->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxCA->currentIndex() == 0){
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
} else {
if (ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxUserPriKey->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
}
}
}
void DlgConnHidWifiSecTls::on_leUserKeyPwd_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leIdentity->text() == ""){
ui->btnConnect->setEnabled(false);
} else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
if (ui->cbxCA->currentIndex() == 0){
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
} else {
if (ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->leUserCertifyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserKeyPwd->text() == ""){
ui->btnConnect->setEnabled(false);
} else{
ui->btnConnect->setEnabled(true);
}
}
}
}
}

64
dlgconnhidwifisectls.h Normal file
View File

@ -0,0 +1,64 @@
#ifndef DLGCONNHIDWIFISECTLS_H
#define DLGCONNHIDWIFISECTLS_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiSecTls;
}
class DlgConnHidWifiSecTls : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiSecTls(int type, QWidget *parent = 0);
~DlgConnHidWifiSecTls();
public slots:
void changeDialogSecu();
void changeDialogAuth();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_checkBoxCA_stateChanged(int arg1);
void on_checkBoxPwd_stateChanged(int arg1);
void on_checkBoxPwdSec_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_leIdentity_textEdited(const QString &arg1);
void on_leDomain_textEdited(const QString &arg1);
void on_leCaPwd_textEdited(const QString &arg1);
void on_leUserCertifyPwd_textEdited(const QString &arg1);
void on_leUserKeyPwd_textEdited(const QString &arg1);
void on_cbxCA_currentIndexChanged(const QString &arg1);
void on_cbxUserCertify_currentIndexChanged(const QString &arg1);
void on_cbxUserPriKey_currentIndexChanged(const QString &arg1);
private:
Ui::DlgConnHidWifiSecTls *ui;
int WepOrWpa = 0;//0 WEP;1WPA
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFISECTLS_H

681
dlgconnhidwifisectls.ui Normal file
View File

@ -0,0 +1,681 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiSecTls</class>
<widget class="QDialog" name="DlgConnHidWifiSecTls">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>680</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>180</x>
<y>165</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>180</x>
<y>125</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLineEdit" name="leUserCertifyPwd">
<property name="geometry">
<rect>
<x>180</x>
<y>485</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLineEdit" name="leCaPwd">
<property name="geometry">
<rect>
<x>180</x>
<y>365</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwd">
<property name="geometry">
<rect>
<x>357</x>
<y>377</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>130</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbDomain">
<property name="geometry">
<rect>
<x>76</x>
<y>290</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbCA">
<property name="geometry">
<rect>
<x>76</x>
<y>330</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxUserCertify">
<property name="geometry">
<rect>
<x>180</x>
<y>445</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbIdentity">
<property name="geometry">
<rect>
<x>76</x>
<y>250</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUserCertifyPwd">
<property name="geometry">
<rect>
<x>76</x>
<y>490</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>634</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUserKeyPwd">
<property name="geometry">
<rect>
<x>76</x>
<y>570</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxCA">
<property name="geometry">
<rect>
<x>180</x>
<y>325</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbUserPriKey">
<property name="geometry">
<rect>
<x>76</x>
<y>530</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbCaPwd">
<property name="geometry">
<rect>
<x>76</x>
<y>370</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leDomain">
<property name="geometry">
<rect>
<x>180</x>
<y>285</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwdSec">
<property name="geometry">
<rect>
<x>337</x>
<y>577</y>
<width>18</width>
<height>8</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leIdentity">
<property name="geometry">
<rect>
<x>180</x>
<y>245</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLineEdit" name="leUserKeyPwd">
<property name="geometry">
<rect>
<x>180</x>
<y>565</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLabel" name="lbUserCertify">
<property name="geometry">
<rect>
<x>76</x>
<y>450</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>210</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAuth">
<property name="geometry">
<rect>
<x>180</x>
<y>205</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>634</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxCA">
<property name="geometry">
<rect>
<x>180</x>
<y>405</y>
<width>200</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>180</x>
<y>55</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QComboBox" name="cbxUserPriKey">
<property name="geometry">
<rect>
<x>180</x>
<y>525</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>170</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>680</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>620</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>cbxSecurity</zorder>
<zorder>leNetName</zorder>
<zorder>leUserCertifyPwd</zorder>
<zorder>leCaPwd</zorder>
<zorder>checkBoxPwd</zorder>
<zorder>lbConn</zorder>
<zorder>lbNetName</zorder>
<zorder>lbDomain</zorder>
<zorder>lbCA</zorder>
<zorder>cbxUserCertify</zorder>
<zorder>lbIdentity</zorder>
<zorder>lbUserCertifyPwd</zorder>
<zorder>btnCancel</zorder>
<zorder>lbUserKeyPwd</zorder>
<zorder>cbxCA</zorder>
<zorder>lbUserPriKey</zorder>
<zorder>lbCaPwd</zorder>
<zorder>leDomain</zorder>
<zorder>leIdentity</zorder>
<zorder>leUserKeyPwd</zorder>
<zorder>lbUserCertify</zorder>
<zorder>lbAuth</zorder>
<zorder>cbxAuth</zorder>
<zorder>btnConnect</zorder>
<zorder>checkBoxCA</zorder>
<zorder>cbxConn</zorder>
<zorder>cbxUserPriKey</zorder>
<zorder>lbSecurity</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
<zorder>checkBoxPwdSec</zorder>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,394 @@
#include "dlgconnhidwifisectunneltls.h"
#include "ui_dlgconnhidwifisectunneltls.h"
#include "kylinheadfile.h"
DlgConnHidWifiSecTunnelTLS::DlgConnHidWifiSecTunnelTLS(int type, QWidget *parent) :
WepOrWpa(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiSecTunnelTLS)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->checkBoxPwdSec->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性:
ui->lbAuth->setText(tr("Authentication")); //认证:
ui->lbAnonyId->setText(tr("Anonymous identity")); //匿名身份:
ui->lbDomain->setText(tr("Domain")); //域名:
ui->lbCA->setText(tr("CA certificate")); //CA 证书:
ui->lbCaPwd->setText(tr("CA certificate password")); //CA 证书密码:
ui->checkBoxCA->setText(tr("No CA certificate is required")); //不需要CA证书
ui->lbInnerAuth->setText(tr("Inner authentication")); //内部认证:
ui->lbUserName->setText(tr("Username")); //用户名:
ui->lbPassword->setText(tr("Password")); //密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
if (WepOrWpa == 0) {
ui->cbxSecurity->setCurrentIndex(5);
} else if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(6);
}
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu()));
ui->cbxAuth->addItem("TLS");
ui->cbxAuth->addItem("LEAP");
ui->cbxAuth->addItem("PWD");
ui->cbxAuth->addItem("FAST");
ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS
ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP
ui->cbxAuth->setCurrentIndex(4);
connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth()));
ui->cbxCA->addItem(tr("None")); //无
ui->cbxCA->addItem(tr("Choose from file")); //从文件选择...
ui->cbxCA->setCurrentIndex(0);
ui->cbxInnerAuth->addItem("PAP");
ui->cbxInnerAuth->addItem("MSCHAP");
ui->cbxInnerAuth->addItem("MSCHAPv2");
ui->cbxInnerAuth->addItem("MSCHAPv2(no EAP)");
ui->cbxInnerAuth->addItem("CHAP");
ui->cbxInnerAuth->addItem("MDS");
ui->cbxInnerAuth->addItem("GTC");
ui->cbxInnerAuth->setCurrentIndex(0);
ui->btnConnect->setEnabled(false);
this->setFixedSize(432,640);
}
DlgConnHidWifiSecTunnelTLS::~DlgConnHidWifiSecTunnelTLS()
{
delete ui;
}
void DlgConnHidWifiSecTunnelTLS::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiSecTunnelTLS::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiSecTunnelTLS::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiSecTunnelTLS::changeDialogSecu()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
if (WepOrWpa == 1) {
ui->cbxSecurity->setCurrentIndex(5);
WepOrWpa = 0;
}
} else {
if (WepOrWpa == 0){
ui->cbxSecurity->setCurrentIndex(6);
WepOrWpa = 1;
}
}
}
void DlgConnHidWifiSecTunnelTLS::changeDialogAuth()
{
if(ui->cbxAuth->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa);
connHidWifiSecTls->show();
} else if(ui->cbxAuth->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa);
connHidWifiSecLeap->show();
} else if(ui->cbxAuth->currentIndex()==2) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa);
connHidWifiSecPwd->show();
} else if(ui->cbxAuth->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa);
connHidWifiSecFast->show();
} else if(ui->cbxAuth->currentIndex()==4) {
qDebug()<<"it's not need to change dialog";
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa);
connHidWifiSecPeap->show();
}
}
void DlgConnHidWifiSecTunnelTLS::on_cbxCA_currentIndexChanged(const QString &arg1)
{
if (ui->cbxCA->currentIndex() == 0){
ui->leCaPwd->setText("");
ui->lbCaPwd->setEnabled(false);
ui->leCaPwd->setEnabled(false);
} else {
ui->leCaPwd->setText("");
ui->lbCaPwd->setEnabled(true);
ui->leCaPwd->setEnabled(true);
}
}
void DlgConnHidWifiSecTunnelTLS::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiSecTunnelTLS::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiSecTunnelTLS::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->leCaPwd->setEchoMode(QLineEdit::Password);
} else {
ui->leCaPwd->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecTunnelTLS::on_checkBoxCA_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->cbxCA->setCurrentIndex(0);
ui->leCaPwd->setText("");
ui->lbCA->setEnabled(true);
ui->cbxCA->setEnabled(true);
} else {
ui->cbxCA->setCurrentIndex(0);
ui->leCaPwd->setText("");
ui->lbCA->setEnabled(false);
ui->cbxCA->setEnabled(false);
}
}
void DlgConnHidWifiSecTunnelTLS::on_checkBoxPwdSec_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiSecTunnelTLS::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecTunnelTLS::on_leAnonyId_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecTunnelTLS::on_leDomain_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecTunnelTLS::on_leCaPwd_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiSecTunnelTLS::on_leUserName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}
void DlgConnHidWifiSecTunnelTLS::on_lePwd_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leAnonyId->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leDomain->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->leUserName->text() == ""){
ui->btnConnect->setEnabled(false);
}else if (ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
if (ui->cbxCA->currentIndex() == 0){
ui->btnConnect->setEnabled(true);
}else if(ui->leCaPwd->text() == ""){
ui->btnConnect->setEnabled(false);
}else{
ui->btnConnect->setEnabled(true);
}
}
}

View File

@ -0,0 +1,60 @@
#ifndef DLGCONNHIDWIFISECTUNNELTLS_H
#define DLGCONNHIDWIFISECTUNNELTLS_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiSecTunnelTLS;
}
class DlgConnHidWifiSecTunnelTLS : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiSecTunnelTLS(int type, QWidget *parent = 0);
~DlgConnHidWifiSecTunnelTLS();
public slots:
void changeDialogSecu();
void changeDialogAuth();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_cbxCA_currentIndexChanged(const QString &arg1);
void on_checkBoxPwd_stateChanged(int arg1);
void on_checkBoxCA_stateChanged(int arg1);
void on_checkBoxPwdSec_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_leAnonyId_textEdited(const QString &arg1);
void on_leDomain_textEdited(const QString &arg1);
void on_leCaPwd_textEdited(const QString &arg1);
void on_leUserName_textEdited(const QString &arg1);
void on_lePwd_textEdited(const QString &arg1);
private:
Ui::DlgConnHidWifiSecTunnelTLS *ui;
int WepOrWpa = 0;//0 WEP;1WPA
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFISECTUNNELTLS_H

View File

@ -0,0 +1,637 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiSecTunnelTLS</class>
<widget class="QDialog" name="DlgConnHidWifiSecTunnelTLS">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>640</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>180</x>
<y>55</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="leCaPwd">
<property name="geometry">
<rect>
<x>180</x>
<y>365</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>180</x>
<y>125</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>594</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="lePassword">
<property name="geometry">
<rect>
<x>180</x>
<y>525</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>594</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbDomain">
<property name="geometry">
<rect>
<x>76</x>
<y>290</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwdSec">
<property name="geometry">
<rect>
<x>340</x>
<y>537</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUserName">
<property name="geometry">
<rect>
<x>76</x>
<y>490</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>170</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>180</x>
<y>165</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QComboBox" name="cbxCA">
<property name="geometry">
<rect>
<x>180</x>
<y>325</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QComboBox" name="cbxInnerAuth">
<property name="geometry">
<rect>
<x>180</x>
<y>445</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="leUserName">
<property name="geometry">
<rect>
<x>180</x>
<y>485</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
</widget>
<widget class="QLabel" name="lbCA">
<property name="geometry">
<rect>
<x>76</x>
<y>330</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAuth">
<property name="geometry">
<rect>
<x>180</x>
<y>205</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbAnonyId">
<property name="geometry">
<rect>
<x>76</x>
<y>250</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>130</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxCA">
<property name="geometry">
<rect>
<x>180</x>
<y>405</y>
<width>200</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbInnerAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>450</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leDomain">
<property name="geometry">
<rect>
<x>180</x>
<y>285</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>210</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbCaPwd">
<property name="geometry">
<rect>
<x>76</x>
<y>370</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbPassword">
<property name="geometry">
<rect>
<x>76</x>
<y>530</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwd">
<property name="geometry">
<rect>
<x>357</x>
<y>377</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leAnonyId">
<property name="geometry">
<rect>
<x>180</x>
<y>245</y>
<width>200</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>640</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>580</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbUpback</zorder>
<zorder>lbBottomback</zorder>
<zorder>lbBoder</zorder>
<zorder>cbxConn</zorder>
<zorder>leCaPwd</zorder>
<zorder>leNetName</zorder>
<zorder>btnConnect</zorder>
<zorder>lePassword</zorder>
<zorder>btnCancel</zorder>
<zorder>lbDomain</zorder>
<zorder>checkBoxPwdSec</zorder>
<zorder>lbUserName</zorder>
<zorder>lbSecurity</zorder>
<zorder>cbxSecurity</zorder>
<zorder>cbxCA</zorder>
<zorder>cbxInnerAuth</zorder>
<zorder>leUserName</zorder>
<zorder>lbCA</zorder>
<zorder>cbxAuth</zorder>
<zorder>lbAnonyId</zorder>
<zorder>lbNetName</zorder>
<zorder>checkBoxCA</zorder>
<zorder>lbInnerAuth</zorder>
<zorder>leDomain</zorder>
<zorder>lbAuth</zorder>
<zorder>lbConn</zorder>
<zorder>lbCaPwd</zorder>
<zorder>lbPassword</zorder>
<zorder>checkBoxPwd</zorder>
<zorder>leAnonyId</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

187
dlgconnhidwifiwep.cpp Normal file
View File

@ -0,0 +1,187 @@
#include "ui_dlgconnhidwifiwep.h"
#include "kylinheadfile.h"
DlgConnHidWifiWep::DlgConnHidWifiWep(int type, QWidget *parent) :
WepPwdOrCode(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiWep)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi 安全性:
ui->lbKey->setText(tr("Key")); //密钥:
ui->lbWEPindex->setText(tr("WEP index")); //WEP 检索:
ui->lbAuth->setText(tr("Authentication")); //认证:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
if (WepPwdOrCode == 0) {
ui->cbxSecurity->setCurrentIndex(2);
} else if (WepPwdOrCode == 1) {
ui->cbxSecurity->setCurrentIndex(3);
}
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog()));
ui->cbxWEPindex->addItem(tr("1(default)")); //1(默认)
ui->cbxWEPindex->addItem("2");
ui->cbxWEPindex->addItem("3");
ui->cbxWEPindex->addItem("4");
ui->cbxWEPindex->setCurrentIndex(0);
ui->cbxAuth->addItem(tr("Open System")); //开放式系统
ui->cbxAuth->addItem(tr("Shared Key")); //共享密钥
ui->cbxAuth->setCurrentIndex(0);
ui->btnConnect->setEnabled(false);
this->setFixedSize(432,471);
}
DlgConnHidWifiWep::~DlgConnHidWifiWep()
{
delete ui;
}
void DlgConnHidWifiWep::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiWep::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiWep::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiWep::changeDialog()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0);
connHidWifi->show();
} else if(ui->cbxSecurity->currentIndex()==1) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0);
connHidWifiWpa->show();
} else if(ui->cbxSecurity->currentIndex()==2) {
if (WepPwdOrCode == 1) {
ui->cbxSecurity->setCurrentIndex(2);
WepPwdOrCode = 0;
}
} else if(ui->cbxSecurity->currentIndex()==3) {
if (WepPwdOrCode == 0) {
ui->cbxSecurity->setCurrentIndex(3);
WepPwdOrCode = 1;
}
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0);
connHidWifiSecTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1);
connHidWifiSecTls->show();
}
}
void DlgConnHidWifiWep::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiWep::on_btnConnect_clicked()
{
this->close();
}
void DlgConnHidWifiWep::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->leKey->setEchoMode(QLineEdit::Password);
} else {
ui->leKey->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiWep::on_leKey_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == "" || ui->leKey->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiWep::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == "" || ui->leKey->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}

45
dlgconnhidwifiwep.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef DLGCONNHIDWIFIWEP_H
#define DLGCONNHIDWIFIWEP_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class DlgConnHidWifiWep;
}
class DlgConnHidWifiWep : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiWep(int type, QWidget *parent = 0);
~DlgConnHidWifiWep();
public slots:
void changeDialog();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_checkBoxPwd_stateChanged(int arg1);
void on_leKey_textEdited(const QString &arg1);
void on_leNetName_textEdited(const QString &arg1);
private:
Ui::DlgConnHidWifiWep *ui;
int WepPwdOrCode = 0; //0 WEP password;1 WEP Code Sentence
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFIWEP_H

412
dlgconnhidwifiwep.ui Normal file
View File

@ -0,0 +1,412 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiWep</class>
<widget class="QDialog" name="DlgConnHidWifiWep">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>471</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QLabel" name="lbKey">
<property name="geometry">
<rect>
<x>76</x>
<y>246</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbWEPindex">
<property name="geometry">
<rect>
<x>76</x>
<y>291</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbAuth">
<property name="geometry">
<rect>
<x>76</x>
<y>336</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>175</x>
<y>195</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>425</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxAuth">
<property name="geometry">
<rect>
<x>175</x>
<y>330</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxWEPindex">
<property name="geometry">
<rect>
<x>175</x>
<y>285</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>425</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwd">
<property name="geometry">
<rect>
<x>332</x>
<y>252</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>156</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leKey">
<property name="geometry">
<rect>
<x>175</x>
<y>240</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>175</x>
<y>150</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>201</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>175</x>
<y>55</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>471</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>411</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>leKey</zorder>
<zorder>lbKey</zorder>
<zorder>lbWEPindex</zorder>
<zorder>lbAuth</zorder>
<zorder>cbxSecurity</zorder>
<zorder>btnConnect</zorder>
<zorder>cbxAuth</zorder>
<zorder>lbConn</zorder>
<zorder>cbxWEPindex</zorder>
<zorder>btnCancel</zorder>
<zorder>checkBoxPwd</zorder>
<zorder>lbNetName</zorder>
<zorder>leNetName</zorder>
<zorder>lbSecurity</zorder>
<zorder>cbxConn</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

282
dlgconnhidwifiwpa.cpp Normal file
View File

@ -0,0 +1,282 @@
#include "dlgconnhidwifiwpa.h"
#include "ui_dlgconnhidwifiwpa.h"
#include "kylinheadfile.h"
#include "backthread.h"
#include "mainwindow.h"
#include <unistd.h>
DlgConnHidWifiWpa::DlgConnHidWifiWpa(int type, MainWindow *mainWindow, QWidget *parent) :
isUsed(type),
QDialog(parent),
ui(new Ui::DlgConnHidWifiWpa)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:white;");
ui->lbBoder->setStyleSheet("QLabel{background-color:transparent;border:1px solid #297a97;}");
ui->lbUpback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbBottomback->setStyleSheet("QLabel{background-color:#f5f6f7;}");
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/add-hide-wifi.png);background-color:transparent;}");
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
ui->lbConn->setStyleSheet("QLabel{background-color:transparent;}");
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->btnConnect->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi
ui->lbConn->setText(tr("Connection")); //连接设置:
ui->lbNetName->setText(tr("Network name")); //网络名称:
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi 安全性:
ui->lbPassword->setText(tr("Password")); //密码:
ui->btnCancel->setText(tr("Cancel")); //取消
ui->btnConnect->setText(tr("Connect")); //连接
ui->cbxConn->addItem(tr("C_reate…")); //新建...
system("nmcli connection show>/tmp/kylin-nm-connshow");
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
QStringList txtLine = txt.split("\n");
file.close();
foreach (QString line, txtLine) {
if(line.indexOf("wifi") != -1){
QStringList subLine = line.split(" ");
ui->cbxConn->addItem(subLine[0]);
}
}
ui->cbxConn->setCurrentIndex(0);
connect(ui->cbxConn,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeWindow()));
ui->cbxSecurity->addItem(tr("None")); //无
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII)
ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句
ui->cbxSecurity->addItem("LEAP");
ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x)
ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业
ui->cbxSecurity->setCurrentIndex(1);
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog()));
if (isUsed == 0){
ui->btnConnect->setEnabled(false);
} else {
ui->cbxConn->setCurrentIndex(isUsed);
ui->leNetName->setText(ui->cbxConn->currentText());
ui->leNetName->setEnabled(false);
ui->lbNetName->setEnabled(false);
ui->lbSecurity->setEnabled(false);
ui->cbxSecurity->setEnabled(false);
ui->lbPassword->setEnabled(false);
ui->lePassword->setText("<Hidden>");
ui->lePassword->setEnabled(false);
ui->btnConnect->setEnabled(true);
ui->checkBoxPwd->setEnabled(false);
}
this->setFixedSize(432,412);
this->mw = mainWindow;
}
DlgConnHidWifiWpa::~DlgConnHidWifiWpa()
{
delete ui;
}
void DlgConnHidWifiWpa::mousePressEvent(QMouseEvent *event){
if(event->button() == Qt::LeftButton){
this->isPress = true;
this->winPos = this->pos();
this->dragPos = event->globalPos();
event->accept();
}
}
void DlgConnHidWifiWpa::mouseReleaseEvent(QMouseEvent *event){
this->isPress = false;
this->setWindowOpacity(1);
}
void DlgConnHidWifiWpa::mouseMoveEvent(QMouseEvent *event){
if(this->isPress){
this->move(this->winPos - (this->dragPos - event->globalPos()));
this->setWindowOpacity(0.9);
event->accept();
}
}
void DlgConnHidWifiWpa::changeDialog()
{
if(ui->cbxSecurity->currentIndex()==0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(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();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==3) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1);
connHidWifiWep->show();
} else if(ui->cbxSecurity->currentIndex()==4) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap();
connHidWifiLeap->show();
} else if(ui->cbxSecurity->currentIndex()==5) {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0);
connHidWifiSecTls->show();
} else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1);
connHidWifiSecTls->show();
}
}
void DlgConnHidWifiWpa::changeWindow(){
if (ui->cbxConn->currentIndex() == 0){
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0, mw);
connHidWifi->show();
connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
}else if (ui->cbxConn->currentIndex() >= 1){
QString currStr = "nmcli connection show " + ui->cbxConn->currentText() + " >/tmp/kylin-nm-connshow";
system(currStr.toUtf8().data());
QFile file("/tmp/kylin-nm-connshow");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug()<<"Can't open the file!";
}
QString txt = file.readAll();
file.close();
if (txt.indexOf("802-11-wireless-security.key-mgmt:") != -1){
isUsed = ui->cbxConn->currentIndex();
ui->lbNetName->setEnabled(false);
ui->leNetName->setText(ui->cbxConn->currentText());
ui->leNetName->setEnabled(false);
ui->lbSecurity->setEnabled(false);
ui->cbxSecurity->setEnabled(false);
ui->lePassword->setText("<Hidden>");
ui->lbPassword->setEnabled(false);
ui->lePassword->setEnabled(false);
ui->btnConnect->setEnabled(true);
}else {
QApplication::setQuitOnLastWindowClosed(false);
this->hide();
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(ui->cbxConn->currentIndex(), mw);
connHidWifi->show();
connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
}
}
}
void DlgConnHidWifiWpa::on_btnCancel_clicked()
{
this->close();
}
void DlgConnHidWifiWpa::on_btnConnect_clicked()
{
QThread *t = new QThread();
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
connect(t, SIGNAL(started()), this, SLOT(slotStartLoading()));
connect(this, SIGNAL(stopSignal()), t, SLOT(quit()));
t->start();
QString wifiName = ui->leNetName->text();
QString wifiPassword = ui->lePassword->text();
BackThread *bt = new BackThread();
strWifiname = wifiName;
strWifiPassword = wifiPassword;
if (isUsed == 0){
int x = 0;
do{
sleep(1);
QString cmd = "nmcli device wifi connect " + wifiName + " password " + wifiPassword + " hidden yes >/tmp/kylin-nm-btoutput";
system(cmd.toUtf8().data());
QFile file("/tmp/kylin-nm-btoutput");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug()<<"Can't open the file!"<<endl;
}
QString text = file.readAll();
file.close();
if(text.indexOf("Scanning not allowed") != -1){x = 1;} else { x = 0;}
} while(x == 1);
connect(this, SIGNAL(execSecConn()), this,SLOT(on_execSecConn() ));
QTimer::singleShot(5*1000, this, SLOT(on_execSecConn() ));
} else {
bt->execConnWifi(wifiName);
connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() ));
QTimer::singleShot(4*1000, this, SLOT(emitSignal() ));
}
this->close();
}
void DlgConnHidWifiWpa::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword ->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
}
void DlgConnHidWifiWpa::on_leNetName_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == "" || ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiWpa::on_lePassword_textEdited(const QString &arg1)
{
if (ui->leNetName->text() == "" || ui->lePassword->text() == ""){
ui->btnConnect->setEnabled(false);
} else {
ui->btnConnect->setEnabled(true);
}
}
void DlgConnHidWifiWpa::slotStartLoading()
{
mw->startLoading();
}
void DlgConnHidWifiWpa::on_execSecConn()
{
QString str = "nmcli device wifi connect " + strWifiname + " password " + strWifiPassword;
system(str.toUtf8().data());
connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() ));
QTimer::singleShot(3*1000, this, SLOT(emitSignal() ));
}
void DlgConnHidWifiWpa::emitSignal()
{
emit reSetWifiList();
mw->stopLoading();
emit this->stopSignal();
}

61
dlgconnhidwifiwpa.h Normal file
View File

@ -0,0 +1,61 @@
#ifndef DLGCONNHIDWIFIWPA_H
#define DLGCONNHIDWIFIWPA_H
#include <QDialog>
#include <QMouseEvent>
#include <QThread>
class MainWindow;
namespace Ui {
class DlgConnHidWifiWpa;
}
class DlgConnHidWifiWpa : public QDialog
{
Q_OBJECT
public:
explicit DlgConnHidWifiWpa(int type, MainWindow *mw = 0, QWidget *parent = 0);
~DlgConnHidWifiWpa();
public slots:
void changeDialog();
void changeWindow();
void emitSignal();
void on_execSecConn();
void slotStartLoading();
private slots:
void on_btnCancel_clicked();
void on_btnConnect_clicked();
void on_checkBoxPwd_stateChanged(int arg1);
void on_leNetName_textEdited(const QString &arg1);
void on_lePassword_textEdited(const QString &arg1);
signals:
void reSetWifiList();
void sendMessage();
void execSecConn();
void stopSignal();
private:
Ui::DlgConnHidWifiWpa *ui;
int isUsed;//=0 current wifi not used before; >=1 used
MainWindow *mw;
QString strWifiname;
QString strWifiPassword;
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
bool isPress;
QPoint winPos;
QPoint dragPos;
};
#endif // DLGCONNHIDWIFIWPA_H

324
dlgconnhidwifiwpa.ui Normal file
View File

@ -0,0 +1,324 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgConnHidWifiWpa</class>
<widget class="QDialog" name="DlgConnHidWifiWpa">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>412</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to Hidden Wi-Fi Network</string>
</property>
<widget class="QLabel" name="lbNetName">
<property name="geometry">
<rect>
<x>76</x>
<y>156</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbSecurity">
<property name="geometry">
<rect>
<x>76</x>
<y>201</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>215</x>
<y>367</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxConn">
<property name="geometry">
<rect>
<x>175</x>
<y>55</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxPwd">
<property name="geometry">
<rect>
<x>332</x>
<y>253</y>
<width>18</width>
<height>9</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbPassword">
<property name="geometry">
<rect>
<x>76</x>
<y>246</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="cbxSecurity">
<property name="geometry">
<rect>
<x>175</x>
<y>195</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox QAbstractItemView {
outline: 0;
border: 1px solid #000000;
border-color: rgba(0, 0, 0,25%);
selection-color: rgb(0, 0, 0);
background-color: #F1F3F3;
}</string>
</property>
</widget>
<widget class="QLineEdit" name="lePassword">
<property name="geometry">
<rect>
<x>175</x>
<y>241</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
<widget class="QPushButton" name="btnConnect">
<property name="geometry">
<rect>
<x>315</x>
<y>367</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbConn">
<property name="geometry">
<rect>
<x>76</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="leNetName">
<property name="geometry">
<rect>
<x>175</x>
<y>150</y>
<width>182</width>
<height>32</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
<widget class="QLabel" name="lbBoder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>412</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbUpback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>116</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbBottomback">
<property name="geometry">
<rect>
<x>0</x>
<y>352</y>
<width>432</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>120</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupIcon">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbLeftupTitle">
<property name="geometry">
<rect>
<x>34</x>
<y>6</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>lbBottomback</zorder>
<zorder>lbUpback</zorder>
<zorder>lbBoder</zorder>
<zorder>lePassword</zorder>
<zorder>lbNetName</zorder>
<zorder>lbSecurity</zorder>
<zorder>btnCancel</zorder>
<zorder>cbxConn</zorder>
<zorder>checkBoxPwd</zorder>
<zorder>lbPassword</zorder>
<zorder>cbxSecurity</zorder>
<zorder>btnConnect</zorder>
<zorder>lbConn</zorder>
<zorder>leNetName</zorder>
<zorder>lbLeftup</zorder>
<zorder>lbLeftupIcon</zorder>
<zorder>lbLeftupTitle</zorder>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -44,7 +44,17 @@ SOURCES += \
kylin-network-interface.c \
backthread.cpp \
onelancform.cpp \
loadingdiv.cpp
loadingdiv.cpp \
dlgconnhidwifi.cpp \
dlgconnhidwifisecfast.cpp \
dlgconnhidwifisectunneltls.cpp \
dlgconnhidwifisecpeap.cpp \
dlgconnhidwifisectls.cpp \
dlgconnhidwifisecleap.cpp \
dlgconnhidwifisecpwd.cpp \
dlgconnhidwifiwep.cpp \
dlgconnhidwifileap.cpp \
dlgconnhidwifiwpa.cpp
HEADERS += \
mainwindow.h \
@ -54,13 +64,34 @@ HEADERS += \
kylin-network-interface.h \
backthread.h \
onelancform.h \
loadingdiv.h
loadingdiv.h \
dlgconnhidwifi.h \
dlgconnhidwifisecfast.h \
dlgconnhidwifisectunneltls.h \
dlgconnhidwifisecpeap.h \
dlgconnhidwifisectls.h \
dlgconnhidwifisecleap.h \
dlgconnhidwifisecpwd.h \
dlgconnhidwifiwep.h \
dlgconnhidwifileap.h \
dlgconnhidwifiwpa.h \
kylinheadfile.h
FORMS += \
mainwindow.ui \
oneconnform.ui \
confform.ui \
onelancform.ui
onelancform.ui \
dlgconnhidwifi.ui \
dlgconnhidwifisecfast.ui \
dlgconnhidwifisectunneltls.ui \
dlgconnhidwifisecpeap.ui \
dlgconnhidwifisectls.ui \
dlgconnhidwifisecleap.ui \
dlgconnhidwifisecpwd.ui \
dlgconnhidwifiwep.ui \
dlgconnhidwifileap.ui \
dlgconnhidwifiwpa.ui
RESOURCES += \
nmqrc.qrc

336
kylin-nm.pro.user Normal file
View File

@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.6.2, 2019-09-16T09:14:14. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{d24ee5cf-e33b-4ac0-b3ff-aa81cafc226a}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{3b9e90dd-8b5f-4932-ae85-9f4afd675bbc}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/chenlelin/kylin-nm/build-kylin-nm-unknown-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/chenlelin/kylin-nm/build-kylin-nm-unknown-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/chenlelin/kylin-nm/build-kylin-nm-unknown-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署设置</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">kylin-nm</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/chenlelin/kylin-nm/kylin-nm/kylin-nm.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">kylin-nm.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/chenlelin/kylin-nm/build-kylin-nm-unknown-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>

18
kylinheadfile.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef KYLINHEADFILE_H
#define KYLINHEADFILE_H
#include "dlgconnhidwifi.h"
#include "dlgconnhidwifileap.h"
#include "dlgconnhidwifisecfast.h"
#include "dlgconnhidwifisecleap.h"
#include "dlgconnhidwifisecpeap.h"
#include "dlgconnhidwifisecpwd.h"
#include "dlgconnhidwifisectls.h"
#include "dlgconnhidwifisectunneltls.h"
#include "dlgconnhidwifiwep.h"
#include "dlgconnhidwifiwpa.h"
#include <QDebug>
#include <QFile>
#endif // KYLINHEADFILE_H

View File

@ -17,6 +17,7 @@
*/
#include "mainwindow.h"
#include "dlgconnhidwifi.h"
#include <QTranslator>
#include <QLocale>
#include <QApplication>

View File

@ -21,8 +21,8 @@
#include "oneconnform.h"
#include "onelancform.h"
QString llname, lwname, bandWidth;
int currentActWifiSignalLv;
QString llname, lwname, bandWidth, hideWiFiConn;
int currentActWifiSignalLv, count_loop;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
@ -44,11 +44,12 @@ MainWindow::MainWindow(QWidget *parent) :
wname = "-1";
llname = "-1";
lwname = "-1";
hideWiFiConn = "Connect to Hidden Wi-Fi Network";
currentActWifiSignalLv = -1;
count_loop = 0;
this->confForm = new ConfForm();
this->ksnm = new KSimpleNM();
loading = new LoadingDiv(this);
scrollAreal = new QScrollArea(ui->centralWidget);
@ -132,7 +133,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ksnm, SIGNAL(getLanListFinished(QStringList)), this, SLOT(getLanListDone(QStringList)));
connect(ksnm, SIGNAL(getWifiListFinished(QStringList)), this, SLOT(getWifiListDone(QStringList)));
getIface();
getIface();// 初始化网络
trayIcon->show();
}
@ -334,12 +335,26 @@ void MainWindow::getIface(){
// 初始化网络列表
if(iface->wstate != 2){
if (iface->wstate == 0) {
connDone(3);
} else if(iface->lstate == 0) {
connLanDone(3);
} else if(iface->wstate == 1 && (iface->lstate == 1)) {
qDebug()<<"开机,即将循环检测 Lan或Wifi 是否开启";
check_isNetOn = new QTimer(this);
check_isNetOn->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isNetOn, SIGNAL(timeout()), this, SLOT(on_isNetOn()));
check_isNetOn->start(3000);
}
on_btnWifiList_clicked();
ui->btnWifiList->setStyleSheet("#btnWifiList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.5);background:transparent;background-color:rgba(255,255,255,0.1);}");
ui->btnNetList->setStyleSheet("#btnNetList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);background:transparent;background-color:rgba(0,0,0,0.2);}"
"#btnNetList:Pressed{border:1px solid rgba(255,255,255,0.5);background:transparent;background-color:rgba(255,255,255,0.1);}");
}else{
if(iface->lstate != 2){
if (iface->lstate == 0) {
connLanDone(3);
}
on_btnNetList_clicked();
ui->btnNetList->setStyleSheet("#btnNetList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.5);background:transparent;background-color:rgba(255,255,255,0.1);}");
ui->btnWifiList->setStyleSheet("#btnWifiList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);background:transparent;background-color:rgba(0,0,0,0.2);}"
@ -411,7 +426,6 @@ void MainWindow::getLanListDone(QStringList slist){
lanListWidget = new QWidget(scrollAreal);
lanListWidget->resize(314, 8 + 60 + 46 + 51);
scrollAreal->setWidget(lanListWidget);
// 获取当前连接的lan name
QString actLanName = "--";
activecon *act = kylin_network_get_activecon_info();
@ -423,8 +437,7 @@ void MainWindow::getLanListDone(QStringList slist){
}
index ++;
}
// 当前连接的lan
// 若当前lan name为"--"设置OneConnForm
OneLancForm *ccf = new OneLancForm(lanListWidget, this, confForm, ksnm);
if(actLanName == "--"){
ccf->setName(tr("Not connected"));//"当前未连接任何 以太网"
@ -436,7 +449,6 @@ void MainWindow::getLanListDone(QStringList slist){
ccf->setAct(true);
ccf->move(0, 8);
ccf->show();
// 可用lan列表
lbLanList = new QLabel(lanListWidget);
lbLanList->setText(tr("Ethernet Networks"));//"可用网络列表"
@ -444,7 +456,6 @@ void MainWindow::getLanListDone(QStringList slist){
lbLanList->move(12, 68);
lbLanList->setStyleSheet("QLabel{font-size:12px;color:white;}");
lbLanList->show();
// 填充可用网络列表
QString headLine = slist.at(0);
headLine = headLine.trimmed();
@ -466,6 +477,7 @@ void MainWindow::getLanListDone(QStringList slist){
ccf->setBandWidth(bandWidth);
ccf->setShowPoint(true);
ccf->setConnedString(tr("Connected"));//"已连接"
currSelNetName = "";
}else{
lanListWidget->resize(314, lanListWidget->height() + 60);
@ -490,11 +502,21 @@ void MainWindow::getLanListDone(QStringList slist){
// 获取wifi列表回调
void MainWindow::getWifiListDone(QStringList slist){
if (updateFlag == 0){
loadWifiListDone(slist);
} else {
updateWifiListDone(slist);
updateFlag = 0;
}
lastSlist = slist;
}
// 加载wifi列表
void MainWindow::loadWifiListDone(QStringList slist){
// 清空wifi列表
wifiListWidget = new QWidget(scrollAreaw);
wifiListWidget->resize(314, 8 + 60 + 46 + 51);
scrollAreaw->setWidget(wifiListWidget);
// 获取当前连接的wifi name
QString actWifiName = "--";
activecon *act = kylin_network_get_activecon_info();
@ -506,8 +528,7 @@ void MainWindow::getWifiListDone(QStringList slist){
}
index ++;
}
// 当前连接的wifi
// 根据当前连接的wifi 设置OneConnForm
OneConnForm *ccf = new OneConnForm(wifiListWidget, this, confForm, ksnm);
if(actWifiName == "--"){
ccf->setName(tr("Not connected"));//"当前未连接任何 Wifi"
@ -519,15 +540,13 @@ void MainWindow::getWifiListDone(QStringList slist){
ccf->setAct(true);
ccf->move(0, 8);
ccf->show();
// 可用wifi列表
// 可用wifi列表表头
lbWifiList = new QLabel(wifiListWidget);
lbWifiList->setText(tr("Wifi Networks"));//"可用网络列表"
lbWifiList->resize(260, 46);
lbWifiList->move(12, 68);
lbWifiList->setStyleSheet("QLabel{font-size:12px;color:white;}");
lbWifiList->show();
// 填充可用网络列表
QString headLine = slist.at(0);
headLine = headLine.trimmed();
@ -537,6 +556,7 @@ void MainWindow::getWifiListDone(QStringList slist){
QStringList wnames;
int count = 0;
for(int i = 1, j = 0; i < slist.size(); i ++) {
QString line = slist.at(i);
QString wsignal = line.mid(0, indexRate).trimmed();
@ -565,6 +585,7 @@ void MainWindow::getWifiListDone(QStringList slist){
ccf->setRate(wrate);
ccf->setSignal(wsignal);
ccf->setConnedString(tr("Connected"));//"已连接"
currSelNetName = "";
}else{
wifiListWidget->resize(314, wifiListWidget->height() + 60);
@ -578,12 +599,146 @@ void MainWindow::getWifiListDone(QStringList slist){
ocf->show();
j ++;
count ++;
}
wnames.append(wname);
}
}
//添加 连接到隐藏的Wi-Fi网络 小窗口
wifiListWidget->resize(314, wifiListWidget->height() + 60);
OneConnForm *hideNetButton = new OneConnForm(wifiListWidget, this, confForm, ksnm);
// connect(hideNetButton, SIGNAL(selectedOneWifiForm(QString)), this, SLOT(oneHideFormSelected(QString)));
connect(hideNetButton, SIGNAL(selectedOneWifiForm(QString)), this, SLOT(oneWifiFormSelected(QString)));
hideNetButton->setSpecialName(hideWiFiConn);
hideNetButton->setSignal(0);
hideNetButton->setSafe("Safe");
hideNetButton->move(0, 114 + count * 60);
hideNetButton->show();
this->lanListWidget->hide();
this->wifiListWidget->show();
this->stopLoading();
}
// 更新wifi列表
void MainWindow::updateWifiListDone(QStringList slist)
{
// 获取当前连接的wifi name
QString actWifiName = "--";
activecon *act = kylin_network_get_activecon_info();
int index = 0;
while(act[index].con_name != NULL){
if(QString(act[index].type) == "wifi"){
actWifiName = QString(act[index].con_name);
break;
}
index ++;
}
//获取表头信息
QString lastHeadLine = lastSlist.at(0);
lastHeadLine = lastHeadLine.trimmed();
int lastIndexName = lastHeadLine.indexOf("SSID");
QString headLine = slist.at(0);
headLine = headLine.trimmed();
int indexRate = headLine.indexOf("RATE");
int indexSecu = headLine.indexOf("SECURITY");
int indexName = headLine.indexOf("SSID");
//列表中去除已经减少的wifi
for (int i=1; i<lastSlist.size(); i++){
QString line = lastSlist.at(i);
QString lastWname = line.mid(lastIndexName).trimmed();
for (int j=1; j<slist.size(); j++){
QString line = slist.at(j);
QString wname = line.mid(indexName).trimmed();
if (lastWname == wname){break;} //到slist最后一个都没找到
if (j == slist.size()-1){
qDebug()<<"will delete a wifi named "<<lastWname;
QList<OneConnForm *> wifiList = wifiListWidget->findChildren<OneConnForm *>();
for(int pos = 0; pos < wifiList.size(); pos ++){
OneConnForm *ocf = wifiList.at(pos);
if (ocf->getName() == lastWname){
if (ocf->isActive == true){break;
} else { delete ocf;
//删除元素下面的的所有元素上移
for(int after_pos = pos+1; after_pos < wifiList.size(); after_pos ++){
OneConnForm *after_ocf = wifiList.at(after_pos);
if (lastWname == currSelNetName) {after_ocf->move(0, after_ocf->y() - 111);}
else {after_ocf->move(0, after_ocf->y() - 60);}
}
wifiListWidget->resize(314, wifiListWidget->height() - 60);
break;
}
}
}
} //end if (j == slist.size()-1)
} //end (int j=1; j<slist.size(); j++)
}
//列表中插入新增的wifi
QStringList wnames;
int count = 0;
for(int i = 1; i < slist.size(); i++){
QString line = slist.at(i);
QString wsignal = line.mid(0, indexRate).trimmed();
QString wrate = line.mid(indexRate, indexSecu - indexRate).trimmed();
QString wsecu = line.mid(indexSecu, indexName - indexSecu).trimmed();
QString wname = line.mid(indexName).trimmed();
if(wname == "" || wname == "--"){continue;}
bool isContinue = false;
foreach (QString addName, wnames) {
// 重复的网络名称,跳过不处理
if(addName == wname){isContinue = true;}
}
if(isContinue){continue;}
wnames.append(wname);
for (int j=1; j < lastSlist.size(); j++){
QString line = lastSlist.at(j);
QString lastWname = line.mid(lastIndexName).trimmed();
if (lastWname == wname){break;}
//到lastSlist最后一个都没找到
if (j == lastSlist.size()-1){
qDebug()<<"will insert a wifi named "<<wname;
QList<OneConnForm *> wifiList = wifiListWidget->findChildren<OneConnForm *>();
int n = wifiList.size();
OneConnForm *lastOcf = wifiList.at(n-1);
lastOcf->setName(wname);
lastOcf->setSafe(wsecu);
lastOcf->setRate(wrate);
lastOcf->setSignal(wsignal);
lastOcf->setSelected(false);
//lastOcf->show();
//添加 连接到隐藏的Wi-Fi网络 小窗口
wifiListWidget->resize(314, wifiListWidget->height() + 60);
OneConnForm *hideNetButton = new OneConnForm(wifiListWidget, this, confForm, ksnm);
//connect(hideNetButton, SIGNAL(selectedOneWifiForm(QString)), this, SLOT(oneHideFormSelected(QString)));
connect(hideNetButton, SIGNAL(selectedOneWifiForm(QString)), this, SLOT(oneWifiFormSelected(QString)));
hideNetButton->setSpecialName(hideWiFiConn);
hideNetButton->setSignal(0);
hideNetButton->setSafe("Safe");
hideNetButton->move(0, lastOcf->y()+60);
hideNetButton->setHideSelected(false);
if (currSelNetName == hideWiFiConn){
hideNetButton->setHideSelected(true);
}
hideNetButton->show();
count += 1;
}
}
}
this->lanListWidget->hide();
this->wifiListWidget->show();
this->stopLoading();
@ -646,6 +801,9 @@ void MainWindow::on_btnWifi_clicked()
void MainWindow::on_btnNetList_clicked(int flag)
{
this->is_btnNetList_clicked = 1;
this->is_btnWifiList_clicked = 0;
// 强行设置为打开
if(flag == 1){
this->startLoading();
@ -659,7 +817,7 @@ void MainWindow::on_btnNetList_clicked(int flag)
if(checkLanOn()){
this->startLoading();
this->ksnm->execGetLanList();
}else{
} else {
// 清空lan列表
lanListWidget = new QWidget(scrollAreal);
lanListWidget->resize(314, 8 + 60 + 46 + 51);
@ -690,10 +848,14 @@ void MainWindow::on_btnNetList_clicked(int flag)
this->scrollAreal->show();
this->scrollAreaw->hide();
on_btnNetList_pressed();
}
void MainWindow::on_btnWifiList_clicked()
{
this->is_btnWifiList_clicked = 1;
this->is_btnNetList_clicked = 0;
if(checkWlOn()){
this->startLoading();
this->ksnm->execGetWifiList();
@ -731,31 +893,179 @@ void MainWindow::on_btnWifiList_clicked()
on_btnWifiList_pressed();
}
// Lan连接结果0成功 1失败
// Lan连接结果0点击连接成功 1失败 3开机直连成功
void MainWindow::connLanDone(int connFlag){
if(connFlag == 0){
this->is_NetLineReady = 1;
this->isByClickConnect = 1;
this->ksnm->execGetLanList();
QString txt(tr("Conn Ethernet Success"));
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800";
system(cmd.toUtf8().data());
check_isLanConnect = new QTimer(this);
check_isLanConnect->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isLanConnect, SIGNAL(timeout()), this, SLOT(on_isLanConnect()));
check_isLanConnect->start(4000);
}
if(connFlag == 1){
this->is_NetLineReady = 0; //without net line connect to computer
QString txt(tr("Conn Ethernet Fail"));
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800";
system(cmd.toUtf8().data());
}
if(connFlag == 3){
this->is_NetLineReady = 1;
check_isLanConnect = new QTimer(this);
check_isLanConnect->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isLanConnect, SIGNAL(timeout()), this, SLOT(on_isLanConnect()));
check_isLanConnect->start(4000);
}
this->stopLoading();
}
// Wifi连接结果0成功 1失败 2没有配置文件
void MainWindow::on_isLanConnect()
{
BackThread *bt = new BackThread();
IFace *iface = bt->execGetIface();
if (iface->lstate == 1){
qDebug()<<"注意Lan 网络连接已经断开";
if(this->is_btnNetList_clicked == 1) {
this->ksnm->execGetLanList();
}
if(this->is_btnWifiList_clicked== 1) {
this->ksnm->execGetWifiList();
}
this->isByClickConnect = 0;
check_isLanConnect->stop();
if (iface->wstate != 0){
qDebug()<<"即将检测是否重新开启 Lan或Wifi";
check_isNetOn = new QTimer(this);
check_isNetOn->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isNetOn, SIGNAL(timeout()), this, SLOT(on_isNetOn()));
check_isNetOn->start(4000);
}
} else if (iface->wstate != 2) {
count_loop += 1;
if (count_loop >= 2 && this->is_btnWifiList_clicked == 1){
//period update wifilist
updateFlag = 1;
this->ksnm->execGetWifiList();
count_loop = 0;
}
}
}
void MainWindow::on_isNetOn()
{
BackThread *bt = new BackThread();
IFace *iface = bt->execGetIface();
if (iface->lstate == 0 && this->isByClickConnect == 0 && this->is_NetLineReady == 1){
qDebug()<<"注意:有线网络已经重新连接";
if(this->is_btnNetList_clicked == 1) {
this->ksnm->execGetLanList();
}
if(this->is_btnWifiList_clicked== 1) {
this->ksnm->execGetWifiList();
}
check_isNetOn->stop();
qDebug()<<"即将重新检测 Lan 是否断开";
check_isLanConnect = new QTimer(this);
check_isLanConnect->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isLanConnect, SIGNAL(timeout()), this, SLOT(on_isLanConnect()));
check_isLanConnect->start(4000);
} else if (iface->lstate == 0 && this->isByClickConnect == 1){
qDebug()<<"注意:有线网络已经重新连接";
check_isNetOn->stop();
} else if (iface->wstate == 0 && this->isByClickConnect == 0){
qDebug()<<"注意Wifi网络已经重新连接";
if(this->is_btnNetList_clicked == 1) {
this->ksnm->execGetLanList();
}
if(this->is_btnWifiList_clicked== 1) {
this->ksnm->execGetWifiList();
}
check_isNetOn->stop();
qDebug()<<"即将重新检测 Wifi 是否断开";
check_isWifiConnect = new QTimer(this);
check_isWifiConnect->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isWifiConnect, SIGNAL(timeout()), this, SLOT(on_isWifiConnect()));
check_isWifiConnect->start(4000);
} else if (iface->wstate == 0 && this->isByClickConnect == 1){
qDebug()<<"注意Wifi网络已经重新连接";
check_isNetOn->stop();
} else if (iface->wstate != 2) {
count_loop += 1;
if (count_loop >= 2 && this->is_btnWifiList_clicked == 1){
//period update wifilist
updateFlag = 1;
this->ksnm->execGetWifiList();
count_loop = 0;
}
}
}
// Wifi连接结果0点击连接成功 1失败 2没有配置文件 3开机直连成功
void MainWindow::connDone(int connFlag){
if(connFlag == 0){
qDebug()<<"Wifi connected successfully";
this->isByClickConnect = 1;
this->ksnm->execGetWifiList();
QString txt(tr("Conn Wifi Success"));
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800";
system(cmd.toUtf8().data());
check_isWifiConnect = new QTimer(this);
check_isWifiConnect->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isWifiConnect, SIGNAL(timeout()), this, SLOT(on_isWifiConnect()));
check_isWifiConnect->start(4000);
} else if (connFlag == 3) {
check_isWifiConnect = new QTimer(this);
check_isWifiConnect->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isWifiConnect, SIGNAL(timeout()), this, SLOT(on_isWifiConnect()));
check_isWifiConnect->start(4000);
}
}
void MainWindow::on_isWifiConnect()
{
BackThread *bt = new BackThread();
IFace *iface = bt->execGetIface();
if (iface->wstate == 1){
qDebug()<<"注意Wifi 网络连接已经断开";
if(this->is_btnNetList_clicked == 1) {
this->ksnm->execGetLanList();
}
if(this->is_btnWifiList_clicked== 1) {
this->ksnm->execGetWifiList();
}
this->isByClickConnect = 0;
check_isWifiConnect->stop();
if (iface->lstate != 0){
qDebug()<<"即将检测是否重新开启 Lan或Wifi";
check_isNetOn = new QTimer(this);
check_isNetOn->setTimerType(Qt::PreciseTimer);
QObject::connect(check_isNetOn, SIGNAL(timeout()), this, SLOT(on_isNetOn()));
check_isNetOn->start(4000);
}
} else if (iface->wstate != 2){
count_loop += 1;
if (count_loop >= 2 && this->is_btnWifiList_clicked == 1){
//period update wifilist
updateFlag = 1;
this->ksnm->execGetWifiList();
count_loop = 0;
}
}
}
@ -794,28 +1104,42 @@ void MainWindow::oneLanFormSelected(QString lanName){
}
lbLanList->move(12, 68);
// 设置选中,放大缩小所有选项卡
int selectY = 0;
for(int i = 0;i < lanList.size(); i ++){
OneLancForm *ocf = lanList.at(i);
if(ocf->lanName == lanName){
ocf->setSelected(true);
selectY = ocf->y();
}else{
ocf->setSelected(false);
//是否与上一次选中同一个网络框
if (currSelNetName == lanName){
// 设置选中,缩小所有选项卡
for(int i = 0;i < lanList.size(); i ++){
OneLancForm *ocf = lanList.at(i);
ocf->setSelected(false);
}
currSelNetName = "";
} else {
// 设置选中,放大缩小所有选项卡
int selectY = 0;
for(int i = 0;i < lanList.size(); i ++){
OneLancForm *ocf = lanList.at(i);
if(ocf->lanName == lanName){
ocf->setSelected(true);
selectY = ocf->y();
}else{
ocf->setSelected(false);
}
}
// 选中元素下面的所有元素下移51
for(int i = 0;i < lanList.size(); i ++){
OneLancForm *ocf = lanList.at(i);
if(ocf->y() > selectY){
ocf->move(0, ocf->y() + 51);
}
}
if(lbLanList->y() > selectY){
lbLanList->move(12, 68 + 51);
}
currSelNetName = lanName;
}
// 选中元素下面的所有元素下移51
for(int i = 0;i < lanList.size(); i ++){
OneLancForm *ocf = lanList.at(i);
if(ocf->y() > selectY){
ocf->move(0, ocf->y() + 51);
}
}
if(lbLanList->y() > selectY){
lbLanList->move(12, 68 + 51);
}
}
void MainWindow::oneWifiFormSelected(QString wifiName){
@ -834,38 +1158,110 @@ void MainWindow::oneWifiFormSelected(QString wifiName){
}
lbWifiList->move(12, 68);
//是否与上一次选中同一个网络框
if (currSelNetName == wifiName){
// 设置选中,缩小所有选项卡
for(int i = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if (ocf->wifiName == hideWiFiConn){
ocf->setHideSelected(false);
}else{
ocf->setSelected(false);
}
}
currSelNetName = "";
} else {
// 设置选中,放大缩小所有选项卡
int selectY = 0;
for(int i = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if(ocf->wifiName == wifiName){
if (ocf->wifiName == hideWiFiConn){
ocf->setHideSelected(true);
}else{
ocf->setSelected(true);
}
selectY = ocf->y();
}else{
if (ocf->wifiName == hideWiFiConn){
ocf->setHideSelected(false);
}else{
ocf->setSelected(false);
}
}
}
// 选中元素下面的所有元素下移51
for(int i = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if(ocf->y() > selectY){
ocf->move(0, ocf->y() + 51);
}
}
if(lbWifiList->y() > selectY){
lbWifiList->move(12, 68 + 51);
}
currSelNetName = wifiName;
}
}
void MainWindow::oneHideFormSelected(QString wifiName){
QList<OneConnForm *> wifiList = wifiListWidget->findChildren<OneConnForm *>();
// 所有元素回到原位
for(int i = 0, j = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if(ocf->isActive == true){
ocf->move(0, 8);
}
if(ocf->isActive == false){
ocf->move(0, 114 + j * 60);
j ++;
}
}
lbWifiList->move(12, 68);
//是否与上一次选中同一个网络框 0否 1是
int isReSelect = 0;
if (currSelNetName == wifiName){
isReSelect = 1;
currSelNetName = "";
} else {
isReSelect = 0;
currSelNetName = wifiName;
}
// 设置选中,放大缩小所有选项卡
int selectY = 0;
for(int i = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if(ocf->wifiName == wifiName){
ocf->setSelected(true);
selectY = ocf->y();
}else{
if (ocf->wifiName == hideWiFiConn){
if (isReSelect == 0){
ocf->setHideSelected(true);
selectY = ocf->y();
} else if (isReSelect == 1){
ocf->setHideSelected(false);
}
} else {
ocf->setSelected(false);
}
}
// 选中元素下面的所有元素下移51
for(int i = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if(ocf->y() > selectY){
ocf->move(0, ocf->y() + 51);
}
}
if(lbWifiList->y() > selectY){
lbWifiList->move(12, 68 + 51);
}
}
void MainWindow::activeLanDisconn(){
this->startLoading();
this->ksnm->execGetLanList();
currSelNetName = "";
}
void MainWindow::activeWifiDisconn(){
this->startLoading();
this->ksnm->execGetWifiList();
currSelNetName = "";
}
void MainWindow::on_btnAdvConf_pressed()
@ -915,7 +1311,7 @@ void MainWindow::disNetDone(){
ccf->move(0, 8);
ccf->show();
// 可用lan列表
// 名为可用网络列表一栏
lbLanList = new QLabel(lanListWidget);
lbLanList->setText(tr("Ethernet Networks"));//"可用网络列表"
lbLanList->resize(260, 46);
@ -979,5 +1375,7 @@ void MainWindow::disWifiDone(){
this->scrollAreal->hide();
this->scrollAreaw->show();
on_btnWifiList_pressed();
this->stopLoading();
}

View File

@ -26,11 +26,13 @@
#include <QDesktopWidget>
#include <QScrollBar>
#include <QScrollArea>
#include <QPushButton>
#include <QScreen>
#include <QMenu>
#include <QAction>
#include <QDebug>
#include <QString>
#include <QTimer>
#include <fcntl.h>
#include <sys/types.h>
@ -100,11 +102,29 @@ private:
// 以太网卡和无线网卡名称
QString lname, wname;
//当前ScrollArea中选中的网络名称
QString currSelNetName = "";
// 主界面按钮底色
QString btnOffQss, btnOnQss;
//上一次获取wifi列表
QStringList lastSlist;
//循环检测网络连接状态
QTimer *iconTimer;
QTimer *check_isLanConnect;
QTimer *check_isWifiConnect;
QTimer *check_isNetOn;
//按钮点击状态
int isByClickConnect = 0;
int is_btnNetList_clicked = 1;
int is_btnWifiList_clicked = 0;
int is_NetLineReady = 1;
int currentIconIndex;
int updateFlag = 0;
private slots:
void iconActivated(QSystemTrayIcon::ActivationReason reason);
@ -117,6 +137,8 @@ private slots:
void getLanListDone(QStringList slist);
void getWifiListDone(QStringList slist);
void loadWifiListDone(QStringList slist);
void updateWifiListDone(QStringList slist);
void on_btnAdvConf_clicked();
void on_btnNetList_pressed();
@ -124,10 +146,14 @@ private slots:
void oneLanFormSelected(QString lanName);
void oneWifiFormSelected(QString wifiName);
void oneHideFormSelected(QString wifiName);
void activeLanDisconn();
void activeWifiDisconn();
void on_btnAdvConf_pressed();
void on_btnAdvConf_released();
void on_isLanConnect();
void on_isWifiConnect();
void on_isNetOn();
// 后台回调
void enNetDone();

View File

@ -62,5 +62,12 @@
<file>res/s/rescan/11.png</file>
<file>res/s/rescan/12.png</file>
<file>res/kylin-nm_zh_CN.qm</file>
<file>res/wifi.png</file>
<file>res/h/add-hide-wifi.png</file>
<file>res/h/add-hide-wifi.svg</file>
<file>res/h/hide-pwd.png</file>
<file>res/h/right-pwd.png</file>
<file>res/h/show-pwd.png</file>
<file>res/h/no-pwd-wifi.png</file>
</qresource>
</RCC>

View File

@ -19,6 +19,7 @@
#include "oneconnform.h"
#include "ui_oneconnform.h"
#include "mainwindow.h"
#include "dlgconnhidwifi.h"
extern int currentActWifiSignalLv;
@ -33,6 +34,7 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->btnConn->setText(tr("Connect"));//"连接"
ui->btnConnPWD->setText(tr("Connect"));//"连接"
ui->btnDisConn->setText(tr("Disconnect"));//"断开连接"
ui->btnHideConn->setText(tr("Connect"));//"连接"
ui->lePassword->setEchoMode(QLineEdit::Password);
ui->wbg->hide();
@ -42,6 +44,7 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->btnConn->hide();
ui->btnDisConn->hide();
ui->btnConnPWD->hide();
ui->btnHideConn->hide();
ui->lbConned->setAlignment(Qt::AlignRight);
@ -63,6 +66,9 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->btnDisConn->setStyleSheet("QPushButton{border:0px;background-color:rgba(0,0,0,0.4);color:white;font-size:12px;}"
"QPushButton:Hover{border:1px solid rgba(255,255,255,0.2);background-color:rgba(0,0,0,0.2);}"
"QPushButton:Pressed{background-color:rgba(0,0,0,0.6);}");
ui->btnHideConn->setStyleSheet("QPushButton{border:0px;background-color:rgba(0,0,0,0.4);color:white;font-size:12px;}"
"QPushButton:Hover{border:1px solid rgba(255,255,255,0.2);background-color:rgba(0,0,0,0.2);}"
"QPushButton:Pressed{background-color:rgba(0,0,0,0.6);}");
this->mw = mainWindow;
this->cf = confForm;
@ -104,8 +110,10 @@ void OneConnForm::setSelected(bool isSelected){
ui->wbg->show();
// ui->btnConf->show();
if(isActive){
ui->btnHideConn->hide();
ui->btnDisConn->show();
}else{
ui->btnHideConn->hide();
ui->btnConn->show();
}
@ -123,6 +131,7 @@ void OneConnForm::setSelected(bool isSelected){
ui->btnConn->hide();
ui->btnDisConn->hide();
ui->btnHideConn->hide();
ui->lbPassword->hide();
ui->lePassword->hide();
@ -136,6 +145,49 @@ void OneConnForm::setSelected(bool isSelected){
this->isSelected = false;
}
}
// 是否选中连接隐藏Wifi小窗口
void OneConnForm::setHideSelected(bool isSelected){
if(isSelected){
resize(314, 111);
ui->wbg->show();
ui->btnConf->hide();
ui->btnConn->hide();
ui->btnDisConn->hide();
ui->btnHideConn->show();
ui->lbPassword->hide();
ui->lePassword->hide();
ui->btnConnPWD->hide();
ui->lbName->show();
ui->lbSafe->show();
ui->lbSignal->show();
ui->lbPoint->hide();
this->isSelected = true;
} else {
resize(314, 60);
ui->wbg->hide();
ui->btnConf->hide();
ui->btnConn->hide();
ui->btnDisConn->hide();
ui->btnHideConn->hide();
ui->lbPassword->hide();
ui->lePassword->hide();
ui->btnConnPWD->hide();
ui->lbName->show();
ui->lbSafe->show();
ui->lbSignal->show();
ui->lbPoint->hide();
this->isSelected = false;
}
}
void OneConnForm::setConnedString(QString str){
ui->lbConned->setText(str);
@ -166,6 +218,16 @@ void OneConnForm::setName(QString name){
ui->lbName->setText(name);
wifiName = name;
}
void OneConnForm::setSpecialName(QString name)
{
ui->lbName->setText(tr("Connect to Hidden Wi-Fi Network")); //连接到隐藏的 Wi-Fi 网络
wifiName = name;
}
QString OneConnForm::getName()
{
return ui->lbName->text();
}
void OneConnForm::setSafe(QString safe){
if(safe == "--"){
@ -318,6 +380,14 @@ void OneConnForm::on_btnConnPWD_clicked()
t->start();
}
void OneConnForm::on_btnHideConn_clicked()
{
QApplication::setQuitOnLastWindowClosed(false);
DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0, mw);
connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) );
connHidWifi->show();
}
// Wifi连接结果0成功 1失败 2没有配置文件
void OneConnForm::slotConnDone(int connFlag){
qDebug()<<"slot conn done: "<<connFlag;

View File

@ -22,6 +22,7 @@
#include <QWidget>
#include <QScreen>
#include <QThread>
#include <QDialog>
#include "confform.h"
#include "kylin-network-interface.h"
@ -44,10 +45,13 @@ public:
void setSignal(QString lv);
void setName(QString name);
void setSpecialName(QString name);
QString getName();
void setSafe(QString safe);
void setRate(QString rate);
void setSelected(bool isSelected);
void setHideSelected(bool isSelected);
void setAct(bool isAct);
void setSafeString(QString str);
@ -83,6 +87,8 @@ private slots:
void on_btnConnPWD_clicked();
void on_btnHideConn_clicked();
private:
Ui::OneConnForm *ui;
MainWindow *mw;

View File

@ -163,6 +163,19 @@
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnHideConn">
<property name="geometry">
<rect>
<x>162</x>
<y>70</y>
<width>129</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>wbg</zorder>
<zorder>lbName</zorder>
<zorder>btnConf</zorder>
@ -175,6 +188,7 @@
<zorder>btnDisConn</zorder>
<zorder>lbPassword</zorder>
<zorder>btnConnPWD</zorder>
<zorder>btnHideConn</zorder>
</widget>
<resources/>
<connections/>

BIN
res/h/add-hide-wifi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

16
res/h/add-hide-wifi.svg Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="16px" height="16px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="_16">
<rect x="13" y="9" class="st0" width="1" height="1"/>
<path class="st0" d="M15,12v-2h-1v2h-1v-2h-1v2h-1v3h5v-3H15z"/>
<path class="st0" d="M8,14.5c-1,0-1.8-0.8-1.8-1.8S7,10.9,8,10.9s1.8,0.8,1.8,1.8S9,14.5,8,14.5L8,14.5z"/>
<path class="st0" d="M5.4,10.3c1.4-1.4,3.6-1.4,5-0.1l0.1,0.1l0.7-0.7C9.5,7.8,6.6,7.8,4.9,9.5L4.8,9.6L5.4,10.3z"/>
<path class="st0" d="M3.1,7.9c2.7-2.7,7-2.8,9.8-0.1L13,7.9l0.7-0.7c-3.1-3.1-8-3.1-11.1-0.1L2.5,7.2L3.1,7.9z"/>
<path class="st0" d="M0.7,5.5c4-4,10.5-4.1,14.5-0.1l0.1,0.1L16,4.8C11.6,0.4,4.5,0.4,0.1,4.7L0,4.8L0.7,5.5z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
res/h/hide-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
res/h/no-pwd-wifi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
res/h/right-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
res/h/show-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
res/wifi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB