From b7c93803e1470a68756af412fc564b8806ed9521 Mon Sep 17 00:00:00 2001 From: zhangjiaping Date: Thu, 30 Sep 2021 11:09:56 +0800 Subject: [PATCH] Delete useless files. --- src/backend/backend.pri | 8 - src/backend/backthread.cpp | 673 --- src/backend/backthread.h | 105 - src/backend/dbusadaptor.h | 2 +- src/backend/ksimplenm.cpp | 142 - src/backend/ksimplenm.h | 64 - src/backend/kylin-dbus-interface.cpp | 2130 ------- src/backend/kylin-dbus-interface.h | 162 - src/backend/kylin-network-interface.c | 1015 ---- src/backend/kylin-network-interface.h | 270 - src/frontend/confform.cpp | 765 --- src/frontend/confform.h | 123 - src/frontend/confform.ui | 425 -- src/frontend/frontend.pri | 16 +- src/frontend/kylinwiredwidget.cpp | 45 +- src/frontend/kylinwiredwidget.h | 8 +- src/frontend/list-items/list-items.pri | 4 - src/frontend/list-items/oneconnform.cpp | 1218 ---- src/frontend/list-items/oneconnform.h | 187 - src/frontend/list-items/onelancform.cpp | 632 -- src/frontend/list-items/onelancform.h | 140 - src/frontend/mainwindow.cpp | 5130 ++--------------- src/frontend/mainwindow.h | 515 +- src/frontend/mainwindow.ui | 316 - src/frontend/new-mainwindow.cpp | 506 -- src/frontend/new-mainwindow.h | 123 - src/frontend/nmdemo.cpp | 1 - src/frontend/tab-pages/lanpage.h | 2 + .../wireless-security/dlghidewifi.cpp | 372 -- src/frontend/wireless-security/dlghidewifi.h | 83 - src/frontend/wireless-security/dlghidewifi.ui | 238 - .../wireless-security/dlghidewifieapfast.cpp | 359 -- .../wireless-security/dlghidewifieapfast.h | 76 - .../wireless-security/dlghidewifieapfast.ui | 505 -- .../wireless-security/dlghidewifieapleap.cpp | 299 - .../wireless-security/dlghidewifieapleap.h | 72 - .../wireless-security/dlghidewifieapleap.ui | 354 -- .../wireless-security/dlghidewifieappeap.cpp | 541 -- .../wireless-security/dlghidewifieappeap.h | 90 - .../wireless-security/dlghidewifieappeap.ui | 614 -- .../wireless-security/dlghidewifieappwd.cpp | 300 - .../wireless-security/dlghidewifieappwd.h | 72 - .../wireless-security/dlghidewifieappwd.ui | 354 -- .../wireless-security/dlghidewifieaptls.cpp | 652 --- .../wireless-security/dlghidewifieaptls.h | 93 - .../wireless-security/dlghidewifieaptls.ui | 617 -- .../wireless-security/dlghidewifieapttls.cpp | 466 -- .../wireless-security/dlghidewifieapttls.h | 84 - .../wireless-security/dlghidewifieapttls.ui | 579 -- .../wireless-security/dlghidewifileap.cpp | 246 - .../wireless-security/dlghidewifileap.h | 70 - .../wireless-security/dlghidewifileap.ui | 319 - .../wireless-security/dlghidewifiwep.cpp | 248 - .../wireless-security/dlghidewifiwep.h | 69 - .../wireless-security/dlghidewifiwep.ui | 360 -- .../wireless-security/dlghidewifiwpa.cpp | 450 -- .../wireless-security/dlghidewifiwpa.h | 96 - .../wireless-security/dlghidewifiwpa.ui | 284 - .../wireless-security/kylinheadfile.cpp | 49 - .../wireless-security/kylinheadfile.h | 50 - .../wireless-security/wireless-security.pri | 40 - src/frontend/wpawifidialog.cpp | 1154 ---- src/frontend/wpawifidialog.h | 285 - src/frontend/wpawifidialog.ui | 31 - src/main.cpp | 5 +- 65 files changed, 538 insertions(+), 24765 deletions(-) delete mode 100644 src/backend/backthread.cpp delete mode 100644 src/backend/backthread.h delete mode 100644 src/backend/ksimplenm.cpp delete mode 100644 src/backend/ksimplenm.h delete mode 100644 src/backend/kylin-dbus-interface.cpp delete mode 100644 src/backend/kylin-dbus-interface.h delete mode 100644 src/backend/kylin-network-interface.c delete mode 100644 src/backend/kylin-network-interface.h delete mode 100644 src/frontend/confform.cpp delete mode 100644 src/frontend/confform.h delete mode 100644 src/frontend/confform.ui delete mode 100644 src/frontend/list-items/oneconnform.cpp delete mode 100644 src/frontend/list-items/oneconnform.h delete mode 100644 src/frontend/list-items/onelancform.cpp delete mode 100644 src/frontend/list-items/onelancform.h delete mode 100644 src/frontend/mainwindow.ui delete mode 100644 src/frontend/new-mainwindow.cpp delete mode 100644 src/frontend/new-mainwindow.h delete mode 100644 src/frontend/wireless-security/dlghidewifi.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifi.h delete mode 100644 src/frontend/wireless-security/dlghidewifi.ui delete mode 100644 src/frontend/wireless-security/dlghidewifieapfast.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifieapfast.h delete mode 100644 src/frontend/wireless-security/dlghidewifieapfast.ui delete mode 100644 src/frontend/wireless-security/dlghidewifieapleap.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifieapleap.h delete mode 100644 src/frontend/wireless-security/dlghidewifieapleap.ui delete mode 100644 src/frontend/wireless-security/dlghidewifieappeap.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifieappeap.h delete mode 100644 src/frontend/wireless-security/dlghidewifieappeap.ui delete mode 100644 src/frontend/wireless-security/dlghidewifieappwd.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifieappwd.h delete mode 100644 src/frontend/wireless-security/dlghidewifieappwd.ui delete mode 100644 src/frontend/wireless-security/dlghidewifieaptls.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifieaptls.h delete mode 100644 src/frontend/wireless-security/dlghidewifieaptls.ui delete mode 100644 src/frontend/wireless-security/dlghidewifieapttls.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifieapttls.h delete mode 100644 src/frontend/wireless-security/dlghidewifieapttls.ui delete mode 100644 src/frontend/wireless-security/dlghidewifileap.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifileap.h delete mode 100644 src/frontend/wireless-security/dlghidewifileap.ui delete mode 100644 src/frontend/wireless-security/dlghidewifiwep.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifiwep.h delete mode 100644 src/frontend/wireless-security/dlghidewifiwep.ui delete mode 100644 src/frontend/wireless-security/dlghidewifiwpa.cpp delete mode 100644 src/frontend/wireless-security/dlghidewifiwpa.h delete mode 100644 src/frontend/wireless-security/dlghidewifiwpa.ui delete mode 100644 src/frontend/wireless-security/kylinheadfile.cpp delete mode 100644 src/frontend/wireless-security/kylinheadfile.h delete mode 100644 src/frontend/wireless-security/wireless-security.pri delete mode 100644 src/frontend/wpawifidialog.cpp delete mode 100644 src/frontend/wpawifidialog.h delete mode 100644 src/frontend/wpawifidialog.ui diff --git a/src/backend/backend.pri b/src/backend/backend.pri index 3be0c4ab..feb4853f 100644 --- a/src/backend/backend.pri +++ b/src/backend/backend.pri @@ -3,11 +3,7 @@ include(hotspot/hotspot.pri) include(dbus-interface/dbus-interface.pri) HEADERS += \ - $$PWD/backthread.h \ $$PWD/dbusadaptor.h \ - $$PWD/ksimplenm.h \ - $$PWD/kylin-dbus-interface.h \ - $$PWD/kylin-network-interface.h \ $$PWD/kylinarping.h \ $$PWD/kylinipv4arping.h \ $$PWD/kylinipv6arping.h \ @@ -16,11 +12,7 @@ HEADERS += \ $$PWD/wifi-auth-thread.h SOURCES += \ - $$PWD/backthread.cpp \ $$PWD/dbusadaptor.cpp \ - $$PWD/ksimplenm.cpp \ - $$PWD/kylin-dbus-interface.cpp \ - $$PWD/kylin-network-interface.c \ $$PWD/kylinipv4arping.cpp \ $$PWD/kylinipv6arping.cpp \ $$PWD/sysdbusregister.cpp \ diff --git a/src/backend/backthread.cpp b/src/backend/backthread.cpp deleted file mode 100644 index 9bc7f969..00000000 --- a/src/backend/backthread.cpp +++ /dev/null @@ -1,673 +0,0 @@ -/* - * Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see -#include -#include -#include - -#include -#include -#include - -BackThread::BackThread(QObject *parent) : QObject(parent) -{ - cmdProcessWifi = new QProcess(this); - connect(cmdProcessWifi , SIGNAL(readyReadStandardOutput()) , this , SLOT(onReadOutputWifi())); - connect(cmdProcessWifi , SIGNAL(readyReadStandardError()) , this , SLOT(onReadErrorWifi())); - - cmdProcessLan = new QProcess(this); - connect(cmdProcessLan , SIGNAL(readyReadStandardOutput()) , this , SLOT(onReadOutputLan())); - connect(cmdProcessLan , SIGNAL(readyReadStandardError()) , this , SLOT(onReadErrorLan())); -} - -BackThread::~BackThread() -{ - cmdProcessWifi->close(); - cmdProcessLan->close(); -} - -//get the connection state of wired and wireles network -IFace* BackThread::execGetIface() -{ - IFace *iface = new IFace(); - - QString tmpPath = "/tmp/kylin-nm-iface-" + QDir::home().dirName(); - QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli -f TYPE,DEVICE,STATE device > " + tmpPath; - Utils::m_system(cmd.toUtf8().data()); - - QFile file(tmpPath); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qDebug()<<"Can't open the file ~/.config/kylin-nm-iface!"; - } - QString txt = file.readAll(); - QStringList txtList = txt.split("\n"); - file.close(); - - iface->lstate = 2; - iface->wstate = 2; - - for (int i = 1; i < txtList.size(); i ++) { - QString line = txtList.at(i); - if (line != "") { - int index1 = line.indexOf(" "); - QString type = line.left(index1); - QString lastStr = line.mid(index1).trimmed(); - int index2 = lastStr.indexOf(" "); - QString iname = lastStr.left(index2); - QString istateStr = lastStr.mid(index2).trimmed(); - - //只要存在一个有线设备已连接,就不再扫描其他有线设备状态,避免有线被误断开 - if (type == "ethernet" && iface->lstate != 0) { - // if type is wired network - iface->lname = iname; - - if (istateStr == "unmanaged") { - iface->lstate = 2; //switch of wired device is off - } else if (istateStr == "unavailable") { - iface->lstate = 4; - } else if (istateStr == "disconnected") { - iface->lstate = 1; //wired network is disconnected - } else if (istateStr == "connected" || istateStr == "connecting (getting IP configuration)") { - iface->lstate = 0; //wired network is connected - } else { - //连接中,正在配置 - iface->lstate = 3; - } - } - if (type == "wifi" && iface->wname.isEmpty()) { //仅统计第一个无线网卡,后续无线网卡状态必然等于或差与第一个获取到的无线网卡 - // if type is wireless network - iface->wname = iname; - - if (istateStr == "unmanaged" || istateStr == "unavailable") { - iface->wstate = 2; //switch of wireless device is off - } else if (istateStr == "disconnected") { - iface->wstate = 1; //wireless network is disconnected - } else if (istateStr == "connected") { - iface->wstate = 0; //wireless network is connected - } else { - //连接中,正在配置 - iface->wstate = 3; - } - } - } - } - - return iface; -} - -void BackThread::saveSwitchButtonState(const QString &key, const QVariant &value) -{ - QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); - m_settings->setValue(key, value); - m_settings->sync(); - delete m_settings; - return; -} - -QVariant BackThread::getSwitchState(const QString &key) -{ - QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); - QVariant value = m_settings->value(key); - delete m_settings; - if (!value.isValid()) - return QVariant(); - return value; -} - -//turn on the switch of network -void BackThread::execEnNet() -{ - char *chr = "nmcli networking on"; - Utils::m_system(chr); - - while (1) { - if (execGetIface()->lstate != 2) { - sleep(3); - emit enNetDone(); - emit btFinish(); - break; - } - sleep(1); - } -} - -//turn off the switch of wireless network first, then turn off the switch of network -void BackThread::execDisNet() -{ - if (execGetIface()->wstate != 2) { - char *chr = "nmcli radio wifi off"; - Utils::m_system(chr); - - while (1) { - if (execGetIface()->wstate == 2) { - emit disWifiDone(); - emit btFinish(); - break; - } - sleep(1); - } - } - - char *chr1 = "nmcli networking off"; - Utils::m_system(chr1); - - while (1) { - if (execGetIface()->lstate == 2) { - emit disNetDone(); - emit btFinish(); - break; - } - sleep(1); - } -} - -//turn on the switch of wireless network -void BackThread::execEnWifi() -{ - char *chr1 = "nmcli radio wifi on"; - Utils::m_system(chr1); - emit btFinish(); - KylinDBus objBackThreadDBus; - - while (1) { - if (execGetIface()->wstate != 2) { - while (1) { - if (objBackThreadDBus.getAccessPointsNumber() > 0) { - // objBackThreadDBus.getAccessPointsNumber()>0 standard can get wireless accesspoints now - emit enWifiDone(); - emit btFinish(); - break; - } - sleep(2); - } - break; - } - sleep(1); - } -} - -void BackThread::rfKillexecEnWifi() -{ - char *chr1 = "nmcli radio wifi on"; - Utils::m_system(chr1); - - if (execGetIface()->wstate != 2) { - emit enWifiDoneByRfkill(); - emit btFinishByRfkill(); - } else { - usleep(500*1000); - emit enWifiDoneByRfkill(); - emit btFinishByRfkill(); - } - -} - -//turn off the switch of wireless network -void BackThread::execDisWifi() -{ - char *chr = "nmcli radio wifi off"; - Utils::m_system(chr); - while (1) { - if (execGetIface()->wstate == 2) { - emit disWifiDone(); - emit btFinish(); - break; - } - sleep(1); - } -} - -void BackThread::rfkillExecDisWifi() -{ - char *chr = "nmcli radio wifi off"; - Utils::m_system(chr); - while (1) { - if (execGetIface()->wstate == 2) { - emit disWifiDoneByRfkill(); - emit btFinishByRfkill(); - break; - } - sleep(1); - } -} - -//to connect wired network -void BackThread::execConnLan(QString connName, QString ifname, QString connectType) -{ - currConnLanUuid = connName; - currConnLanType = connectType; - QString mycmd; //连接命令 - KylinDBus objBackThreadDBus; - - bool isWiredCableAlready = objBackThreadDBus.getWiredCableStateByIfname(ifname); - - if (connectType == "bluetooth" || connectType == "vpn"|| ifname == "") { - isWiredCableAlready = true; //对于蓝牙类型的网络不需要接入网线就可以连接 - mycmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "'"; - } else { - mycmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' ifname '" + ifname + "'"; - } - qDebug()<<"Trying to connect wifi. ssid="<start("/bin/bash",options); - cmdProcessLan->waitForStarted(); - cmdProcessLan->waitForFinished(); - } else { - qDebug()<<"connect wired network failed for without wired cable plug in."; - emit connDone(1); - } - - emit btFinish(); -} - -void BackThread::onReadOutputLan() -{ - QByteArray cmdout = cmdProcessLan->readAllStandardOutput(); - QString strResult = QString::fromLocal8Bit(cmdout); - qDebug()<<"on_readoutput_lan: "<< strResult; - dellConnectLanResult(strResult); -} -void BackThread::onReadErrorLan() -{ - QByteArray cmdout = cmdProcessLan->readAllStandardError(); - QString strResult = QString::fromLocal8Bit(cmdout); - qDebug()<<"on_readerror_lan: "<< strResult; - dellConnectLanResult(strResult); -} - -void BackThread::dellConnectLanResult(QString info) -{ - if (info.indexOf("successfully") != -1) { - qDebug()<<"debug: in function execConnLan, wired net state is: "<lstate); - - if (currConnLanType == "bluetooth") { - emit connDone(2); - } else { - emit connDone(0); - } - } else { - QString cmd = "nmcli connection down '" + currConnLanUuid + "'"; - Utils::m_system(cmd.toUtf8().data()); - if (info.indexOf("IP configuration could not be reserved") != -1) { - emit connDone(4); - } else if(info.indexOf("MACs") != -1 || info.indexOf("Mac") != -1 || info.indexOf("MAC") != -1) { - emit connDone(5); - } else if(info.indexOf("Killed") != -1 || info.indexOf("killed") != -1) { - emit connDone(6); - } else if(info.indexOf("The Bluetooth connection failed") != -1) { - emit connDone(7); - } else if(info.indexOf("Carrier/link changed") != -1) { - emit connDone(8); - } else { - if (currConnLanType == "vpn"){ - emit connDone(10); - } - else{ - emit connDone(9); - } - } - } -} - -//to connected wireless network need a password -void BackThread::execConnWifiPWD(QString connName, QString password, QString connType, QString security, QString ifname) -{ - //disConnLanOrWifi("wifi"); - if (!connType.isEmpty()) { - QString strConntype = "nmcli connection modify '" + connName + "' wifi-sec.psk-flags 0"; - Utils::m_system(strConntype.toUtf8().data()); - } - - QString tmpPath = "/tmp/kylin-nm-btoutput-" + QDir::home().dirName(); - if (security.contains("WPA3")) { - QString create_cmd = QString("nmcli connection add con-name %1 type wifi 802-11-wireless-security.key-mgmt sae ssid %2 802-11-wireless-security.psk %3").arg(connName).arg(connName).arg(password); - Utils::m_system(create_cmd.toUtf8().data()); - QString connect_cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' ifname " + ifname +" > " + tmpPath; - Utils::m_system(connect_cmdStr.toUtf8().data()); - } else { - QString cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli device wifi connect '" + connName + "' password '" + password + "' > " + tmpPath; - Utils::m_system(cmdStr.toUtf8().data()); - } - - QFile file(tmpPath); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qDebug()<<"Can't open the file /tmp/kylin-nm-btoutput !"<wstate); - } else if(line.indexOf("Secrets were required") != -1){ - //emit connDone(4);//发出信号4是之前添加每次连接输入密码的功能时需要的 - emit connDone(1); - } else { - emit connDone(1); - } - - emit btFinish(); -} - -void BackThread::execConnHiddenWifiWPA(QString wifiName, QString wifiPassword) -{ - int x(1), n(0); - do { - n += 1; - if (n >= 4) { - qDebug()<<"connection attempt of hidden wifi"<