Feat: Add menu for wifi to connect/disconnect/forget wifi.
Optimize log.
This commit is contained in:
parent
f38a73cb45
commit
23dc7f35bf
|
@ -19,8 +19,6 @@
|
|||
#ifndef DLGHOTSPOTCREATE_H
|
||||
#define DLGHOTSPOTCREATE_H
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
@ -57,8 +56,6 @@ IFace* BackThread::execGetIface()
|
|||
|
||||
QFile file(tmpPath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
// print information if can not open file ~/.config/kylin-nm-iface
|
||||
//syslog(LOG_ERR, "Can't open the file ~/.config/kylin-nm-iface!");
|
||||
qDebug()<<"Can't open the file ~/.config/kylin-nm-iface!";
|
||||
}
|
||||
QString txt = file.readAll();
|
||||
|
@ -228,7 +225,6 @@ void BackThread::execConnLan(QString connName, QString ifname, QString connectTy
|
|||
cmdProcessLan->waitForFinished();
|
||||
} else {
|
||||
qDebug()<<"connect wired network failed for without wired cable plug in.";
|
||||
//syslog(LOG_DEBUG, "connect wired network failed for without wired cable plug in.");
|
||||
emit connDone(1);
|
||||
}
|
||||
|
||||
|
@ -254,7 +250,6 @@ void BackThread::dellConnectLanResult(QString info)
|
|||
{
|
||||
if (info.indexOf("successfully") != -1) {
|
||||
qDebug()<<"debug: in function execConnLan, wired net state is: "<<QString::number(execGetIface()->lstate);
|
||||
//syslog(LOG_DEBUG, "In function execConnLan, wired net state is: %d", execGetIface()->lstate);
|
||||
|
||||
if (currConnLanType == "bluetooth") {
|
||||
emit connDone(2);
|
||||
|
@ -307,7 +302,6 @@ void BackThread::execConnWifiPWD(QString connName, QString password, QString con
|
|||
|
||||
QFile file(tmpPath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
//syslog(LOG_DEBUG, "Can't open the file /tmp/kylin-nm-btoutput !");
|
||||
qDebug()<<"Can't open the file /tmp/kylin-nm-btoutput !"<<endl;
|
||||
}
|
||||
QString line = file.readLine();
|
||||
|
@ -317,7 +311,6 @@ void BackThread::execConnWifiPWD(QString connName, QString password, QString con
|
|||
if (line.indexOf("successfully") != -1) {
|
||||
emit connDone(0);
|
||||
qDebug()<<"debug: in function execConnWifiPWD, wireless net state is: "<<QString::number(execGetIface()->wstate);
|
||||
//syslog(LOG_DEBUG, "In function execConnWifiPWD, wireless net state is: %d", execGetIface()->wstate);
|
||||
} else if(line.indexOf("Secrets were required") != -1){
|
||||
//emit connDone(4);//发出信号4是之前添加每次连接输入密码的功能时需要的
|
||||
emit connDone(1);
|
||||
|
@ -334,7 +327,7 @@ void BackThread::execConnHiddenWifiWPA(QString wifiName, QString wifiPassword)
|
|||
do {
|
||||
n += 1;
|
||||
if (n >= 4) {
|
||||
//syslog(LOG_ERR, "connection attempt of hidden wifi %s failed for 3 times, no more attempt", wifiName);
|
||||
qDebug()<<"connection attempt of hidden wifi"<<wifiName<<" failed for 3 times, no more attempt";
|
||||
x = 0;
|
||||
emit connDone(1);
|
||||
emit btFinish();
|
||||
|
@ -344,11 +337,8 @@ void BackThread::execConnHiddenWifiWPA(QString wifiName, QString wifiPassword)
|
|||
QString tmpPath = "/tmp/kylin-nm-btoutput-" + QDir::home().dirName();
|
||||
QString cmd = "nmcli device wifi connect '" + wifiName + "' password '" + wifiPassword + "' hidden yes > " + tmpPath + " 2>&1";
|
||||
|
||||
qDebug() << Q_FUNC_INFO << cmd << tmpPath;
|
||||
int status = Utils::m_system(cmd.toUtf8().data());
|
||||
if (status != 0) {
|
||||
//syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_btnConnect_clicked' failed");
|
||||
}
|
||||
qDebug() << Q_FUNC_INFO << cmd << tmpPath << "res=" << status;
|
||||
|
||||
QFile file(tmpPath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
|
@ -365,7 +355,6 @@ void BackThread::execConnHiddenWifiWPA(QString wifiName, QString wifiPassword)
|
|||
emit connDone(6);
|
||||
x = 0;
|
||||
}
|
||||
// qDebug() << Q_FUNC_INFO << x << text;
|
||||
} while (x == 1);
|
||||
|
||||
emit btFinish();
|
||||
|
@ -396,7 +385,7 @@ void BackThread::execConnRememberedHiddenWifi(QString wifiName)
|
|||
}
|
||||
} else {
|
||||
//已保存的wifi没有在wifi列表找到(隐藏wifi保存后也会出现在wifi列表),则当前区域无法连接此wifi
|
||||
//syslog(LOG_DEBUG, "Choosen wifi can not be sacnned in finishedProcess() in dlghidewifiwpa.cpp 377.");
|
||||
qDebug() << "Choosen wifi can not be sacnned, wifiName=" << wifiName;
|
||||
emit connDone(5);
|
||||
}
|
||||
}
|
||||
|
@ -411,22 +400,19 @@ void BackThread::execConnWifiPsk(QString cmd)
|
|||
//to connected wireless network driectly do not need a password
|
||||
void BackThread::execConnWifi(QString connName, QString connIfName)
|
||||
{
|
||||
qDebug() << "Will to connect wifi " << connName << " with wifi card named " <<connIfName;
|
||||
//syslog(LOG_DEBUG, "Will to connect wifi %s with wifi card named %s", connName.toUtf8().data(), connIfName.toUtf8().data());
|
||||
qDebug() << "Will to connect wifi " << connName << " with wifi card named " << connIfName;
|
||||
|
||||
QString cmdStr;
|
||||
KylinDBus objBackThreadDBus;
|
||||
QString wifiUuid = objBackThreadDBus.checkHasWifiConfigFile(connName);
|
||||
if (!wifiUuid.isEmpty()) {
|
||||
//有配置文件
|
||||
//qDebug() << "-------------------------> wifiUuid = " << wifiUuid;
|
||||
cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + wifiUuid + "'\n";
|
||||
} else {
|
||||
//没有配置文件
|
||||
//qDebug() << "-------------------------> connName = " << connName;
|
||||
cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' ifname '" + connIfName + "'\n";
|
||||
}
|
||||
qDebug()<<"Trying to connect wifi. ssid="<<connName;
|
||||
qDebug() << "Trying to connect wifi. cmd=" << cmdStr;
|
||||
|
||||
QStringList options;
|
||||
options << "-c" << cmdStr;
|
||||
|
@ -448,14 +434,12 @@ void BackThread::onReadOutputWifi()
|
|||
{
|
||||
QString str = cmdProcessWifi->readAllStandardOutput();
|
||||
qDebug()<<"on_readoutput_wifi: "<< str;
|
||||
//syslog(LOG_DEBUG, "on_readoutput_wifi : %s", str.toUtf8().data());
|
||||
dellConnectWifiResult(str);
|
||||
}
|
||||
void BackThread::onReadErrorWifi()
|
||||
{
|
||||
QString str = cmdProcessWifi->readAllStandardError();
|
||||
qDebug()<<"on_readerror_wifi: "<< str;
|
||||
//syslog(LOG_DEBUG, "on_readerror_wifi : %s", str.toUtf8().data());
|
||||
dellConnectWifiResult(str);
|
||||
}
|
||||
|
||||
|
@ -491,8 +475,7 @@ QString BackThread::getConnProp(QString connName)
|
|||
|
||||
QFile file(tmpPath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
//syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-connprop!");
|
||||
qDebug()<<"Can't open the file /tmp/kylin-nm-connprop!"<<endl;
|
||||
qDebug() << "Can't open the file /tmp/kylin-nm-connprop!";
|
||||
}
|
||||
|
||||
QString txt = file.readAll();
|
||||
|
@ -565,12 +548,12 @@ QString BackThread::execChkLanWidth(QString ethName)
|
|||
{
|
||||
QString tmpPath = "/tmp/kylin-nm-bandwidth-" + QDir::home().dirName();
|
||||
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';ethtool '" + ethName + "' | grep Speed > " + tmpPath;
|
||||
Utils::m_system(cmd.toUtf8().data());
|
||||
int res = Utils::m_system(cmd.toUtf8().data());
|
||||
qDebug() << "executed cmd=" << cmd << ".res="<<res;
|
||||
|
||||
QFile file(tmpPath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
//syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-bandwidth!");
|
||||
qDebug()<<"Can't open the file /tmp/kylin-nm-bandwidth!"<<endl;
|
||||
qDebug() << "Can't open the file /tmp/kylin-nm-bandwidth!";
|
||||
}
|
||||
QString line = file.readLine();
|
||||
file.close();
|
||||
|
@ -606,8 +589,7 @@ void BackThread::disConnLanOrWifi(QString type)
|
|||
|
||||
p_file = popen("nmcli connection show -active", "r");
|
||||
if (!p_file) {
|
||||
//syslog(LOG_ERR, "Error occurred when popen cmd 'nmcli connection show'");
|
||||
qDebug()<<"Error occurred when popen cmd 'nmcli connection show";
|
||||
qDebug() << "Error occurred when popen cmd 'nmcli connection show";
|
||||
}
|
||||
|
||||
while (fgets(buf, BUF_SIZE, p_file) != NULL) {
|
||||
|
|
|
@ -360,11 +360,7 @@ void ConfForm::on_btnSave_clicked()
|
|||
// QString cmd = "nmcli connection delete '" + netUuid + "'";
|
||||
QString cmd = "nmcli connection modify '" + lastConnName + "' con-name '"+name+"'";
|
||||
int status = system(cmd.toUtf8().data());
|
||||
if (status != 0) {
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'on_btnSave_clicked' failed");
|
||||
} else {
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'on_btnSave_clicked' success");
|
||||
}
|
||||
qDebug()<<"executed 'nmcli connection modify'. cmd="<<cmd<<". res="<<status;
|
||||
|
||||
// this->isCreateNewNet = true;
|
||||
// newUuid = "--";
|
||||
|
|
|
@ -50,7 +50,6 @@ KSimpleNM::~KSimpleNM()
|
|||
void KSimpleNM::execGetLanList()
|
||||
{
|
||||
if (isExecutingGetLanList) {
|
||||
//syslog(LOG_DEBUG, "It is running getting lan list when getting lan list");
|
||||
qDebug()<<"debug: it is running getting lan list when getting lan list";
|
||||
isUseOldLanSlist = true;
|
||||
QStringList slistmEmpty;
|
||||
|
@ -73,7 +72,6 @@ void KSimpleNM::execGetLanList()
|
|||
void KSimpleNM::execGetWifiList(const QString& wname, const bool &isHuaweiPc)
|
||||
{
|
||||
if (isExecutingGetWifiList) {
|
||||
//syslog(LOG_DEBUG, "It is running getting wifi list when getting wifi list");
|
||||
qDebug()<<"debug: it is running getting wifi list when getting wifi list";
|
||||
isUseOldWifiSlist = true;
|
||||
QStringList slistmEmpty;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#ifndef KSIMPLENM_H
|
||||
#define KSIMPLENM_H
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QDebug>
|
||||
|
|
|
@ -95,14 +95,12 @@ KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent)
|
|||
QString("PropertiesChanged"), this, SLOT(onLanPropertyChanged(QVariantMap) ) );
|
||||
}
|
||||
} else {
|
||||
//syslog(LOG_DEBUG, "Can not find wired device object path when using dbus.");
|
||||
qDebug()<<"Can not find wired device object path when using dbus.";
|
||||
}
|
||||
|
||||
if (!multiWirelessPaths.isEmpty()) {
|
||||
getWirelessCardName();//获取无线网卡名称
|
||||
} else {
|
||||
//syslog(LOG_DEBUG, "Can not find wireless device object path when using dbus.");
|
||||
qDebug()<<"Can not find wireless device object path when using dbus.";
|
||||
}
|
||||
|
||||
|
@ -154,7 +152,6 @@ void KylinDBus::getObjectPath()
|
|||
//先获取所有的网络设备的设备路径
|
||||
QDBusReply<QList<QDBusObjectPath>> obj_reply = m_interface.call("GetAllDevices");
|
||||
if (!obj_reply.isValid()) {
|
||||
//syslog(LOG_DEBUG, "execute dbus method 'GetAllDevices' is invalid in func getObjectPath()");
|
||||
qDebug()<<"execute dbus method 'GetAllDevices' is invalid in func getObjectPath()";
|
||||
}
|
||||
|
||||
|
@ -169,7 +166,6 @@ void KylinDBus::getObjectPath()
|
|||
|
||||
QDBusReply<QString> reply = interface.call("Introspect");
|
||||
if (!reply.isValid()) {
|
||||
//syslog(LOG_DEBUG, "execute dbus method 'Introspect' is invalid in func getObjectPath()");
|
||||
qDebug()<<"execute dbus method 'Introspect' is invalid in func getObjectPath()";
|
||||
}
|
||||
|
||||
|
@ -210,7 +206,6 @@ void KylinDBus::getPhysicalCarrierState(int n)
|
|||
throw -1; //出现异常
|
||||
}
|
||||
} catch(...) {
|
||||
//syslog(LOG_ERR, "Error occurred when get the property 'Carrier' of Wired");
|
||||
qDebug()<<"Error occurred when get the property 'Carrier' of Wired";
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +235,6 @@ void KylinDBus::getLanHwAddressState()
|
|||
|
||||
QDBusReply<QVariant> lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "HwAddress");
|
||||
if (!lanReply.isValid()) {
|
||||
//syslog(LOG_DEBUG, "can not get the attribute 'HwAddress' in func getLanHwAddressState()");
|
||||
qDebug()<<"can not get the attribute 'HwAddress' in func getLanHwAddressState()";
|
||||
} else {
|
||||
QString dbusLanMac = lanReply.value().toString();
|
||||
|
@ -270,7 +264,6 @@ void KylinDBus::getWiredCardName()
|
|||
|
||||
QDBusReply<QVariant> lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface");
|
||||
if (!lanReply.isValid()) {
|
||||
//syslog(LOG_DEBUG, "can not get the attribute 'Interface' in func getWiredCardName()");
|
||||
qDebug()<<"can not get the attribute 'Interface' in func getWiredCardName()";
|
||||
} else {
|
||||
QString dbusLanCardName = lanReply.value().toString();
|
||||
|
@ -294,7 +287,6 @@ void KylinDBus::getWirelessCardName()
|
|||
|
||||
QDBusReply<QVariant> lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface");
|
||||
if (!lanReply.isValid()) {
|
||||
//syslog(LOG_DEBUG, "can not get the attribute 'Interface' in func getWirelessCardName()");
|
||||
qDebug()<<"can not get the attribute 'Interface' in func getWirelessCardName()";
|
||||
} else {
|
||||
dbusWiFiCardName = lanReply.value().toString();
|
||||
|
@ -1040,11 +1032,9 @@ void KylinDBus::onNewConnection(QDBusObjectPath objPath)
|
|||
emit this->newConnAdded(0);
|
||||
m_lanPathList.append(objPath.path());
|
||||
emit mw->wiredConnectionAdded();
|
||||
//syslog(LOG_DEBUG, "A new wired network was created.");
|
||||
qDebug()<<"A new wired network was created.";
|
||||
break;
|
||||
} else if (key == "802-11-wireless") {
|
||||
//syslog(LOG_DEBUG, "A new wireless network(wifi) was created.");
|
||||
qDebug()<<"A new wireless network was created.";
|
||||
sleep(1);
|
||||
bool has_wpa_psk = false;
|
||||
|
@ -1104,7 +1094,6 @@ void KylinDBus::onNewConnection(QDBusObjectPath objPath)
|
|||
//减少了一个网络,伴随着减少了一个网络配置文件
|
||||
void KylinDBus::onConnectionRemoved(QDBusObjectPath objPath)
|
||||
{
|
||||
//syslog(LOG_DEBUG, "An old network was removed from configure directory.");
|
||||
if (m_lanPathList.contains(objPath.path())) {
|
||||
m_lanPathList.removeOne(objPath.path());
|
||||
qDebug()<<"An old network was removed from configure directory.";
|
||||
|
@ -1718,8 +1707,7 @@ void KylinDBus::onPropertiesChanged(QVariantMap qvm)
|
|||
//接收到自动连接的信号过后执行自动连接wifi
|
||||
void KylinDBus::onAutoConnect()
|
||||
{
|
||||
//syslog(LOG_DEBUG, "Receive a auto-connect signal to reconnect wifi");
|
||||
qDebug() << Q_FUNC_INFO << "Receive a auto-connect signal to reconnect wifi";
|
||||
qDebug() << "Receive a auto-connect signal to reconnect wifi";
|
||||
mw->toReconnectWifi();
|
||||
}
|
||||
|
||||
|
@ -1727,7 +1715,6 @@ void KylinDBus::onAutoConnect()
|
|||
void KylinDBus::onLanPropertyChanged(QVariantMap qvm)
|
||||
{
|
||||
if (!isRunningFunction) {
|
||||
//syslog(LOG_DEBUG, "kylin-nm receive a signal 'Device.Wired PropertiesChanged' about interface.");
|
||||
qDebug()<<"kylin-nm receive a signal 'Device.Wired PropertiesChanged' about interface.";
|
||||
isRunningFunction = true; //function onLanPropertyChanged is running
|
||||
time->start(3000);
|
||||
|
@ -2060,11 +2047,9 @@ void KylinDBus::getWifiSwitchState()
|
|||
if (judge) {
|
||||
mw->onBtnWifiClicked(2); //打开wifi开关
|
||||
qDebug()<<"receive a signal to turn on wifi switch from control-center";
|
||||
//syslog(LOG_DEBUG, "receive a signal to turn on wifi switch from control-center");
|
||||
} else {
|
||||
mw->onBtnWifiClicked(3); //关闭wifi开关
|
||||
qDebug()<<"receive a signal to turn off wifi switch from control-center";
|
||||
//syslog(LOG_DEBUG, "receive a signal to turn off wifi switch from control-center");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#ifndef KYLINDBUSINTERFACE_H
|
||||
#define KYLINDBUSINTERFACE_H
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <X11/Xlib.h>
|
||||
#include <syslog.h>
|
||||
#include <QFile>
|
||||
|
||||
#define LOG_IDENT "ukui_kylin_nm"
|
||||
|
@ -84,15 +83,12 @@ int main(int argc, char *argv[])
|
|||
QApplication a(argc, argv);
|
||||
qInstallMessageHandler(messageOutput);
|
||||
|
||||
openlog(LOG_IDENT, LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_USER);
|
||||
qDebug()<<"Kylin Network Manager Is Already Launched";
|
||||
//syslog(LOG_DEBUG, "Kylin Network Manager Is Already Launched");
|
||||
|
||||
int loopNum = 0;
|
||||
while (!QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
if (loopNum == 15) return 1;
|
||||
qDebug()<<"I couldn't detect any system tray on this system now";
|
||||
//syslog(LOG_DEBUG, "I couldn't detect any system tray on this system now");
|
||||
loopNum += 1;
|
||||
sleep(1);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
//syslog(LOG_DEBUG, "Using the icon theme named 'ukui-icon-theme-default'");
|
||||
//QIcon::setThemeName("ukui-icon-theme-default");
|
||||
|
||||
PrimaryManager();
|
||||
|
@ -363,7 +362,7 @@ void MainWindow::createLeftAreaUI()
|
|||
paletteLan.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0)));
|
||||
ui->btnNetListImg->setPalette(paletteLan);
|
||||
//添加PushButton的svg图片
|
||||
ui->btnNetListImg->setIcon(QIcon(":/res/x/net-list-bg.svg"));
|
||||
ui->btnNetListImg->setIcon(QIcon::fromTheme("network-wired-symbolic"));
|
||||
ui->btnNetListImg->setProperty("useIconHighlightEffect", true);
|
||||
ui->btnNetListImg->setProperty("iconHighlightEffectMode", true);
|
||||
|
||||
|
@ -377,7 +376,7 @@ void MainWindow::createLeftAreaUI()
|
|||
paletteWifi.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0)));
|
||||
ui->btnWifiListImg->setPalette(paletteWifi);
|
||||
//添加PushButton的svg图片
|
||||
ui->btnWifiListImg->setIcon(QIcon(":/res/x/wifi-list-bg.svg"));
|
||||
ui->btnWifiListImg->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic"));
|
||||
ui->btnWifiListImg->setProperty("useIconHighlightEffect", true);
|
||||
ui->btnWifiListImg->setProperty("iconHighlightEffectMode", true);
|
||||
|
||||
|
@ -3095,6 +3094,9 @@ void MainWindow::actionTriggerSlots()
|
|||
//列表中item的扩展与收缩
|
||||
void MainWindow::oneLanFormSelected(QString lanName, QString uniqueName)
|
||||
{
|
||||
if (currSelNetName == uniqueName) {
|
||||
return;
|
||||
}
|
||||
QList<OneLancForm *> topLanList = topLanListWidget->findChildren<OneLancForm *>();
|
||||
QList<OneLancForm *> lanList = lanListWidget->findChildren<OneLancForm *>();
|
||||
|
||||
|
@ -3114,16 +3116,16 @@ void MainWindow::oneLanFormSelected(QString lanName, QString uniqueName)
|
|||
//是否与上一次选中同一个网络框
|
||||
if (currSelNetName == uniqueName) {
|
||||
// 缩小所有选项卡
|
||||
for (int i = 0;i < lanList.size(); i ++) {
|
||||
OneLancForm *ocf = lanList.at(i);
|
||||
if (ocf->uuidName == uniqueName) {
|
||||
ocf->setSelected(false, true);
|
||||
} else {
|
||||
ocf->setSelected(false, false);
|
||||
}
|
||||
}
|
||||
// for (int i = 0;i < lanList.size(); i ++) {
|
||||
// OneLancForm *ocf = lanList.at(i);
|
||||
// if (ocf->uuidName == uniqueName) {
|
||||
// ocf->setSelected(false, true);
|
||||
// } else {
|
||||
// ocf->setSelected(false, false);
|
||||
// }
|
||||
// }
|
||||
|
||||
currSelNetName = "";
|
||||
// currSelNetName = "";
|
||||
} else {
|
||||
int selectY = 0;
|
||||
for (int i = 0;i < lanList.size(); i ++) {
|
||||
|
@ -3177,6 +3179,8 @@ void MainWindow::oneLanFormSelected(QString lanName, QString uniqueName)
|
|||
}
|
||||
void MainWindow::oneTopLanFormSelected(QString lanName, QString uniqueName)
|
||||
{
|
||||
//应设计要求,选中同一选项卡不再缩小
|
||||
if (currSelNetName == uniqueName) return;
|
||||
QList<OneLancForm *> topLanList = topLanListWidget->findChildren<OneLancForm *>();
|
||||
QList<OneLancForm *> lanList = lanListWidget->findChildren<OneLancForm *>();
|
||||
|
||||
|
@ -3188,17 +3192,17 @@ void MainWindow::oneTopLanFormSelected(QString lanName, QString uniqueName)
|
|||
|
||||
if (currSelNetName == uniqueName) {
|
||||
// 与上一次选中同一个网络框,缩小当前选项卡
|
||||
topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM*currTopLanItem + H_GAP_UP + X_ITEM);
|
||||
lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM*currTopLanItem + H_GAP_UP);
|
||||
btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN + H_NORMAL_ITEM*(currTopLanItem-1));
|
||||
scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA + H_NORMAL_ITEM*(currTopLanItem-1));
|
||||
lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + H_NORMAL_ITEM*(currTopLanItem-1)/2);
|
||||
// topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM*currTopLanItem + H_GAP_UP + X_ITEM);
|
||||
// lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM*currTopLanItem + H_GAP_UP);
|
||||
// btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN + H_NORMAL_ITEM*(currTopLanItem-1));
|
||||
// scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA + H_NORMAL_ITEM*(currTopLanItem-1));
|
||||
// lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + H_NORMAL_ITEM*(currTopLanItem-1)/2);
|
||||
|
||||
foreach (OneLancForm *ocf, topLanList) {
|
||||
ocf->setTopItem(false);
|
||||
}
|
||||
// foreach (OneLancForm *ocf, topLanList) {
|
||||
// ocf->setTopItem(false);
|
||||
// }
|
||||
|
||||
currSelNetName = "";
|
||||
// currSelNetName = "";
|
||||
} else {
|
||||
// 没有与上一次选中同一个网络框,放大当前选项卡
|
||||
|
||||
|
@ -3249,6 +3253,11 @@ void MainWindow::oneTopLanFormSelected(QString lanName, QString uniqueName)
|
|||
|
||||
void MainWindow::oneWifiFormSelected(QString wifibssid, int extendLength)
|
||||
{
|
||||
if (currSelNetName == wifibssid) {
|
||||
//与win逻辑一致,点击同一选项不再缩小选项卡
|
||||
return;
|
||||
}
|
||||
|
||||
QList<OneConnForm *>topWifiList = topWifiListWidget->findChildren<OneConnForm *>();
|
||||
QList<OneConnForm *> wifiList = wifiListWidget->findChildren<OneConnForm *>();
|
||||
|
||||
|
@ -3267,25 +3276,25 @@ void MainWindow::oneWifiFormSelected(QString wifibssid, int extendLength)
|
|||
|
||||
//是否与上一次选中同一个网络框
|
||||
if (currSelNetName == wifibssid) {
|
||||
// 缩小所有选项卡
|
||||
for (int i = 0;i < wifiList.size(); i ++) {
|
||||
OneConnForm *ocf = wifiList.at(i);
|
||||
if (ocf->wifiBSsid == wifibssid) {
|
||||
if (ocf->wifiBSsid == hideWiFiConn) {
|
||||
ocf->setHideItem(true, true);
|
||||
} else {
|
||||
ocf->setSelected(false, true);
|
||||
}
|
||||
} else {
|
||||
if (ocf->wifiBSsid == hideWiFiConn) {
|
||||
ocf->setHideItem(true, true);
|
||||
} else {
|
||||
ocf->setSelected(false, false);
|
||||
}
|
||||
}
|
||||
// // 缩小所有选项卡
|
||||
// for (int i = 0;i < wifiList.size(); i ++) {
|
||||
// OneConnForm *ocf = wifiList.at(i);
|
||||
// if (ocf->wifiBSsid == wifibssid) {
|
||||
// if (ocf->wifiBSsid == hideWiFiConn) {
|
||||
// ocf->setHideItem(true, true);
|
||||
// } else {
|
||||
// ocf->setSelected(false, true);
|
||||
// }
|
||||
// } else {
|
||||
// if (ocf->wifiBSsid == hideWiFiConn) {
|
||||
// ocf->setHideItem(true, true);
|
||||
// } else {
|
||||
// ocf->setSelected(false, false);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
currSelNetName = "";
|
||||
// }
|
||||
// currSelNetName = "";
|
||||
} else {
|
||||
int selectY = 0;
|
||||
for (int i = 0;i < wifiList.size(); i ++) {
|
||||
|
@ -3345,21 +3354,23 @@ void MainWindow::oneWifiFormSelected(QString wifibssid, int extendLength)
|
|||
}
|
||||
void MainWindow::oneTopWifiFormSelected(QString wifibssid, int extendLength)
|
||||
{
|
||||
//应设计师要求,此处展开后点击不再收起
|
||||
if (currSelNetName == wifibssid) return;
|
||||
QList<OneConnForm *>topWifiList = topWifiListWidget->findChildren<OneConnForm *>();
|
||||
QList<OneConnForm *> wifiList = wifiListWidget->findChildren<OneConnForm *>();
|
||||
|
||||
if (currSelNetName == wifibssid) {
|
||||
// 与上一次选中同一个网络框,缩小当前选项卡
|
||||
topWifiListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM);
|
||||
lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP);
|
||||
btnAddNet->move(X_BTN_FUN, Y_BTN_FUN);
|
||||
scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA);
|
||||
lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2);
|
||||
// topWifiListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM);
|
||||
// lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP);
|
||||
// btnAddNet->move(X_BTN_FUN, Y_BTN_FUN);
|
||||
// scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA);
|
||||
// lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2);
|
||||
|
||||
OneConnForm *ocf = topWifiList.at(0);
|
||||
ocf->setTopItem(false);
|
||||
// OneConnForm *ocf = topWifiList.at(0);
|
||||
// ocf->setTopItem(false);
|
||||
|
||||
currSelNetName = "";
|
||||
// currSelNetName = "";
|
||||
} else {
|
||||
// 没有与上一次选中同一个网络框,放大当前选项卡
|
||||
|
||||
|
@ -4248,7 +4259,7 @@ int MainWindow::getScreenGeometry(QString methodName)
|
|||
void MainWindow::requestRefreshWifiList()
|
||||
{
|
||||
current_wifi_list_state = REFRESH_WIFI;
|
||||
syslog(LOG_DEBUG, "[%s++%d] state[%d]", __FUNCTION__, __LINE__, current_wifi_list_state);
|
||||
qDebug()<<"current_wifi_list_state="<<current_wifi_list_state;
|
||||
this->ksnm->execGetWifiList(this->wcardname, this->isHuaWeiPC);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
|
|
|
@ -209,11 +209,61 @@ OneConnForm::~OneConnForm()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void OneConnForm::mousePressEvent(QMouseEvent *)
|
||||
void OneConnForm::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton && this->wifiBSsid != "--") {
|
||||
QMenu * m_menu = new QMenu();//右键菜单
|
||||
if (this->isTopItem) {
|
||||
m_menu->addAction(new QAction(tr("Disconnect"), this));
|
||||
} else {
|
||||
m_menu->addAction(new QAction(tr("Connect"), this));
|
||||
}
|
||||
if (checkIsSaved())
|
||||
m_menu->addAction(new QAction(tr("Forget"), this));
|
||||
m_menu->move(cursor().pos());
|
||||
m_menu->show();
|
||||
connect(m_menu, &QMenu::triggered, this, &OneConnForm::onMenuTriggered);
|
||||
}
|
||||
emit selectedOneWifiForm(wifiBSsid, H_WIFI_ITEM_BIG_EXTEND);
|
||||
}
|
||||
|
||||
bool OneConnForm::checkIsSaved()
|
||||
{
|
||||
QString name = this->wifiName;
|
||||
QString currStr = "nmcli -f connection.type connection show \"" + name.replace("\"","\\\"") + "\"";
|
||||
int status = system(currStr.toUtf8().data());
|
||||
if (status != 0){
|
||||
qDebug()<<"There is no configuration for wifi "<<this->wifiName;
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief OneConnForm::onMenuTriggered 点击右键菜单选项的槽函数
|
||||
* @param action
|
||||
*/
|
||||
bool OneConnForm::onMenuTriggered(QAction *action)
|
||||
{
|
||||
if (action->text() == tr("Disconnect")) {
|
||||
this->on_btnDisConn_clicked();
|
||||
return true;
|
||||
} else if (action->text() == tr("Connect")) {
|
||||
this->on_btnConn_clicked();
|
||||
return true;
|
||||
} else if (action->text() == tr("Forget")) {
|
||||
QString name = this->wifiName;
|
||||
QString currStr = "nmcli connection delete \"" + name.replace("\"","\\\"") + "\"";
|
||||
int status = system(currStr.toUtf8().data());
|
||||
if (status != 0){
|
||||
qDebug()<<"Delete wifi failed. wifi="<<this->wifiName;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void OneConnForm::onBtnPropertyClicked()
|
||||
{
|
||||
//WORKAROUND::ukui-control-center启动会出现rfkill僵尸进程
|
||||
|
@ -564,7 +614,6 @@ void OneConnForm::on_btnDisConn_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
//syslog(LOG_DEBUG, "DisConnect button about wifi net is clicked, current wifi name is %s .", wifiName.toUtf8().data());
|
||||
qDebug()<<"DisConnect button about wifi net is clicked, current wifi name is "<<wifiName;
|
||||
if (mw->canReconnectWifiList.contains(wifiName)) {
|
||||
mw->canReconnectWifiList.removeOne(wifiName);
|
||||
|
@ -587,7 +636,6 @@ void OneConnForm::on_btnConnSub_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
//syslog(LOG_DEBUG, "A button named on_btnConnSub about wifi net is clicked.");
|
||||
qDebug()<<"A button named on_btnConnSub about wifi net is clicked.";
|
||||
toConnectWirelessNetwork();
|
||||
}
|
||||
|
@ -599,7 +647,6 @@ void OneConnForm::on_btnConn_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
//syslog(LOG_DEBUG, "A button named btnConn about wifi net is clicked.");
|
||||
qDebug()<<"A button named btnConn about wifi net is clicked.";
|
||||
toConnectWirelessNetwork();
|
||||
}
|
||||
|
@ -771,7 +818,6 @@ void OneConnForm::toConnectWirelessNetwork()
|
|||
//需要密码的wifi连接
|
||||
void OneConnForm::on_btnConnPWD_clicked()
|
||||
{
|
||||
//syslog(LOG_DEBUG, "A button named btnConnPWD about wifi net is clicked.");
|
||||
qDebug()<<"A button named btnConnPWD about wifi net is clicked.";
|
||||
|
||||
if (this->getPskFlag() != 0) {
|
||||
|
@ -1004,7 +1050,6 @@ void OneConnForm::slotConnWifiResult(int connFlag)
|
|||
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection delete '" + wifiName + "'";
|
||||
int status = system(cmd.toUtf8().data());
|
||||
if (status != 0) {
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection delete' in function 'slotConnWifiResult' failed");
|
||||
qDebug()<<"execute 'nmcli connection delete' in function 'slotConnWifiResult' failed.";
|
||||
}
|
||||
}
|
||||
|
@ -1070,7 +1115,6 @@ void OneConnForm::waitAnimStep()
|
|||
int status = system(cmd.toUtf8().data());
|
||||
if (status != 0) {
|
||||
qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'waitAnimStep' failed";
|
||||
//syslog(LOG_ERR, "execute 'kill -9 $(pidof nmcli)' in function 'waitAnimStep' failed");
|
||||
}
|
||||
|
||||
this->stopWifiWaiting(true); //动画超出时间限制,强制停止动画
|
||||
|
@ -1120,7 +1164,6 @@ void OneConnForm::on_btnCancel_clicked()
|
|||
// int status = system(cmd.toUtf8().data());
|
||||
// if (status != 0) {
|
||||
// qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'on_btnCancel_clicked' failed";
|
||||
// syslog(LOG_ERR, "execute 'kill -9 $(pidof nmcli)' in function 'on_btnCancel_clicked' failed");
|
||||
// }
|
||||
|
||||
KylinDBus myKylinDbus;
|
||||
|
|
|
@ -112,6 +112,7 @@ protected:
|
|||
|
||||
private:
|
||||
bool getWifiConfig(WifiConfig &wc, QString netName);
|
||||
bool checkIsSaved();
|
||||
|
||||
private slots:
|
||||
void on_btnConn_clicked();
|
||||
|
@ -137,6 +138,8 @@ private slots:
|
|||
|
||||
void on_checkBoxPwd_released();
|
||||
|
||||
bool onMenuTriggered(QAction *);
|
||||
|
||||
private:
|
||||
QTimer *waitTimer = nullptr;
|
||||
int waitPage;
|
||||
|
|
|
@ -309,7 +309,6 @@ void OneLancForm::slotConnLan()
|
|||
//点击网络断开按钮,执行该函数
|
||||
void OneLancForm::on_btnDisConn_clicked()
|
||||
{
|
||||
//syslog(LOG_DEBUG, "DisConnect button about lan net is clicked, current wired net name is %s .", ui->lbName->text().toUtf8().data());
|
||||
qDebug()<<"DisConnect button about lan net is clicked, current wired net name is "<<ui->lbName->text();
|
||||
|
||||
this->startWaiting(false);
|
||||
|
@ -370,7 +369,6 @@ void OneLancForm::toDisConnWiredNetwork(QString netUuid)
|
|||
//点击了连接网络按钮,执行该函数
|
||||
void OneLancForm::on_btnConn_clicked()
|
||||
{
|
||||
//syslog(LOG_DEBUG, "A button named btnConn about lan net is clicked.");
|
||||
qDebug()<<"A button named btnConn about lan net is clicked.";
|
||||
toConnectWiredNetwork();
|
||||
}
|
||||
|
@ -378,7 +376,6 @@ void OneLancForm::on_btnConn_clicked()
|
|||
//点击了item被扩展中的连接网络按钮,执行该函数
|
||||
void OneLancForm::on_btnConnSub_clicked()
|
||||
{
|
||||
//syslog(LOG_DEBUG, "A button named btnConnSub about lan net is clicked.");
|
||||
qDebug()<<"A button named btnConnSub about lan net is clicked.";
|
||||
toConnectWiredNetwork();
|
||||
}
|
||||
|
@ -473,7 +470,6 @@ void OneLancForm::waitAnimStep()
|
|||
int status = system(cmd.toUtf8().data());
|
||||
if (status != 0) {
|
||||
qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'waitAnimStep' failed";
|
||||
//syslog(LOG_ERR, "execute 'kill -9 $(pidof nmcli)' in function 'waitAnimStep' failed");
|
||||
}
|
||||
|
||||
this->stopWaiting(); //动画超出时间限制,强制停止动画
|
||||
|
@ -530,7 +526,6 @@ void OneLancForm::on_btnCancel_clicked()
|
|||
int status = system(cmd.toUtf8().data());
|
||||
if (status != 0) {
|
||||
qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'on_btnCancel_clicked' failed";
|
||||
//syslog(LOG_ERR, "execute 'kill -9 $(pidof nmcli)' in function 'on_btnCancel_clicked' failed");
|
||||
}
|
||||
|
||||
KylinDBus myKylinDbus;
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
*/
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
@ -42,7 +40,6 @@ int Utils::m_system(char *cmd)
|
|||
clock_t start,finish;
|
||||
if ((pid = vfork()) <0) {
|
||||
qDebug()<<"failed to create a subprocess by using vfork";
|
||||
//syslog(LOG_ERR, "failed to create a subprocess by using vfork");
|
||||
status = -1;
|
||||
} else if (pid==0) {
|
||||
const char *new_argv[4];
|
||||
|
@ -64,7 +61,6 @@ int Utils::m_system(char *cmd)
|
|||
start = clock();
|
||||
if (execve("/bin/sh",(char *const *) new_argv, NULL) <0) {
|
||||
qDebug()<<"failed to execve a shell command in function m_system";
|
||||
//syslog(LOG_ERR, "failed to execve %s! errno: %d\n",cmd, errno);
|
||||
exit(1);
|
||||
} else {
|
||||
exit(0);
|
||||
|
@ -74,8 +70,7 @@ int Utils::m_system(char *cmd)
|
|||
finish = clock();
|
||||
}
|
||||
double duration = (double)(finish-start)/CLOCKS_PER_SEC;
|
||||
QString str = "It takes "+QString::number(duration)+" seconds to execute command:"+cmd;
|
||||
//syslog(LOG_DEBUG,"%s",str.toStdString().c_str());
|
||||
qDebug()<<"It takes "<<QString::number(duration)<<" seconds to execute command:"<<cmd;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -114,14 +109,12 @@ int NetworkSpeed::getCurrentDownloadRates(char *netname, long *save_rate, long *
|
|||
char tmp_value[128];
|
||||
|
||||
if((NULL == netname)||(NULL == save_rate)||(NULL == tx_rate)) {
|
||||
qDebug()<<"parameter pass to function getCurrentDownloadRates() error";
|
||||
//syslog(LOG_ERR, "parameter pass to function getCurrentDownloadRates() error");
|
||||
qDebug()<<"parameter pass error";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( (net_dev_file=fopen("/proc/net/dev", "r")) == NULL ) { //打开文件/pro/net/dev/,从中读取流量数据
|
||||
qDebug()<<"error occurred when try to open file /proc/net/dev/";
|
||||
//syslog(LOG_ERR, "error occurred when try to open file /proc/net/dev/");
|
||||
return -1;
|
||||
}
|
||||
memset(buffer,0,sizeof(buffer));
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <KWindowEffects>
|
||||
|
||||
#include <QtConcurrent>
|
||||
|
@ -129,7 +128,6 @@ void WiFiConfigDialog::toConfigWifi()
|
|||
|
||||
QFile file(tmpPath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
//syslog(LOG_DEBUG, "Can't open the file /tmp/kylin-nm-btoutput in function toConfigWifi !");
|
||||
qDebug()<<"Can't open the file /tmp/kylin-nm-btoutput in function toConfigWifi !";
|
||||
}
|
||||
QString line = file.readLine();
|
||||
|
@ -142,10 +140,7 @@ void WiFiConfigDialog::toConfigWifi()
|
|||
} else {
|
||||
QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection delete '" + ui->leWifiId->text() + "'";
|
||||
int status = system(cmd.toUtf8().data());
|
||||
if (status != 0) {
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection delete' in function 'toConfigWifi' failed");
|
||||
qDebug()<<"execute 'nmcli connection delete' in function 'toConfigWifi' failed";
|
||||
}
|
||||
qDebug()<<"executed cmd="<<cmd<<". res="<<status;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "wireless-security/kylinheadfile.h"
|
||||
|
||||
#include <KWindowEffects>
|
||||
#include <sys/syslog.h>
|
||||
#include <QFile>
|
||||
#include <QStringListModel>
|
||||
#include <QCompleter>
|
||||
|
@ -327,7 +326,9 @@ void WpaWifiDialog::initCombox() {
|
|||
QStringList eapStringList;
|
||||
/*eapStringList<< "PEAP" << "FAST" << "MD5" << "PWD" << "SIM" << "TLS" << "TTLS";*/
|
||||
/*eapStringList<< "PEAP";*/
|
||||
eapStringList << "TLS" << "LEAP" << "PWD" << "FAST" << "TTLS" << "PEAP";
|
||||
// eapStringList << "TLS" << "PEAP" << "PWD" << "FAST" << "TTLS" << "LEAP";
|
||||
//暂时隐藏尚未完成的功能
|
||||
eapStringList << "TLS" << "PEAP";
|
||||
for (int i = 0; i < eapStringList.length(); i++) {
|
||||
eapCombox->addItem(eapStringList.at(i), QString(eapStringList.at(i)).toLower());
|
||||
}
|
||||
|
@ -659,14 +660,12 @@ void WpaWifiDialog::slot_on_connectBtn_clicked() {
|
|||
// qDebug() << create_cmd;
|
||||
int res = Utils::m_system(create_cmd.toUtf8().data());
|
||||
if (res == 0) {
|
||||
//syslog(LOG_DEBUG, "In function slot_on_connectBtn_clicked, created a wifi config named %s", nameEditor->text());
|
||||
qDebug() << "qDebug: created a wifi config successfully in function slot_on_connectBtn_clicked";
|
||||
if (askPwdBtn->isChecked() && eapCombox->currentIndex() == EapType::PEAP) setPwdFlag(2);
|
||||
else setPwdFlag(0);
|
||||
//创建成功,激活连接
|
||||
activateConnection();
|
||||
} else {
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection add' in function 'slot_on_connectBtn_clicked' failed");
|
||||
qDebug() << "qDebug: create wpa wifi config file failed in function slot_on_connectBtn_clicked";
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +710,6 @@ void WpaWifiDialog::activateConnection() {
|
|||
Utils::m_system(cmdStr_2.toUtf8().data());
|
||||
//this->mw->is_stop_check_net_state = 0;
|
||||
//this->mw->setTrayLoading(false);
|
||||
//syslog(LOG_DEBUG, "execute 'nmcli connection up' in function 'activateConnection' time out");
|
||||
qDebug() << "qDebug: activate time out in function activateConnection";
|
||||
qDebug() << "qDebug: 连接超时(30秒超时时间)";
|
||||
});
|
||||
|
@ -736,7 +734,6 @@ void WpaWifiDialog::activateConnection() {
|
|||
emit conn_done();
|
||||
//this->mw->is_stop_check_net_state = 0;
|
||||
//this->mw->setTrayLoading(false);
|
||||
//syslog(LOG_DEBUG, "execute 'nmcli connection up' in function 'activateConnection' accepted");
|
||||
qDebug() << "qDebug: activated wpa security wifi successfully";
|
||||
this->close();
|
||||
}
|
||||
|
|
|
@ -214,11 +214,11 @@ private:
|
|||
**/
|
||||
enum EapType {
|
||||
TLS = 0,
|
||||
LEAP,
|
||||
PEAP,
|
||||
PWD,
|
||||
FAST,
|
||||
TTLS,
|
||||
PEAP
|
||||
LEAP
|
||||
};
|
||||
|
||||
WifiConfig *m_wifiConfig = nullptr;
|
||||
|
|
Binary file not shown.
|
@ -1662,6 +1662,11 @@
|
|||
<source>Disconnect</source>
|
||||
<translation>断开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/oneconnform.cpp" line="222"/>
|
||||
<source>Forget</source>
|
||||
<translation>忘记此网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/oneconnform.cpp" line="131"/>
|
||||
<source>Property</source>
|
||||
|
|
|
@ -212,10 +212,7 @@ void DlgHideWifi::changeWindow(){
|
|||
QString currStr = "nmcli connection show '" + ui->cbxConn->currentText() + "' >" + tmpPath;
|
||||
|
||||
int status = system(currStr.toUtf8().data());
|
||||
if (status != 0){
|
||||
qDebug() << "execute 'nmcli connection show' in function 'changeWindow' failed";
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection show' in function 'changeWindow' failed");
|
||||
}
|
||||
qDebug()<<"executed cmd="<<currStr<<". res="<<status;
|
||||
|
||||
QFile file(tmpPath);
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
|
@ -344,10 +341,7 @@ void DlgHideWifi::on_execSecConn()
|
|||
{
|
||||
QString str = "nmcli device wifi connect '" + strWifiname + "' password ''";
|
||||
int status = system(str.toUtf8().data());
|
||||
if (status != 0){
|
||||
//syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_execSecConn' failed");
|
||||
qDebug() << "execute 'nmcli device wifi connect' in function 'on_execSecConn' failed";
|
||||
}
|
||||
qDebug()<<"executed cmd="<<str<<". res="<<status;
|
||||
QTimer::singleShot(3*1000, this, SLOT(emitSignal() ));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) :
|
||||
WepOrWpa(type),
|
||||
QDialog(parent),
|
||||
|
@ -101,7 +99,7 @@ DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) :
|
|||
|
||||
ui->cbxConn->addItem(tr("C_reate…")); //新建...
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiEapFast' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) :
|
||||
WepOrWpa(type),
|
||||
QDialog(parent),
|
||||
|
@ -84,7 +82,7 @@ DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) :
|
|||
|
||||
ui->cbxConn->addItem(tr("C_reate…")); //新建...
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiEapLeap' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/mainwindow.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QDir>
|
||||
|
||||
|
@ -80,7 +77,7 @@ DlgHideWifiEapPeap::DlgHideWifiEapPeap(int type, int beUsed, MainWindow *mainWin
|
|||
|
||||
ui->cbxConn->addItem("新建...");
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiEapPeap' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
@ -274,9 +271,7 @@ void DlgHideWifiEapPeap::changeWindow(){
|
|||
QString currStr = "nmcli connection show '" + ui->cbxConn->currentText() + "' > " + tmpPath;
|
||||
|
||||
int status = system(currStr.toUtf8().data());
|
||||
if(status != 0){
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection show' in function 'changeWindow' failed");
|
||||
}
|
||||
qDebug()<<"executed cmd="<<currStr<<". res="<<status;
|
||||
QFile file(tmpPath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) :
|
||||
WepOrWpa(type),
|
||||
QDialog(parent),
|
||||
|
@ -85,7 +83,7 @@ DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) :
|
|||
|
||||
ui->cbxConn->addItem(tr("C_reate…")); //新建...
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiEapPwd' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/mainwindow.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QDir>
|
||||
|
||||
|
@ -79,7 +76,7 @@ DlgHideWifiEapTls::DlgHideWifiEapTls(int type, int beUsed, MainWindow *mainWindo
|
|||
|
||||
ui->cbxConn->addItem(tr("C_reate…")); //新建...
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiEapTls' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
@ -263,7 +260,7 @@ void DlgHideWifiEapTls::changeWindow(){
|
|||
QString currStr = "nmcli connection show '" + ui->cbxConn->currentText() + "' >" + tmpPath;
|
||||
|
||||
int status = system(currStr.toUtf8().data());
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'changeWindow' failed");}
|
||||
qDebug()<<"executed cmd="<<currStr<<". res="<<status;
|
||||
|
||||
QFile file(tmpPath);
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) :
|
||||
WepOrWpa(type),
|
||||
QDialog(parent),
|
||||
|
@ -106,7 +104,7 @@ DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) :
|
|||
|
||||
ui->cbxConn->addItem(tr("C_reate…")); //新建...
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiEapTTLS' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DlgHideWifiLeap)
|
||||
|
@ -78,7 +76,7 @@ DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) :
|
|||
|
||||
ui->cbxConn->addItem(tr("C_reate…")); //新建...
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiLeap' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "kylinheadfile.h"
|
||||
#include "src/kylin-dbus-interface.h"
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) :
|
||||
WepPwdOrCode(type),
|
||||
QDialog(parent),
|
||||
|
@ -84,7 +82,7 @@ DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) :
|
|||
|
||||
ui->cbxConn->addItem(tr("C_reate…")); //新建...
|
||||
int status = system("nmcli connection show>/tmp/kylin-nm-connshow");
|
||||
//if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgHideWifiWep' failed");}
|
||||
qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<<status;
|
||||
QFile file("/tmp/kylin-nm-connshow");
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
|
|
@ -219,10 +219,7 @@ void DlgHideWifiWpa::changeWindow()
|
|||
QString currStr = "nmcli connection show '" + ui->cbxConn->currentText() + "' > " + tmpPath;
|
||||
|
||||
int status = system(currStr.toUtf8().data());
|
||||
if(status != 0){
|
||||
//syslog(LOG_ERR, "execute 'nmcli connection show' in function 'changeWindow' failed");
|
||||
qDebug() << "execute 'nmcli connection show' in function 'changeWindow' failed";
|
||||
}
|
||||
qDebug()<<"executed cmd="<<currStr<<". res="<<status;
|
||||
QFile file(tmpPath);
|
||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
qDebug()<<"Can't open the file!";
|
||||
|
@ -321,7 +318,6 @@ void DlgHideWifiWpa::on_btnConnect_clicked()
|
|||
}
|
||||
|
||||
//void DlgHideWifiWpa::finishedProcess(int state) {
|
||||
// if (! state) syslog(LOG_ERR, "Scan wifi list failed in functin on_btnConnect_clicked() in dlghidewifiwpa.cpp 359.");
|
||||
// wlist = shellOutput.split("\n");
|
||||
// bool is_hidden = true;
|
||||
// foreach (QString wifi, wlist) {
|
||||
|
@ -335,7 +331,6 @@ void DlgHideWifiWpa::on_btnConnect_clicked()
|
|||
// QTimer::singleShot(4*1000, this, SLOT(emitSignal() ));
|
||||
// } else {
|
||||
// //已保存的wifi没有在wifi列表找到(隐藏wifi保存后也会出现在wifi列表),则当前区域无法连接此wifi
|
||||
// syslog(LOG_DEBUG, "Choosen wifi can not be sacnned in finishedProcess() in dlghidewifiwpa.cpp 377.");
|
||||
// QString txt(tr("Selected Wifi has not been scanned."));
|
||||
// mw->objKyDBus->showDesktopNotify(txt);
|
||||
// emit this->stopSignal();
|
||||
|
@ -396,10 +391,7 @@ void DlgHideWifiWpa::on_execSecConn()
|
|||
{
|
||||
QString str = "nmcli device wifi connect '" + strWifiname + "' password '" + strWifiPassword + "'";
|
||||
int status = system(str.toUtf8().data());
|
||||
if (status != 0){
|
||||
//syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_execSecConn' failed");
|
||||
qDebug() << "execute 'nmcli device wifi connect' in function 'on_execSecConn' failed";
|
||||
}
|
||||
qDebug()<<"executed cmd="<<str<<". res="<<status;
|
||||
qDebug() << "debug: 准备等待7秒";
|
||||
QTimer::singleShot(7*1000, this, SLOT(emitSignal() ));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue