Adjust documents' struct.
This commit is contained in:
parent
1d83f9e335
commit
f25569f10e
195
kylin-nm.pro
195
kylin-nm.pro
|
@ -1,190 +1,11 @@
|
||||||
#-------------------------------------------------
|
TEMPLATE = subdirs
|
||||||
#
|
|
||||||
# Project created by QtCreator 2018-10-19T15:29:47
|
|
||||||
#
|
|
||||||
#-------------------------------------------------
|
|
||||||
|
|
||||||
QT += core gui x11extras dbus KWindowSystem svg concurrent network
|
CONFIG += ordered
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
SUBDIRS = \
|
||||||
|
src \
|
||||||
|
|
||||||
TARGET = kylin-nm
|
TRANSLATIONS += \
|
||||||
TEMPLATE = app
|
translations/kylin-nm_zh_CN.ts \
|
||||||
LANGUAGE = C++
|
translations/kylin-nm_tr.ts \
|
||||||
|
translations/kylin-nm_bo.ts
|
||||||
CONFIG += c++14
|
|
||||||
CONFIG += qt warn_on
|
|
||||||
#CONFIG += release
|
|
||||||
CONFIG += link_pkgconfig
|
|
||||||
|
|
||||||
PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libnm
|
|
||||||
|
|
||||||
INCLUDEPATH += /usr/include/KF5/NetworkManagerQt
|
|
||||||
|
|
||||||
LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lKF5NetworkManagerQt
|
|
||||||
#LIBS += -lkysec
|
|
||||||
target.path = /usr/bin
|
|
||||||
target.source += $$TARGET
|
|
||||||
desktop.path = /etc/xdg/autostart/
|
|
||||||
desktop.files = kylin-nm.desktop
|
|
||||||
|
|
||||||
inst1.files += src/conf/com.kylin.NetworkManager.qt.systemdbus.service
|
|
||||||
inst1.path = /usr/share/dbus-1/system-services/
|
|
||||||
inst2.files += src/conf/com.kylin.NetworkManager.qt.systemdbus.conf
|
|
||||||
inst2.path = /etc/dbus-1/system.d/
|
|
||||||
|
|
||||||
INSTALLS += target \
|
|
||||||
desktop \
|
|
||||||
inst1 \
|
|
||||||
inst2 \
|
|
||||||
|
|
||||||
TRANSLATIONS += ./translations/kylin-nm_zh_CN.ts \
|
|
||||||
./translations/kylin-nm_tr.ts \
|
|
||||||
./translations/kylin-nm_bo.ts
|
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
|
||||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
|
||||||
# depend on your compiler). Please consult the documentation of the
|
|
||||||
# deprecated API in order to know how to port your code away from it.
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
|
||||||
# In order to do so, uncomment the following line.
|
|
||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
|
|
||||||
# QMAKE_CXXFLAGS += -Wno-unused-parameter
|
|
||||||
QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS)
|
|
||||||
QMAKE_CFLAGS *= $(shell dpkg-buildflags --get CFLAGS)
|
|
||||||
QMAKE_CXXFLAGS *= $(shell dpkg-buildflags --get CXXFLAGS)
|
|
||||||
QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS)
|
|
||||||
|
|
||||||
include(src/singleapplication/qt-single-application.pri)
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
src/backend/dbus-interface/kylinconnectitem.cpp \
|
|
||||||
src/backend/dbus-interface/kylinconnectoperation.cpp \
|
|
||||||
src/backend/dbus-interface/kylinconnectresource.cpp \
|
|
||||||
src/backend/dbus-interface/kylinconnectsetting.cpp \
|
|
||||||
src/backend/dbus-interface/kylinnetworkdeviceresource.cpp \
|
|
||||||
src/backend/dbus-interface/kylinnetworkresourcemanager.cpp \
|
|
||||||
src/backend/dbus-interface/kylinvpnconnectitem.cpp \
|
|
||||||
src/backend/dbus-interface/kylinwiredconnectoperation.cpp \
|
|
||||||
src/backend/dbus-interface/kywirelessconnectoperation.cpp \
|
|
||||||
src/backend/dbus-interface/kywirelessnetitem.cpp \
|
|
||||||
src/backend/dbus-interface/kywirelessnetresource.cpp \
|
|
||||||
src/backend/dbus-interface/kyenterpricesettinginfo.cpp \
|
|
||||||
src/backend/dbus-interface/kylinactiveconnectresource.cpp \
|
|
||||||
src/backend/dbus-interface/kylinbluetoothconnectitem.cpp \
|
|
||||||
src/backthread.cpp \
|
|
||||||
src/nmdemo.cpp \
|
|
||||||
src/kylinwiredwidget.cpp \
|
|
||||||
src/wifi-auth-thread.cpp \
|
|
||||||
src/confform.cpp \
|
|
||||||
src/dbusadaptor.cpp \
|
|
||||||
src/ksimplenm.cpp \
|
|
||||||
src/kylin-dbus-interface.cpp \
|
|
||||||
src/kylin-network-interface.c \
|
|
||||||
src/loadingdiv.cpp \
|
|
||||||
src/main.cpp \
|
|
||||||
src/mainwindow.cpp \
|
|
||||||
src/oneconnform.cpp \
|
|
||||||
src/onelancform.cpp \
|
|
||||||
src/switchbutton.cpp \
|
|
||||||
src/sysdbusregister.cpp \
|
|
||||||
src/utils.cpp \
|
|
||||||
src/wpawifidialog.cpp \
|
|
||||||
src/wificonfigdialog.cpp \
|
|
||||||
wireless-security/dlghidewifi.cpp \
|
|
||||||
wireless-security/dlghidewifieapfast.cpp \
|
|
||||||
wireless-security/dlghidewifieapleap.cpp \
|
|
||||||
wireless-security/dlghidewifieappeap.cpp \
|
|
||||||
wireless-security/dlghidewifieappwd.cpp \
|
|
||||||
wireless-security/dlghidewifieaptls.cpp \
|
|
||||||
wireless-security/dlghidewifieapttls.cpp \
|
|
||||||
wireless-security/dlghidewifileap.cpp \
|
|
||||||
wireless-security/dlghidewifiwep.cpp \
|
|
||||||
wireless-security/dlghidewifiwpa.cpp \
|
|
||||||
wireless-security/kylinheadfile.cpp \
|
|
||||||
hot-spot/dlghotspotcreate.cpp
|
|
||||||
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
src/backend/dbus-interface/kyenterpricesettinginfo.h \
|
|
||||||
src/backend/dbus-interface/kylinactiveconnectresource.h \
|
|
||||||
src/backend/dbus-interface/kylinbluetoothconnectitem.h \
|
|
||||||
src/backend/dbus-interface/kylinconnectitem.h \
|
|
||||||
src/backend/dbus-interface/kylinconnectoperation.h \
|
|
||||||
src/backend/dbus-interface/kylinconnectresource.h \
|
|
||||||
src/backend/dbus-interface/kylinconnectsetting.h \
|
|
||||||
src/backend/dbus-interface/kylinnetworkdeviceresource.h \
|
|
||||||
src/backend/dbus-interface/kylinnetworkresourcemanager.h \
|
|
||||||
src/backend/dbus-interface/kylinvpnconnectitem.h \
|
|
||||||
src/backend/dbus-interface/kylinwiredconnectoperation.h \
|
|
||||||
src/backend/dbus-interface/kywirelessconnectoperation.h \
|
|
||||||
src/backend/dbus-interface/kywirelessnetitem.h \
|
|
||||||
src/backend/dbus-interface/kywirelessnetresource.h \
|
|
||||||
src/backthread.h \
|
|
||||||
src/nmdemo.h \
|
|
||||||
src/kylinwiredwidget.h \
|
|
||||||
src/wifi-auth-thread.h \
|
|
||||||
src/confform.h \
|
|
||||||
src/dbusadaptor.h \
|
|
||||||
src/ksimplenm.h \
|
|
||||||
src/kylin-dbus-interface.h \
|
|
||||||
src/kylin-network-interface.h \
|
|
||||||
src/loadingdiv.h \
|
|
||||||
src/mainwindow.h \
|
|
||||||
src/oneconnform.h \
|
|
||||||
src/onelancform.h \
|
|
||||||
src/switchbutton.h \
|
|
||||||
src/sysdbusregister.h \
|
|
||||||
src/utils.h \
|
|
||||||
src/wpawifidialog.h \
|
|
||||||
src/wificonfigdialog.h \
|
|
||||||
wireless-security/dlghidewifi.h \
|
|
||||||
wireless-security/dlghidewifieapfast.h \
|
|
||||||
wireless-security/dlghidewifieapleap.h \
|
|
||||||
wireless-security/dlghidewifieappeap.h \
|
|
||||||
wireless-security/dlghidewifieappwd.h \
|
|
||||||
wireless-security/dlghidewifieaptls.h \
|
|
||||||
wireless-security/dlghidewifieapttls.h \
|
|
||||||
wireless-security/dlghidewifileap.h \
|
|
||||||
wireless-security/dlghidewifiwep.h \
|
|
||||||
wireless-security/dlghidewifiwpa.h \
|
|
||||||
wireless-security/kylinheadfile.h \
|
|
||||||
hot-spot/dlghotspotcreate.h
|
|
||||||
|
|
||||||
FORMS += \
|
|
||||||
src/confform.ui \
|
|
||||||
src/mainwindow.ui \
|
|
||||||
src/oneconnform.ui \
|
|
||||||
src/onelancform.ui \
|
|
||||||
hot-spot/dlghotspotcreate.ui \
|
|
||||||
src/wpawifidialog.ui \
|
|
||||||
src/wificonfigdialog.ui \
|
|
||||||
wireless-security/dlghidewifi.ui \
|
|
||||||
wireless-security/dlghidewifieapfast.ui \
|
|
||||||
wireless-security/dlghidewifieapleap.ui \
|
|
||||||
wireless-security/dlghidewifieappeap.ui \
|
|
||||||
wireless-security/dlghidewifieappwd.ui \
|
|
||||||
wireless-security/dlghidewifieaptls.ui \
|
|
||||||
wireless-security/dlghidewifieapttls.ui \
|
|
||||||
wireless-security/dlghidewifileap.ui \
|
|
||||||
wireless-security/dlghidewifiwep.ui \
|
|
||||||
wireless-security/dlghidewifiwpa.ui
|
|
||||||
|
|
||||||
RESOURCES += \
|
|
||||||
nmqrc.qrc
|
|
||||||
|
|
||||||
unix {
|
|
||||||
UI_DIR = .ui
|
|
||||||
MOC_DIR = .moc
|
|
||||||
OBJECTS_DIR = .obj
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DISTFILES += \
|
|
||||||
src/conf/com.kylin.NetworkManager.qt.systemdbus.conf \
|
|
||||||
src/conf/com.kylin.NetworkManager.qt.systemdbus.service
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
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/sysdbusregister.h \
|
||||||
|
$$PWD/utils.h \
|
||||||
|
$$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/sysdbusregister.cpp \
|
||||||
|
$$PWD/utils.cpp \
|
||||||
|
$$PWD/wifi-auth-thread.cpp
|
|
@ -0,0 +1,38 @@
|
||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/kyenterpricesettinginfo.h \
|
||||||
|
$$PWD/kylinactiveconnectresource.h \
|
||||||
|
$$PWD/kylinbluetoothconnectitem.h \
|
||||||
|
$$PWD/kylinconnectitem.h \
|
||||||
|
$$PWD/kylinconnectoperation.h \
|
||||||
|
$$PWD/kylinconnectresource.h \
|
||||||
|
$$PWD/kylinconnectsetting.h \
|
||||||
|
$$PWD/kylinnetworkconnect.h \
|
||||||
|
$$PWD/kylinnetworkdeviceresource.h \
|
||||||
|
$$PWD/kylinnetworkresourcemanager.h \
|
||||||
|
$$PWD/kylinvpnconnectitem.h \
|
||||||
|
$$PWD/kylinwiredconnectitem.h \
|
||||||
|
$$PWD/kylinwiredconnectoperation.h \
|
||||||
|
$$PWD/kywirelessconnectoperation.h \
|
||||||
|
$$PWD/kywirelessnetitem.h \
|
||||||
|
$$PWD/kywirelessnetresource.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/kyenterpricesettinginfo.cpp \
|
||||||
|
$$PWD/kylinactiveconnectresource.cpp \
|
||||||
|
$$PWD/kylinbluetoothconnectitem.cpp \
|
||||||
|
$$PWD/kylinconnectitem.cpp \
|
||||||
|
$$PWD/kylinconnectoperation.cpp \
|
||||||
|
$$PWD/kylinconnectresource.cpp \
|
||||||
|
$$PWD/kylinconnectsetting.cpp \
|
||||||
|
$$PWD/kylinnetworkconnect.cpp \
|
||||||
|
$$PWD/kylinnetworkdeviceresource.cpp \
|
||||||
|
$$PWD/kylinnetworkresourcemanager.cpp \
|
||||||
|
$$PWD/kylinvpnconnectitem.cpp \
|
||||||
|
$$PWD/kylinwiredconnectitem.cpp \
|
||||||
|
$$PWD/kylinwiredconnectoperation.cpp \
|
||||||
|
$$PWD/kywirelessconnectoperation.cpp \
|
||||||
|
$$PWD/kywirelessnetitem.cpp \
|
||||||
|
$$PWD/kywirelessnetresource.cpp
|
||||||
|
|
|
@ -0,0 +1,612 @@
|
||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "kylinnetworkconnect.h"
|
||||||
|
#include "sys/syslog.h"
|
||||||
|
|
||||||
|
|
||||||
|
NetworkManager::ConnectionSettings::Ptr assembleWpaXPskSettings(const NetworkManager::AccessPoint::Ptr accessPoint, const QString &psk)
|
||||||
|
{
|
||||||
|
NetworkManager::ConnectionSettings::Ptr settings{new NetworkManager::ConnectionSettings{NetworkManager::ConnectionSettings::Wireless}};
|
||||||
|
settings->setId(accessPoint->ssid());
|
||||||
|
settings->setUuid(NetworkManager::ConnectionSettings::createNewUuid());
|
||||||
|
settings->setAutoconnect(true);
|
||||||
|
//Note: workaround for wrongly (randomly) initialized gateway-ping-timeout
|
||||||
|
settings->setGatewayPingTimeout(0);
|
||||||
|
|
||||||
|
NetworkManager::WirelessSetting::Ptr wifi_sett
|
||||||
|
= settings->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
|
||||||
|
wifi_sett->setInitialized(true);
|
||||||
|
wifi_sett->setSsid(accessPoint->ssid().toUtf8());
|
||||||
|
wifi_sett->setSecurity("802-11-wireless-security");
|
||||||
|
|
||||||
|
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
||||||
|
= settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||||
|
security_sett->setInitialized(true);
|
||||||
|
if (NetworkManager::AccessPoint::Adhoc == accessPoint->mode())
|
||||||
|
{
|
||||||
|
wifi_sett->setMode(NetworkManager::WirelessSetting::Adhoc);
|
||||||
|
security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaNone);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaPsk);
|
||||||
|
}
|
||||||
|
security_sett->setPsk(psk);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include <NetworkManagerQt/AdslDevice>
|
||||||
|
#include <NetworkManagerQt/WiredDevice>
|
||||||
|
#include <NetworkManagerQt/Ipv4Setting>
|
||||||
|
#include <NetworkManagerQt/Ipv6Setting>
|
||||||
|
#include <NetworkManagerQt/WiredSetting>
|
||||||
|
|
||||||
|
KyNetworkConnect::KyNetworkConnect()
|
||||||
|
{
|
||||||
|
qDebug()<<"construct network connect";
|
||||||
|
m_networkResourceInstance = KyNetworkResourceManager::getInstance();
|
||||||
|
|
||||||
|
connect(this, &KyNetworkConnect::checkActiveonnection, this, &KyNetworkConnect::onCheckActiveonnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
KyNetworkConnect::~KyNetworkConnect()
|
||||||
|
{
|
||||||
|
m_networkResourceInstance = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::ipv4SettingInit(
|
||||||
|
NetworkManager::Ipv4Setting::Ptr &ipv4Setting,
|
||||||
|
const KyConnectSetting &connectInfo)
|
||||||
|
{
|
||||||
|
ipv4Setting->setInitialized(true);
|
||||||
|
|
||||||
|
if (CONFIG_IP_DHCP == connectInfo.m_ipv4ConfigIpType) {
|
||||||
|
ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Automatic);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Manual);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!connectInfo.m_ipv4Dns.empty()) {
|
||||||
|
ipv4Setting->setDns(connectInfo.m_ipv4Dns);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!connectInfo.m_ipv4Address.empty()) {
|
||||||
|
ipv4Setting->setAddresses(connectInfo.m_ipv4Address);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void KyNetworkConnect::ipv6SettingInit(
|
||||||
|
NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
|
||||||
|
const KyConnectSetting &connectInfo)
|
||||||
|
{
|
||||||
|
ipv6Setting->setInitialized(true);
|
||||||
|
|
||||||
|
if (CONFIG_IP_DHCP == connectInfo.m_ipv6ConfigIpType) {
|
||||||
|
ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Automatic);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Manual);
|
||||||
|
if (!connectInfo.m_ipv6Dns.empty()) {
|
||||||
|
ipv6Setting->setDns(connectInfo.m_ipv6Dns);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!connectInfo.m_ipv6Address.empty()) {
|
||||||
|
ipv6Setting->setAddresses(connectInfo.m_ipv6Address);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::connectSettingInit(
|
||||||
|
NetworkManager::ConnectionSettings::Ptr connectionSettings,
|
||||||
|
const KyConnectSetting &connectInfo)
|
||||||
|
{
|
||||||
|
connectionSettings->setId(connectInfo.m_connectName);
|
||||||
|
connectionSettings->setUuid(NetworkManager::ConnectionSettings::createNewUuid());
|
||||||
|
connectionSettings->setAutoconnect(true);
|
||||||
|
connectionSettings->setAutoconnectPriority(0);
|
||||||
|
connectionSettings->setInterfaceName(connectInfo.m_ifaceName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::createWiredConnect(const KyConnectSetting &connectInfo)
|
||||||
|
{
|
||||||
|
NetworkManager::ConnectionSettings::Ptr connectionSettings = NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wired));
|
||||||
|
connectSettingInit(connectionSettings, connectInfo);
|
||||||
|
|
||||||
|
NetworkManager::Ipv4Setting::Ptr ipv4Setting = connectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast<NetworkManager::Ipv4Setting>();
|
||||||
|
ipv4SettingInit(ipv4Setting, connectInfo);
|
||||||
|
|
||||||
|
NetworkManager::Ipv6Setting::Ptr ipv6Setting = connectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast<NetworkManager::Ipv6Setting>();
|
||||||
|
ipv6SettingInit(ipv6Setting, connectInfo);
|
||||||
|
|
||||||
|
NetworkManager::WiredSetting::Ptr wiredSetting = connectionSettings->setting(NetworkManager::Setting::Wired).dynamicCast<NetworkManager::WiredSetting>();
|
||||||
|
wiredSetting->setInitialized(true);
|
||||||
|
|
||||||
|
qDebug()<<"add wired connect"<<connectInfo.m_connectName;
|
||||||
|
|
||||||
|
QDBusPendingCallWatcher * watcher;
|
||||||
|
watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(connectionSettings->toMap()), this};
|
||||||
|
connect(watcher, &QDBusPendingCallWatcher::finished, [](QDBusPendingCallWatcher * watcher) {
|
||||||
|
if (watcher->isError() || !watcher->isValid()) {
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qWarning() << "create connection failed: " << watcher->error().message();
|
||||||
|
} else {
|
||||||
|
qWarning()<<"success"<<watcher->reply().errorName() <<"error msg"<<watcher->reply().errorMessage();
|
||||||
|
qWarning()<<"error type"<<watcher->error().type();
|
||||||
|
}
|
||||||
|
watcher->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::createConnect(KyConnectType connectType, const KyConnectSetting &connectInfo)
|
||||||
|
{
|
||||||
|
switch (connectType) {
|
||||||
|
case WIRED_CONNECT:
|
||||||
|
qDebug()<<"create wired connect";
|
||||||
|
createWiredConnect(connectInfo);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qWarning()<<"the connect type undefined"<<connectType;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::updateConnect(const QString &connectUuid, const KyConnectSetting &connectInfo)
|
||||||
|
{
|
||||||
|
qDebug()<<"update connect"<<connectUuid;
|
||||||
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
|
NetworkManager::findConnectionByUuid(connectUuid);
|
||||||
|
|
||||||
|
NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings();
|
||||||
|
connectSettingInit(connectionSettings, connectInfo);
|
||||||
|
|
||||||
|
NetworkManager::Ipv4Setting::Ptr ipv4Setting = connectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast<NetworkManager::Ipv4Setting>();
|
||||||
|
ipv4SettingInit(ipv4Setting, connectInfo);
|
||||||
|
|
||||||
|
NetworkManager::Ipv6Setting::Ptr ipv6Setting = connectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast<NetworkManager::Ipv6Setting>();
|
||||||
|
ipv6SettingInit(ipv6Setting, connectInfo);
|
||||||
|
|
||||||
|
NetworkManager::WiredSetting::Ptr wiredSetting = connectionSettings->setting(NetworkManager::Setting::Wired).dynamicCast<NetworkManager::WiredSetting>();
|
||||||
|
wiredSetting->setInitialized(true);
|
||||||
|
|
||||||
|
connectPtr->update(connectionSettings->toMap());
|
||||||
|
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::deleteConnect(const QString &connectUuid)
|
||||||
|
{
|
||||||
|
|
||||||
|
qWarning()<<"TODO:delete connect ";
|
||||||
|
|
||||||
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
|
NetworkManager::findConnectionByUuid(connectUuid);
|
||||||
|
|
||||||
|
connectPtr->remove();
|
||||||
|
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int KyNetworkConnect::activateConnection(const QString connectUuid)
|
||||||
|
{
|
||||||
|
QString conn_uni;
|
||||||
|
QString dev_uni;
|
||||||
|
QString conn_name;
|
||||||
|
QString dev_name;
|
||||||
|
QString spec_object;
|
||||||
|
|
||||||
|
qDebug()<<"it will activate connect"<<connectUuid;
|
||||||
|
NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->getConnect(connectUuid);
|
||||||
|
conn_uni = connectPtr->path();
|
||||||
|
conn_name = connectPtr->name();
|
||||||
|
if (NetworkManager::ConnectionSettings::Vpn == connectPtr->settings()->connectionType()) {
|
||||||
|
spec_object = dev_uni = QStringLiteral("/");
|
||||||
|
/*
|
||||||
|
// find first non-vpn active connection
|
||||||
|
const auto act_i = std::find_if(d->mActiveConns.cbegin(), d->mActiveConns.cend(), [] (NetworkManager::ActiveConnection::Ptr const & conn) -> bool
|
||||||
|
{
|
||||||
|
return nullptr != dynamic_cast<NetworkManager::VpnConnection const *>(conn.data());
|
||||||
|
});
|
||||||
|
if (act_i != d->mActiveConns.cend() && !(*act_i)->devices().empty())
|
||||||
|
{
|
||||||
|
dev_uni = (*act_i)->devices().front();
|
||||||
|
spec_object = (*act_i)->path();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dev_name = connectPtr->settings()->interfaceName();
|
||||||
|
for (auto const & dev : m_networkResourceInstance->m_devices) {
|
||||||
|
for (auto const & dev_conn : dev->availableConnections()) {
|
||||||
|
if (dev_conn == connectPtr) {
|
||||||
|
dev_uni = dev->uni();
|
||||||
|
dev_name = dev->interfaceName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dev_uni.isEmpty() && !dev_name.isEmpty()) {
|
||||||
|
auto dev = m_networkResourceInstance->findDeviceInterface(dev_name);
|
||||||
|
if (!dev.isNull())
|
||||||
|
dev_uni = dev->uni();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dev_uni.isEmpty()) {
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qWarning() << QStringLiteral("can't find device '%1' to activate connection '%2' on").arg(dev_name).arg(connectPtr->name());
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << __FUNCTION__ << conn_uni << dev_uni << conn_name << dev_name << spec_object;
|
||||||
|
|
||||||
|
//TODO: check vpn type etc..
|
||||||
|
QDBusPendingCallWatcher * watcher;
|
||||||
|
watcher = new QDBusPendingCallWatcher{NetworkManager::activateConnection(conn_uni, dev_uni, spec_object), this};
|
||||||
|
connect(watcher, &QDBusPendingCallWatcher::finished, [conn_name, dev_name] (QDBusPendingCallWatcher * watcher) {
|
||||||
|
if (watcher->isError() || !watcher->isValid()) {
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qWarning() << "activate connection failed: " << watcher->error().message();
|
||||||
|
} else {
|
||||||
|
qWarning()<<"success"<<watcher->reply().errorName() <<"error msg"<<watcher->reply().errorMessage();
|
||||||
|
qWarning()<<"error type"<<watcher->error().type();
|
||||||
|
}
|
||||||
|
|
||||||
|
watcher->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int KyNetworkConnect::deactivateConnection(const QString connectName, const QString &uuid)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
NetworkManager::ActiveConnection::Ptr activateConnectPtr = nullptr;
|
||||||
|
|
||||||
|
qDebug()<<"deactivetate connect name"<<connectName<<"uuid"<<uuid;
|
||||||
|
for (index = 0; index < m_networkResourceInstance->m_activeConns.size(); ++index) {
|
||||||
|
activateConnectPtr = m_networkResourceInstance->m_activeConns.at(index);
|
||||||
|
if (activateConnectPtr->uuid() == uuid) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index >= m_networkResourceInstance->m_activeConns.size()) {
|
||||||
|
qWarning()<<"it can not find the activate connect"<<connectName << "uuid"<<uuid;
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << __FUNCTION__ <<"dead active connection path:"<< activateConnectPtr->path();
|
||||||
|
|
||||||
|
QDBusPendingReply<> reply = NetworkManager::deactivateConnection(activateConnectPtr->path());
|
||||||
|
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||||
|
connect(watcher, &QDBusPendingCallWatcher::finished, [activateConnectPtr] (QDBusPendingCallWatcher * watcher) {
|
||||||
|
qDebug() << "finshed";
|
||||||
|
//TODO::it may should send signal deactivateConnectionFinished
|
||||||
|
if (watcher->isError() || !watcher->isValid()) {
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qWarning() << QStringLiteral("deactivation of connection '%1' failed: %3").arg(activateConnectPtr->connection()->name())
|
||||||
|
.arg(watcher->error().message());
|
||||||
|
} else {
|
||||||
|
qWarning()<<"deactive connect finished"<<activateConnectPtr->connection()->name();
|
||||||
|
}
|
||||||
|
watcher->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::requestScan(const QString ifaceName)
|
||||||
|
{
|
||||||
|
auto const & dev = m_networkResourceInstance->getNetworkDevice(ifaceName);
|
||||||
|
auto spec_dev = dev->as<NetworkManager::WirelessDevice>();
|
||||||
|
if (nullptr == spec_dev) {
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qWarning() << "dropping request for scan on non wireles device " << dev->interfaceName();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_networkResourceInstance->requestScan(spec_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::requestAllWifiScan()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KyNetworkConnect::activateWirelessConnection(NetworkManager::WirelessNetwork::Ptr wirelessNet)
|
||||||
|
{
|
||||||
|
qDebug() << "activateWirelessConnections" ;
|
||||||
|
emit starWaiting();
|
||||||
|
QString conn_uni;
|
||||||
|
QString dev_uni;
|
||||||
|
QString conn_name;
|
||||||
|
QString dev_name;
|
||||||
|
QString spec_object;
|
||||||
|
|
||||||
|
auto access_point = wirelessNet->referenceAccessPoint();
|
||||||
|
Q_ASSERT(!access_point.isNull());
|
||||||
|
dev_uni = wirelessNet->device();
|
||||||
|
syslog(LOG_DEBUG,"dev_uni %s",dev_uni.toUtf8().data());
|
||||||
|
auto dev = m_networkResourceInstance->findDeviceUni(dev_uni);
|
||||||
|
Q_ASSERT(!dev.isNull());
|
||||||
|
auto spec_dev = dev->as<NetworkManager::WirelessDevice>();
|
||||||
|
Q_ASSERT(nullptr != spec_dev);
|
||||||
|
conn_uni = access_point->uni();
|
||||||
|
syslog(LOG_DEBUG,"conn_uni %s",conn_uni.toUtf8().data());
|
||||||
|
conn_name = access_point->ssid();
|
||||||
|
syslog(LOG_DEBUG,"conn_name %s",conn_name.toUtf8().data());
|
||||||
|
//find the device name
|
||||||
|
NetworkManager::Connection::Ptr conn;
|
||||||
|
dev_name = dev->interfaceName();
|
||||||
|
syslog(LOG_DEBUG,"dev_name %s",dev_name.toUtf8().data());
|
||||||
|
for (auto const & dev_conn : dev->availableConnections())
|
||||||
|
{
|
||||||
|
syslog(LOG_DEBUG,"dev_conn->settings()->id() %s",dev_conn->settings()->id().toUtf8().data());
|
||||||
|
if (dev_conn->settings()->id() == conn_name)
|
||||||
|
{
|
||||||
|
conn = dev_conn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conn_uni = conn->path();
|
||||||
|
qDebug()<<conn_uni;
|
||||||
|
|
||||||
|
QDBusPendingCallWatcher * watcher;
|
||||||
|
watcher = new QDBusPendingCallWatcher{NetworkManager::activateConnection(conn_uni, dev_uni, spec_object), this};
|
||||||
|
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
||||||
|
if (watcher->isError() || !watcher->isValid())
|
||||||
|
{
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qWarning() << QStringLiteral("activation of connection failed: %1").arg(watcher->error().message());
|
||||||
|
} else {
|
||||||
|
emit checkActiveonnection((qdbus_cast<QDBusObjectPath>(watcher->reply().arguments().at(0))).path());
|
||||||
|
}
|
||||||
|
qDebug() <<" " << (qdbus_cast<QDBusObjectPath>(watcher->reply().arguments().at(0))).path();
|
||||||
|
|
||||||
|
watcher->deleteLater();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::addAndActivateWirelessConnection(NetworkManager::WirelessNetwork::Ptr wirelessNet, const QString &psk)
|
||||||
|
{
|
||||||
|
qDebug() << "addAndActivateWirelessConnection" ;
|
||||||
|
emit starWaiting();
|
||||||
|
QString conn_uni;
|
||||||
|
QString dev_uni;
|
||||||
|
QString conn_name;
|
||||||
|
QString dev_name;
|
||||||
|
QString spec_object;
|
||||||
|
NMVariantMapMap map_settings;
|
||||||
|
|
||||||
|
auto access_point = wirelessNet->referenceAccessPoint();
|
||||||
|
Q_ASSERT(!access_point.isNull());
|
||||||
|
dev_uni = wirelessNet->device();
|
||||||
|
syslog(LOG_DEBUG,"dev_uni %s",dev_uni.toUtf8().data());
|
||||||
|
auto dev = m_networkResourceInstance->findDeviceUni(dev_uni);
|
||||||
|
Q_ASSERT(!dev.isNull());
|
||||||
|
auto spec_dev = dev->as<NetworkManager::WirelessDevice>();
|
||||||
|
Q_ASSERT(nullptr != spec_dev);
|
||||||
|
conn_uni = access_point->uni();
|
||||||
|
syslog(LOG_DEBUG,"conn_uni %s",conn_uni.toUtf8().data());
|
||||||
|
conn_name = access_point->ssid();
|
||||||
|
syslog(LOG_DEBUG,"conn_name %s",conn_name.toUtf8().data());
|
||||||
|
//find the device name
|
||||||
|
NetworkManager::Connection::Ptr conn;
|
||||||
|
dev_name = dev->interfaceName();
|
||||||
|
syslog(LOG_DEBUG,"dev_name %s",dev_name.toUtf8().data());
|
||||||
|
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qWarning() << QStringLiteral("can't find connection for '%1' on device '%2', will create new...").arg(conn_name).arg(dev_name);
|
||||||
|
spec_object = conn_uni;
|
||||||
|
NetworkManager::WirelessSecurityType sec_type = NetworkManager::findBestWirelessSecurity(spec_dev->wirelessCapabilities()
|
||||||
|
, true, (spec_dev->mode() == NetworkManager::WirelessDevice::Adhoc)
|
||||||
|
, access_point->capabilities(), access_point->wpaFlags(), access_point->rsnFlags());
|
||||||
|
|
||||||
|
qDebug() << "findBestWirelessSecurity type "<< sec_type;
|
||||||
|
switch (sec_type)
|
||||||
|
{
|
||||||
|
case NetworkManager::UnknownSecurity:
|
||||||
|
qWarning() << QStringLiteral("unknown security to use for '%1'").arg(conn_name);
|
||||||
|
case NetworkManager::NoneSecurity:
|
||||||
|
//nothing to do
|
||||||
|
break;
|
||||||
|
case NetworkManager::WpaPsk:
|
||||||
|
case NetworkManager::Wpa2Psk:
|
||||||
|
if (NetworkManager::ConnectionSettings::Ptr settings = assembleWpaXPskSettings(access_point,psk))
|
||||||
|
{
|
||||||
|
map_settings = settings->toMap();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
qWarning() << QStringLiteral("connection settings assembly for '%1' failed, abandoning activation...").arg(conn_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//TODO: other types...
|
||||||
|
}
|
||||||
|
|
||||||
|
QDBusPendingCallWatcher * watcher;
|
||||||
|
watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this};
|
||||||
|
connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) {
|
||||||
|
if (watcher->isError() || !watcher->isValid())
|
||||||
|
{
|
||||||
|
//TODO: in what form should we output the warning messages
|
||||||
|
qDebug() << "activation of connection failed " << watcher->error().message();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
emit checkActiveonnection((qdbus_cast<QDBusObjectPath>(watcher->reply().arguments().at(1))).path());
|
||||||
|
}
|
||||||
|
watcher->deleteLater();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::onActivateWirelessConnection(const QString &connectSsid, const QString &connectUuid)
|
||||||
|
{
|
||||||
|
qDebug() << "onActivateWirelessConnection" << connectSsid;
|
||||||
|
NetworkManager::WirelessNetwork::Ptr wirelessNet = nullptr;
|
||||||
|
for (auto const & net : m_networkResourceInstance->m_wifiNets)
|
||||||
|
{
|
||||||
|
qDebug() << net->ssid() << " " << connectSsid;
|
||||||
|
if (net->ssid() == connectSsid)
|
||||||
|
{
|
||||||
|
wirelessNet = net;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wirelessNet.isNull())
|
||||||
|
{
|
||||||
|
//TODO:隐藏wifi不会存在与AP中,需要新建connection去连接
|
||||||
|
qDebug() << "hidewifi";emit noConnection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "非隐藏wifi";
|
||||||
|
NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->getConnect(connectUuid);
|
||||||
|
if (connectPtr.isNull())
|
||||||
|
{
|
||||||
|
//无配置文件,前段输入完密码直接调用addAndActivateWirelessConnection
|
||||||
|
qDebug() << "emit noConnection";
|
||||||
|
emit noConnection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// //获取安全类型
|
||||||
|
// NetworkManager::ConnectionSettings::Ptr settings = connectPtr->settings();
|
||||||
|
// NetworkManager::WirelessSecuritySetting::Ptr wifiSecurity =
|
||||||
|
// settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||||
|
// int key_mgmt = wifiSecurity->keyMgmt();
|
||||||
|
|
||||||
|
//获取密码存储策略 0:所有用户存储 1:当前用户存储 2:每次连接询问
|
||||||
|
NetworkManager::ConnectionSettings::Ptr settings = connectPtr->settings();
|
||||||
|
NetworkManager::WirelessSecuritySetting::Ptr wifiSecurity =
|
||||||
|
settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||||
|
int psk_flag = wifiSecurity->pskFlags();
|
||||||
|
|
||||||
|
qDebug() << "psk_flag=" <<psk_flag;
|
||||||
|
|
||||||
|
if(psk_flag == NetworkManager::Setting::SecretFlagType::NotSaved)
|
||||||
|
{
|
||||||
|
//每次都要询问,前端弹出窗口
|
||||||
|
qDebug() << "emit notSavedConnection";
|
||||||
|
emit notSavedConnection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
activateWirelessConnection(wirelessNet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::onActivateWirelessConnectionWithPWD(const QString &connectSsid, const QString &psk, bool isNotSaved, const QString &connectUuid)
|
||||||
|
{
|
||||||
|
qDebug() << "onActivateWirelessConnectionWithPWD" << connectSsid;
|
||||||
|
|
||||||
|
if(isNotSaved && !connectUuid.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << "每次都要询问";
|
||||||
|
//修改connection psk
|
||||||
|
NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->getConnect(connectUuid);
|
||||||
|
if (connectPtr.isNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NetworkManager::ConnectionSettings::Ptr settings = connectPtr->settings();
|
||||||
|
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
||||||
|
= settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||||
|
qDebug() << connectPtr->path();
|
||||||
|
security_sett->setPsk(psk);
|
||||||
|
|
||||||
|
//
|
||||||
|
NetworkManager::WirelessNetwork::Ptr wirelessNet = nullptr;
|
||||||
|
for (auto const & net : m_networkResourceInstance->m_wifiNets)
|
||||||
|
{
|
||||||
|
if (net->ssid() == connectSsid)
|
||||||
|
{
|
||||||
|
wirelessNet = net;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
activateWirelessConnection(wirelessNet);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NetworkManager::WirelessNetwork::Ptr wirelessNet = nullptr;
|
||||||
|
for (auto const & net : m_networkResourceInstance->m_wifiNets)
|
||||||
|
{
|
||||||
|
if (net->ssid() == connectSsid)
|
||||||
|
{
|
||||||
|
wirelessNet = net;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wirelessNet.isNull())
|
||||||
|
{
|
||||||
|
//TODO:隐藏wifi不会存在与AP中,需要新建connection去连接
|
||||||
|
qDebug() << "hidewifi";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addAndActivateWirelessConnection(wirelessNet,psk);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KyNetworkConnect::onCheckActiveonnection(const QString &activeConnPath)
|
||||||
|
{
|
||||||
|
if (m_networkResourceInstance->m_activeConns.size() == 0)
|
||||||
|
{
|
||||||
|
qDebug() << "不存在activeConnPath";
|
||||||
|
emit connResult(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto const & activeConn : m_networkResourceInstance->m_activeConns)
|
||||||
|
{
|
||||||
|
if (activeConn->path() == activeConnPath)
|
||||||
|
{
|
||||||
|
qDebug() << "存在activeConnPath,且匹配"<<activeConnPath;
|
||||||
|
qDebug() << activeConn->state();
|
||||||
|
connect(activeConn.data(), &NetworkManager::ActiveConnection::stateChangedReason, this, &KyNetworkConnect::onStateChangedReason);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qDebug() << "存在activeConnPath,但不匹配"<<activeConnPath;
|
||||||
|
emit connResult(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyNetworkConnect::onStateChangedReason(NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason)
|
||||||
|
{
|
||||||
|
qDebug() << "onStateChangedReason state:" << state << " reason" << reason;
|
||||||
|
if (state == NetworkManager::ActiveConnection::State::Activated)
|
||||||
|
{
|
||||||
|
emit connResult(0);
|
||||||
|
} else if (state == NetworkManager::ActiveConnection::State::Deactivating || state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||||
|
emit connResult(1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KYLINNETWORKCONNECT_H
|
||||||
|
#define KYLINNETWORKCONNECT_H
|
||||||
|
|
||||||
|
#include "kylinnetworkresourcemanager.h"
|
||||||
|
#include "kylinconnectsetting.h"
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
WIRED_CONNECT,
|
||||||
|
WIFI_CONNECT,
|
||||||
|
}KyConnectType;
|
||||||
|
|
||||||
|
class KyNetworkConnect : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
KyNetworkConnect();
|
||||||
|
~KyNetworkConnect();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void createConnect(KyConnectType connectType, const KyConnectSetting &connectInfo);
|
||||||
|
void updateConnect(const QString &connectUuid, const KyConnectSetting &connectInfo);
|
||||||
|
void deleteConnect(const QString &connectUuid);
|
||||||
|
int addAndActivateConnect(const QString );
|
||||||
|
int activateConnection(const QString connectUuid);
|
||||||
|
void activateWirelessConnection(NetworkManager::WirelessNetwork::Ptr wirelessNet);
|
||||||
|
void addAndActivateWirelessConnection(NetworkManager::WirelessNetwork::Ptr wirelessNet, const QString &psk);
|
||||||
|
int deactivateConnection(const QString connectName, const QString &uuid);
|
||||||
|
void requestScan(const QString ifaceName);
|
||||||
|
void requestAllWifiScan();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void connectSettingInit(
|
||||||
|
NetworkManager::ConnectionSettings::Ptr connectionSettings,
|
||||||
|
const KyConnectSetting &connectInfo);
|
||||||
|
void ipv4SettingInit(NetworkManager::Ipv4Setting::Ptr &ipv4Setting,
|
||||||
|
const KyConnectSetting &connectInfo);
|
||||||
|
void ipv6SettingInit(NetworkManager::Ipv6Setting::Ptr &ipv6Setting,
|
||||||
|
const KyConnectSetting &connectInfo);
|
||||||
|
|
||||||
|
void createWiredConnect(const KyConnectSetting &connectInfo);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void activateConnectionFinished(NetworkManager::Connection::Ptr &conn);
|
||||||
|
void deactivateConnectionFinished(NetworkManager::Connection::Ptr &conn);
|
||||||
|
|
||||||
|
void noConnection();
|
||||||
|
void notSavedConnection();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void checkActiveonnection(const QString &activeConn);
|
||||||
|
void connResult(int);
|
||||||
|
void starWaiting();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onActivateWirelessConnection(const QString &connectSsid, const QString &connectUuid);
|
||||||
|
void onActivateWirelessConnectionWithPWD(const QString &connectSsid, const QString &psk, bool isNotSaved, const QString &connectUuid);
|
||||||
|
void onCheckActiveonnection(const QString &activeConn);
|
||||||
|
void onStateChangedReason(NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason);
|
||||||
|
|
||||||
|
private:
|
||||||
|
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // KYLINNETWORKCONNECT_H
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
#include "kylinwiredconnectitem.h"
|
||||||
|
|
||||||
|
KyWiredConnectItem::KyWiredConnectItem(QObject *parent):QObject(parent)
|
||||||
|
{
|
||||||
|
m_connectName = "";
|
||||||
|
m_connectUuid = "";
|
||||||
|
m_ifaceName = "";
|
||||||
|
|
||||||
|
m_ipv4 = "";
|
||||||
|
m_ipv6 = "";
|
||||||
|
m_hardAddress = "";
|
||||||
|
|
||||||
|
m_bandWith = "";
|
||||||
|
m_upSpeed = 0;
|
||||||
|
m_downSpeed = 0;
|
||||||
|
|
||||||
|
m_state = NetworkManager::ActiveConnection::State::Unknown; //deactive、activing and actived
|
||||||
|
m_itemType = ""; //activeconnect or connect
|
||||||
|
}
|
||||||
|
|
||||||
|
KyWiredConnectItem::~KyWiredConnectItem()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void KyWiredConnectItem::dumpInfo()
|
||||||
|
{
|
||||||
|
qDebug()<<"wired connection item info:";
|
||||||
|
qDebug()<<"connect name:"<<m_connectName;
|
||||||
|
qDebug()<<"connect uuid:"<<m_connectUuid;
|
||||||
|
qDebug()<<"iface name:"<<m_ifaceName;
|
||||||
|
|
||||||
|
qDebug()<<"ipv4 address:"<<m_ipv4;
|
||||||
|
qDebug()<<"ipv6 address:"<<m_ipv6;
|
||||||
|
qDebug()<<"hard address:"<<m_hardAddress;
|
||||||
|
|
||||||
|
qDebug()<<"band width:"<< m_bandWith;
|
||||||
|
qDebug()<<"up speed:"<<m_upSpeed;
|
||||||
|
qDebug()<<"down speed:"<<m_downSpeed;
|
||||||
|
|
||||||
|
qDebug()<<"state:"<<m_state;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef KYLINWIREDCONNECTITEM_H
|
||||||
|
#define KYLINWIREDCONNECTITEM_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include "kylinnetworkresourcemanager.h"
|
||||||
|
|
||||||
|
class KyWiredConnectItem : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit KyWiredConnectItem(QObject *parent = nullptr);
|
||||||
|
~KyWiredConnectItem();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void dumpInfo();
|
||||||
|
|
||||||
|
public:
|
||||||
|
QString m_connectName;
|
||||||
|
QString m_connectUuid;
|
||||||
|
QString m_ifaceName;
|
||||||
|
|
||||||
|
QString m_ipv4;
|
||||||
|
QString m_ipv6;
|
||||||
|
QString m_hardAddress;
|
||||||
|
|
||||||
|
QString m_bandWith;
|
||||||
|
qulonglong m_upSpeed;
|
||||||
|
qulonglong m_downSpeed;
|
||||||
|
|
||||||
|
NetworkManager::ActiveConnection::State m_state; //deactive、activing and actived
|
||||||
|
QString m_itemType; //activeconnect or connect
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // KYLINWIREDCONNECTITEM_H
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "dlghotspotcreate.h"
|
#include "dlghotspotcreate.h"
|
||||||
#include "ui_dlghotspotcreate.h"
|
#include "ui_dlghotspotcreate.h"
|
||||||
#include "src/utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
DlgHotspotCreate::DlgHotspotCreate(QString wiFiCardName, QWidget *parent) :
|
DlgHotspotCreate::DlgHotspotCreate(QString wiFiCardName, QWidget *parent) :
|
||||||
wirelessCardName(wiFiCardName),
|
wirelessCardName(wiFiCardName),
|
|
@ -0,0 +1,11 @@
|
||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
$$PWD/dlghotspotcreate.ui
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/dlghotspotcreate.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/dlghotspotcreate.cpp
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
|
|
||||||
|
|
||||||
<!DOCTYPE busconfig PUBLIC
|
|
||||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
|
||||||
<busconfig>
|
|
||||||
<!-- Only root can own the service -->
|
|
||||||
<policy user="root">
|
|
||||||
<allow own="com.kylin.NetworkManager.qt.systemdbus"/>
|
|
||||||
<allow send_interface="com.kylin.NetworkManager.interface"/>
|
|
||||||
</policy>
|
|
||||||
|
|
||||||
<!-- Allow anyone to invoke methods on the interfaces -->
|
|
||||||
<policy context="default">
|
|
||||||
<allow send_destination="com.kylin.NetworkManager.qt.systemdbus"
|
|
||||||
send_interface="com.kylin.NetworkManager.interface"/>
|
|
||||||
<allow send_destination="com.kylin.NetworkManager.qt.systemdbus"
|
|
||||||
send_interface="org.freedesktop.DBus.Introspectable"/>
|
|
||||||
<allow send_destination="com.kylin.NetworkManager.qt.systemdbus"
|
|
||||||
send_interface="org.freedesktop.DBus.Properties"/>
|
|
||||||
</policy>
|
|
||||||
</busconfig>
|
|
|
@ -1,4 +0,0 @@
|
||||||
[D-BUS Service]
|
|
||||||
Name=com.kylin.NetworkManager.qt.systemdbus
|
|
||||||
Exec=/usr/bin/kylin-nm
|
|
||||||
User=root
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
include(tools/tools.pri)
|
||||||
|
include(wireless-security/wireless-security.pri)
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
$$PWD/confform.ui \
|
||||||
|
$$PWD/mainwindow.ui \
|
||||||
|
$$PWD/oneconnform.ui \
|
||||||
|
$$PWD/onelancform.ui \
|
||||||
|
$$PWD/wificonfigdialog.ui \
|
||||||
|
$$PWD/wpawifidialog.ui
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/confform.h \
|
||||||
|
$$PWD/kylinwiredwidget.h \
|
||||||
|
$$PWD/mainwindow.h \
|
||||||
|
$$PWD/nmdemo.h \
|
||||||
|
$$PWD/oneconnform.h \
|
||||||
|
$$PWD/onelancform.h \
|
||||||
|
$$PWD/wificonfigdialog.h \
|
||||||
|
$$PWD/wpawifidialog.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/confform.cpp \
|
||||||
|
$$PWD/kylinwiredwidget.cpp \
|
||||||
|
$$PWD/mainwindow.cpp \
|
||||||
|
$$PWD/nmdemo.cpp \
|
||||||
|
$$PWD/oneconnform.cpp \
|
||||||
|
$$PWD/onelancform.cpp \
|
||||||
|
$$PWD/wificonfigdialog.cpp \
|
||||||
|
$$PWD/wpawifidialog.cpp
|
|
@ -21,7 +21,7 @@
|
||||||
#include "oneconnform.h"
|
#include "oneconnform.h"
|
||||||
#include "onelancform.h"
|
#include "onelancform.h"
|
||||||
#include "wifi-auth-thread.h"
|
#include "wifi-auth-thread.h"
|
||||||
#include "hot-spot/dlghotspotcreate.h"
|
#include "hotspot/dlghotspotcreate.h"
|
||||||
#include "wireless-security/dlghidewifi.h"
|
#include "wireless-security/dlghidewifi.h"
|
||||||
#include "sysdbusregister.h"
|
#include "sysdbusregister.h"
|
||||||
#include "kylinwiredwidget.h"
|
#include "kylinwiredwidget.h"
|
|
@ -0,0 +1,10 @@
|
||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/loadingdiv.h \
|
||||||
|
$$PWD/switchbutton.h
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/loadingdiv.cpp \
|
||||||
|
$$PWD/switchbutton.cpp
|
|
@ -20,10 +20,10 @@
|
||||||
#include "dlghidewifi.h"
|
#include "dlghidewifi.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "ui_dlghidewifi.h"
|
#include "ui_dlghidewifi.h"
|
||||||
#include "src/backthread.h"
|
#include "backthread.h"
|
||||||
#include "src/mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
#include "src/wpawifidialog.h"
|
#include "wpawifidialog.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
|
@ -20,7 +20,7 @@
|
||||||
#include "dlghidewifieapfast.h"
|
#include "dlghidewifieapfast.h"
|
||||||
#include "ui_dlghidewifieapfast.h"
|
#include "ui_dlghidewifieapfast.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
|
|
||||||
DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) :
|
DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) :
|
||||||
WepOrWpa(type),
|
WepOrWpa(type),
|
|
@ -20,7 +20,7 @@
|
||||||
#include "dlghidewifieapleap.h"
|
#include "dlghidewifieapleap.h"
|
||||||
#include "ui_dlghidewifieapleap.h"
|
#include "ui_dlghidewifieapleap.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
|
|
||||||
DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) :
|
DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) :
|
||||||
WepOrWpa(type),
|
WepOrWpa(type),
|
|
@ -20,8 +20,8 @@
|
||||||
#include "dlghidewifieappeap.h"
|
#include "dlghidewifieappeap.h"
|
||||||
#include "ui_dlghidewifieappeap.h"
|
#include "ui_dlghidewifieappeap.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "dlghidewifieappwd.h"
|
#include "dlghidewifieappwd.h"
|
||||||
#include "ui_dlghidewifieappwd.h"
|
#include "ui_dlghidewifieappwd.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
|
|
||||||
DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) :
|
DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) :
|
||||||
WepOrWpa(type),
|
WepOrWpa(type),
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
#include "ui_dlghidewifieaptls.h"
|
#include "ui_dlghidewifieaptls.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "dlghidewifieapttls.h"
|
#include "dlghidewifieapttls.h"
|
||||||
#include "ui_dlghidewifieapttls.h"
|
#include "ui_dlghidewifieapttls.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
|
|
||||||
DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) :
|
DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) :
|
||||||
WepOrWpa(type),
|
WepOrWpa(type),
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "ui_dlghidewifileap.h"
|
#include "ui_dlghidewifileap.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
|
|
||||||
DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) :
|
DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "ui_dlghidewifiwep.h"
|
#include "ui_dlghidewifiwep.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/kylin-dbus-interface.h"
|
#include "kylin-dbus-interface.h"
|
||||||
|
|
||||||
DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) :
|
DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) :
|
||||||
WepPwdOrCode(type),
|
WepPwdOrCode(type),
|
|
@ -20,9 +20,9 @@
|
||||||
#include "dlghidewifiwpa.h"
|
#include "dlghidewifiwpa.h"
|
||||||
#include "ui_dlghidewifiwpa.h"
|
#include "ui_dlghidewifiwpa.h"
|
||||||
#include "kylinheadfile.h"
|
#include "kylinheadfile.h"
|
||||||
#include "src/backthread.h"
|
#include "backthread.h"
|
||||||
#include "src/mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "src/wpawifidialog.h"
|
#include "wpawifidialog.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
|
@ -0,0 +1,40 @@
|
||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
$$PWD/dlghidewifi.ui \
|
||||||
|
$$PWD/dlghidewifieapfast.ui \
|
||||||
|
$$PWD/dlghidewifieapleap.ui \
|
||||||
|
$$PWD/dlghidewifieappeap.ui \
|
||||||
|
$$PWD/dlghidewifieappwd.ui \
|
||||||
|
$$PWD/dlghidewifieaptls.ui \
|
||||||
|
$$PWD/dlghidewifieapttls.ui \
|
||||||
|
$$PWD/dlghidewifileap.ui \
|
||||||
|
$$PWD/dlghidewifiwep.ui \
|
||||||
|
$$PWD/dlghidewifiwpa.ui
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/dlghidewifi.h \
|
||||||
|
$$PWD/dlghidewifieapfast.h \
|
||||||
|
$$PWD/dlghidewifieapleap.h \
|
||||||
|
$$PWD/dlghidewifieappeap.h \
|
||||||
|
$$PWD/dlghidewifieappwd.h \
|
||||||
|
$$PWD/dlghidewifieaptls.h \
|
||||||
|
$$PWD/dlghidewifieapttls.h \
|
||||||
|
$$PWD/dlghidewifileap.h \
|
||||||
|
$$PWD/dlghidewifiwep.h \
|
||||||
|
$$PWD/dlghidewifiwpa.h \
|
||||||
|
$$PWD/kylinheadfile.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/dlghidewifi.cpp \
|
||||||
|
$$PWD/dlghidewifieapfast.cpp \
|
||||||
|
$$PWD/dlghidewifieapleap.cpp \
|
||||||
|
$$PWD/dlghidewifieappeap.cpp \
|
||||||
|
$$PWD/dlghidewifieappwd.cpp \
|
||||||
|
$$PWD/dlghidewifieaptls.cpp \
|
||||||
|
$$PWD/dlghidewifieapttls.cpp \
|
||||||
|
$$PWD/dlghidewifileap.cpp \
|
||||||
|
$$PWD/dlghidewifiwep.cpp \
|
||||||
|
$$PWD/dlghidewifiwpa.cpp \
|
||||||
|
$$PWD/kylinheadfile.cpp
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2018-10-19T15:29:47
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui x11extras dbus KWindowSystem svg concurrent network
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = kylin-nm
|
||||||
|
TEMPLATE = app
|
||||||
|
LANGUAGE = C++
|
||||||
|
|
||||||
|
CONFIG += c++14
|
||||||
|
CONFIG += qt warn_on
|
||||||
|
#CONFIG += release
|
||||||
|
CONFIG += link_pkgconfig
|
||||||
|
|
||||||
|
PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libnm
|
||||||
|
|
||||||
|
INCLUDEPATH += /usr/include/KF5/NetworkManagerQt
|
||||||
|
|
||||||
|
LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lKF5NetworkManagerQt
|
||||||
|
#LIBS += -lkysec
|
||||||
|
target.path = /usr/bin
|
||||||
|
target.source += $$TARGET
|
||||||
|
desktop.path = /etc/xdg/autostart/
|
||||||
|
desktop.files = kylin-nm.desktop
|
||||||
|
|
||||||
|
INSTALLS += target \
|
||||||
|
desktop \
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
# QMAKE_CXXFLAGS += -Wno-unused-parameter
|
||||||
|
QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS)
|
||||||
|
QMAKE_CFLAGS *= $(shell dpkg-buildflags --get CFLAGS)
|
||||||
|
QMAKE_CXXFLAGS *= $(shell dpkg-buildflags --get CXXFLAGS)
|
||||||
|
QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS)
|
||||||
|
|
||||||
|
include(singleapplication/qt-single-application.pri)
|
||||||
|
include(backend/backend.pri)
|
||||||
|
include(frontend/frontend.pri)
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
../nmqrc.qrc
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
unix {
|
||||||
|
UI_DIR = .ui
|
||||||
|
MOC_DIR = .moc
|
||||||
|
OBJECTS_DIR = .obj
|
||||||
|
}
|
Loading…
Reference in New Issue