From 65d2ceca0029a1da34b1c8699687d6482d27a11c Mon Sep 17 00:00:00 2001 From: reionwong Date: Thu, 11 Nov 2021 18:05:01 +0800 Subject: [PATCH] Add Bluetooth options --- CMakeLists.txt | 4 + src/bluetooth/bluetoothmanager.cpp | 30 ++++++ src/bluetooth/bluetoothmanager.h | 3 + src/qml/Bluetooth/Main.qml | 128 ++++++++++++++++++------- src/qml/SideBar.qml | 9 ++ src/qml/VPN/Main.qml | 76 +++++++++++++++ src/qml/WLAN/WirelessDetailsDialog.qml | 2 +- src/resources.qrc | 1 + src/vpn/nm-l2tp-service.h | 76 +++++++++++++++ src/vpn/nm-openvpn-service.h | 111 +++++++++++++++++++++ src/vpn/nm-pptp-service.h | 56 +++++++++++ src/vpn/vpn.cpp | 28 ++++++ src/vpn/vpn.h | 16 ++++ translations/en_US.ts | 62 ++++++++---- translations/zh_CN.ts | 62 ++++++++---- 15 files changed, 588 insertions(+), 76 deletions(-) create mode 100644 src/qml/VPN/Main.qml create mode 100644 src/vpn/nm-l2tp-service.h create mode 100644 src/vpn/nm-openvpn-service.h create mode 100644 src/vpn/nm-pptp-service.h create mode 100644 src/vpn/vpn.cpp create mode 100644 src/vpn/vpn.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 031122c..0eac68f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,10 @@ set(SRCS src/touchpad.cpp src/bluetooth/bluetoothmanager.cpp src/bluetooth/bluetoothagent.cpp + src/vpn/vpn.cpp + src/vpn/nm-l2tp-service.h + src/vpn/nm-openvpn-service.h + src/vpn/nm-pptp-service.h # src/update/updatemodel.cpp ) diff --git a/src/bluetooth/bluetoothmanager.cpp b/src/bluetooth/bluetoothmanager.cpp index f9adb9e..b83db9f 100644 --- a/src/bluetooth/bluetoothmanager.cpp +++ b/src/bluetooth/bluetoothmanager.cpp @@ -4,6 +4,7 @@ #include #include #include +#include BluetoothManager::BluetoothManager(QObject *parent) : QObject(parent) @@ -73,6 +74,35 @@ void BluetoothManager::confirmMatchButton(const bool match) } } +void BluetoothManager::deviceDisconnect(const QString address) +{ + stopMediaPlayer(address); + BluezQt::AdapterPtr adaptor = m_manager->usableAdapter(); + BluezQt::DevicePtr device = adaptor->deviceForAddress(address); + BluezQt::PendingCall *pairCall = device->disconnectFromDevice(); + // connect(pairCall, &BluezQt::PendingCall::finished, this, &Bluetooth::disconnectFromDeviceFinished); +} + +void BluetoothManager::deviceRemoved(const QString address) +{ + stopMediaPlayer(address); + BluezQt::AdapterPtr adaptor = m_manager->usableAdapter(); + BluezQt::DevicePtr device = adaptor->deviceForAddress(address); + BluezQt::PendingCall *removeCall = adaptor->removeDevice(device); + // connect(removeCall, &BluezQt::PendingCall::finished, this, &Bluetooth::removeDeviceFinished); +} + +void BluetoothManager::stopMediaPlayer(const QString address) +{ + BluezQt::AdapterPtr adaptor = m_manager->usableAdapter(); + BluezQt::DevicePtr device = adaptor->deviceForAddress(address); + BluezQt::MediaPlayerPtr mediaPlayer = device->mediaPlayer(); + + if (mediaPlayer){ + mediaPlayer->stop(); + } +} + void BluetoothManager::onInitJobResult(BluezQt::InitManagerJob *job) { if (job->error()) { diff --git a/src/bluetooth/bluetoothmanager.h b/src/bluetooth/bluetoothmanager.h index 2b170c1..b80cb2c 100644 --- a/src/bluetooth/bluetoothmanager.h +++ b/src/bluetooth/bluetoothmanager.h @@ -17,6 +17,9 @@ public: Q_INVOKABLE void connectToDevice(const QString address); Q_INVOKABLE void requestParingConnection(const QString address); Q_INVOKABLE void confirmMatchButton(const bool match); + Q_INVOKABLE void deviceDisconnect(const QString address); + Q_INVOKABLE void deviceRemoved(const QString address); + Q_INVOKABLE void stopMediaPlayer(const QString address); signals: void showPairDialog(const QString name, const QString pin); diff --git a/src/qml/Bluetooth/Main.qml b/src/qml/Bluetooth/Main.qml index ae13563..481276f 100644 --- a/src/qml/Bluetooth/Main.qml +++ b/src/qml/Bluetooth/Main.qml @@ -102,7 +102,7 @@ ItemPage { id: _listView visible: count > 0 interactive: false - spacing: FishUI.Units.largeSpacing + spacing: 0 Layout.fillWidth: true @@ -127,50 +127,108 @@ ItemPage { delegate: Item { width: ListView.view.width - height: _itemLayout.implicitHeight + FishUI.Units.largeSpacing * 1.5 + height: _itemLayout.implicitHeight + FishUI.Units.largeSpacing - Rectangle { - anchors.fill: parent - radius: FishUI.Theme.smallRadius - color: FishUI.Theme.textColor - opacity: mouseArea.pressed ? 0.15 : mouseArea.containsMouse ? 0.1 : 0.0 + property bool paired: model.Connected && model.Paired + + onPairedChanged: { + if (!paired) { + additionalSettings.hide() + } } - MouseArea { - id: mouseArea + ColumnLayout { + id: _itemLayout anchors.fill: parent - hoverEnabled: true - acceptedButtons: Qt.LeftButton - onClicked: { - if (model.Connected && model.Paired){ - return + anchors.leftMargin: 0 + anchors.rightMargin: 0 + anchors.topMargin: FishUI.Units.smallSpacing + anchors.bottomMargin: FishUI.Units.smallSpacing + spacing: 0 + + Item { + Layout.fillWidth: true + height: _contentLayout.implicitHeight + FishUI.Units.largeSpacing + + Rectangle { + anchors.fill: parent + radius: FishUI.Theme.smallRadius + color: FishUI.Theme.textColor + opacity: mouseArea.pressed ? 0.15 : mouseArea.containsMouse ? 0.1 : 0.0 } - if (model.Paired) { - bluetoothMgr.connectToDevice(model.Address) - } else { - bluetoothMgr.requestParingConnection(model.Address) + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton + + onClicked: { + if (model.Connected && model.Paired){ + additionalSettings.toggle() + return + } + + if (model.Paired) { + bluetoothMgr.connectToDevice(model.Address) + } else { + bluetoothMgr.requestParingConnection(model.Address) + } + } } - } - } - RowLayout { - id: _itemLayout - anchors.fill: parent - spacing: FishUI.Units.largeSpacing - - Image { - width: 16 - height: 16 - sourceSize: Qt.size(16, 16) - source: FishUI.Theme.darkMode ? "qrc:/images/sidebar/dark/bluetooth.svg" - : "qrc:/images/sidebar/light/bluetooth.svg" - Layout.alignment: Qt.AlignVCenter + RowLayout { + id: _contentLayout + anchors.fill: parent + + Image { + width: 16 + height: 16 + sourceSize: Qt.size(16, 16) + source: FishUI.Theme.darkMode ? "qrc:/images/sidebar/dark/bluetooth.svg" + : "qrc:/images/sidebar/light/bluetooth.svg" + Layout.alignment: Qt.AlignVCenter + } + + Label { + text: model.DeviceFullName + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter + } + } } - Label { - text: model.DeviceFullName - Layout.fillWidth: true + Hideable { + id: additionalSettings + spacing: 0 + + ColumnLayout { + Item { + height: FishUI.Units.largeSpacing + } + + RowLayout { + spacing: FishUI.Units.largeSpacing + Layout.leftMargin: FishUI.Units.smallSpacing + + Button { + text: qsTr("Disconnect") + onClicked: { + bluetoothMgr.deviceDisconnect(model.Address) + additionalSettings.hide() + } + } + + Button { + text: qsTr("Forget This Device") + flat: true + onClicked: { + bluetoothMgr.deviceRemoved(model.Address) + additionalSettings.hide() + } + } + } + } } } } diff --git a/src/qml/SideBar.qml b/src/qml/SideBar.qml index b01b4d2..84da208 100644 --- a/src/qml/SideBar.qml +++ b/src/qml/SideBar.qml @@ -87,6 +87,15 @@ Item { category: qsTr("Network and connection") } + ListElement { + title: qsTr("VPN") + name: "vpn" + page: "qrc:/qml/VPN/Main.qml" + iconSource: "bluetooth.svg" + iconColor: "#0067FF" + category: qsTr("Network and connection") + } + ListElement { title: qsTr("Display") name: "display" diff --git a/src/qml/VPN/Main.qml b/src/qml/VPN/Main.qml new file mode 100644 index 0000000..89726d3 --- /dev/null +++ b/src/qml/VPN/Main.qml @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2021 CutefishOS Team. + * + * Author: revenmartin + * + * 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 of the License, or + * 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 . + */ + +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.12 +import FishUI 1.0 as FishUI +import Cutefish.Settings 1.0 +import "../" + +ItemPage { + headerTitle: qsTr("VPN") + + property bool vpnConnected: false + + function switchVPN(enabled) { + if (enabled) { + vpnConnected = true + } else { + vpnConnected = false + } + } + + Scrollable { + anchors.fill: parent + contentHeight: layout.implicitHeight + + ColumnLayout { + id: layout + anchors.fill: parent + + RoundedItem { + id: mainItem + spacing: FishUI.Units.largeSpacing + + RowLayout { + Label { + text: qsTr("VPN") + color: FishUI.Theme.disabledTextColor + } + + Item { + Layout.fillWidth: true + } + + Switch { + id: vpnSwitch + Layout.fillHeight: true + rightPadding: 0 + onCheckedChanged: {} + } + } + } + + Item { + height: FishUI.Units.smallSpacing + } + } + } +} diff --git a/src/qml/WLAN/WirelessDetailsDialog.qml b/src/qml/WLAN/WirelessDetailsDialog.qml index 92e9f63..b260fc5 100644 --- a/src/qml/WLAN/WirelessDetailsDialog.qml +++ b/src/qml/WLAN/WirelessDetailsDialog.qml @@ -171,7 +171,7 @@ Dialog { RowLayout { id: footerLayout - spacing: FishUI.Theme.hugeRadius / 2 + spacing: FishUI.Units.largeSpacing Button { text: qsTr("Close") diff --git a/src/resources.qrc b/src/resources.qrc index b3963df..3a32491 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -120,5 +120,6 @@ images/logo.png images/dock_straight.svg qml/Bluetooth/PairDialog.qml + qml/VPN/Main.qml diff --git a/src/vpn/nm-l2tp-service.h b/src/vpn/nm-l2tp-service.h new file mode 100644 index 0000000..994abbf --- /dev/null +++ b/src/vpn/nm-l2tp-service.h @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* nm-l2tp-service - L2TP VPN integration with NetworkManager + * + * Dan Williams + * + * Copyright 2008, 2014 Red Hat, Inc. + */ + +#ifndef NM_L2TP_SERVICE_DEFINES_H +#define NM_L2TP_SERVICE_DEFINES_H + +#define NM_DBUS_SERVICE_L2TP "org.freedesktop.NetworkManager.l2tp" + +/* For the NM <-> VPN plugin service */ +#define NM_DBUS_INTERFACE_L2TP "org.freedesktop.NetworkManager.l2tp" +#define NM_DBUS_PATH_L2TP "/org/freedesktop/NetworkManager/l2tp" + +/* For the VPN plugin service <-> PPP plugin */ +#define NM_DBUS_INTERFACE_L2TP_PPP "org.freedesktop.NetworkManager.l2tp.ppp" +#define NM_DBUS_PATH_L2TP_PPP "/org/freedesktop/NetworkManager/l2tp/ppp" + +#define NM_L2TP_KEY_GATEWAY "gateway" +#define NM_L2TP_KEY_USER_AUTH_TYPE "user-auth-type" +#define NM_L2TP_KEY_USER "user" +#define NM_L2TP_KEY_PASSWORD "password" +#define NM_L2TP_KEY_DOMAIN "domain" +#define NM_L2TP_KEY_USER_CA "user-ca" +#define NM_L2TP_KEY_USER_CERT "user-cert" +#define NM_L2TP_KEY_USER_KEY "user-key" +#define NM_L2TP_KEY_USER_CERTPASS "user-certpass" +#define NM_L2TP_KEY_MTU "mtu" +#define NM_L2TP_KEY_MRU "mru" +#define NM_L2TP_KEY_REFUSE_EAP "refuse-eap" +#define NM_L2TP_KEY_REFUSE_PAP "refuse-pap" +#define NM_L2TP_KEY_REFUSE_CHAP "refuse-chap" +#define NM_L2TP_KEY_REFUSE_MSCHAP "refuse-mschap" +#define NM_L2TP_KEY_REFUSE_MSCHAPV2 "refuse-mschapv2" +#define NM_L2TP_KEY_REQUIRE_MPPE "require-mppe" +#define NM_L2TP_KEY_REQUIRE_MPPE_40 "require-mppe-40" +#define NM_L2TP_KEY_REQUIRE_MPPE_128 "require-mppe-128" +#define NM_L2TP_KEY_MPPE_STATEFUL "mppe-stateful" +#define NM_L2TP_KEY_NOBSDCOMP "nobsdcomp" +#define NM_L2TP_KEY_NODEFLATE "nodeflate" +#define NM_L2TP_KEY_NO_VJ_COMP "no-vj-comp" +#define NM_L2TP_KEY_NO_PCOMP "nopcomp" +#define NM_L2TP_KEY_NO_ACCOMP "noaccomp" +#define NM_L2TP_KEY_LCP_ECHO_FAILURE "lcp-echo-failure" +#define NM_L2TP_KEY_LCP_ECHO_INTERVAL "lcp-echo-interval" +#define NM_L2TP_KEY_UNIT_NUM "unit" +#define NM_L2TP_KEY_MACHINE_AUTH_TYPE "machine-auth-type" +#define NM_L2TP_KEY_MACHINE_CA "machine-ca" +#define NM_L2TP_KEY_MACHINE_CERT "machine-cert" +#define NM_L2TP_KEY_MACHINE_KEY "machine-key" +#define NM_L2TP_KEY_MACHINE_CERTPASS "machine-certpass" +#define NM_L2TP_KEY_IPSEC_ENABLE "ipsec-enabled" +#define NM_L2TP_KEY_IPSEC_REMOTE_ID "ipsec-remote-id" +#define NM_L2TP_KEY_IPSEC_GATEWAY_ID "ipsec-gateway-id" /* deprecated, use ipsec-remote-id */ +#define NM_L2TP_KEY_IPSEC_PSK "ipsec-psk" +#define NM_L2TP_KEY_IPSEC_IKE "ipsec-ike" +#define NM_L2TP_KEY_IPSEC_ESP "ipsec-esp" +#define NM_L2TP_KEY_IPSEC_IKELIFETIME "ipsec-ikelifetime" +#define NM_L2TP_KEY_IPSEC_SALIFETIME "ipsec-salifetime" +#define NM_L2TP_KEY_IPSEC_FORCEENCAPS "ipsec-forceencaps" +#define NM_L2TP_KEY_IPSEC_IPCOMP "ipsec-ipcomp" +#define NM_L2TP_KEY_IPSEC_IKEV2 "ipsec-ikev2" +#define NM_L2TP_KEY_IPSEC_PFS "ipsec-pfs" + +/* Internal auth-dialog -> service token indicating that no secrets are required + * for the connection if X.509 private keys are used with no password protection. + */ +#define NM_L2TP_KEY_NOSECRET "no-secret" + +#define NM_L2TP_AUTHTYPE_PASSWORD "password" +#define NM_L2TP_AUTHTYPE_TLS "tls" +#define NM_L2TP_AUTHTYPE_PSK "psk" +#endif /* NM_L2TP_SERVICE_DEFINES_H */ diff --git a/src/vpn/nm-openvpn-service.h b/src/vpn/nm-openvpn-service.h new file mode 100644 index 0000000..b63ab5c --- /dev/null +++ b/src/vpn/nm-openvpn-service.h @@ -0,0 +1,111 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* nm-openvpn-service - openvpn integration with NetworkManager + * + * Copyright (C) 2005 - 2008 Tim Niemueller + * Copyright (C) 2005 - 2008 Dan Williams + * + * 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 2 of the License, 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, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef NM_OPENVPN_SERVICE_H +#define NM_OPENVPN_SERVICE_H + +#define NM_DBUS_SERVICE_OPENVPN "org.freedesktop.NetworkManager.openvpn" +#define NM_DBUS_INTERFACE_OPENVPN "org.freedesktop.NetworkManager.openvpn" +#define NM_DBUS_PATH_OPENVPN "/org/freedesktop/NetworkManager/openvpn" + +#define NM_OPENVPN_KEY_AUTH "auth" +#define NM_OPENVPN_KEY_CA "ca" +#define NM_OPENVPN_KEY_CERT "cert" +#define NM_OPENVPN_KEY_CIPHER "cipher" +#define NM_OPENVPN_KEY_KEYSIZE "keysize" +#define NM_OPENVPN_KEY_COMP_LZO "comp-lzo" +#define NM_OPENVPN_KEY_CONNECTION_TYPE "connection-type" +#define NM_OPENVPN_KEY_FLOAT "float" +#define NM_OPENVPN_KEY_FRAGMENT_SIZE "fragment-size" +#define NM_OPENVPN_KEY_KEY "key" +#define NM_OPENVPN_KEY_LOCAL_IP "local-ip" /* ??? */ +#define NM_OPENVPN_KEY_MSSFIX "mssfix" +#define NM_OPENVPN_KEY_NS_CERT_TYPE "ns-cert-type" +#define NM_OPENVPN_KEY_PING "ping" +#define NM_OPENVPN_KEY_PING_EXIT "ping-exit" +#define NM_OPENVPN_KEY_PING_RESTART "ping-restart" +#define NM_OPENVPN_KEY_PORT "port" +#define NM_OPENVPN_KEY_PROTO_TCP "proto-tcp" +#define NM_OPENVPN_KEY_PROXY_TYPE "proxy-type" +#define NM_OPENVPN_KEY_PROXY_SERVER "proxy-server" +#define NM_OPENVPN_KEY_PROXY_PORT "proxy-port" +#define NM_OPENVPN_KEY_PROXY_RETRY "proxy-retry" +#define NM_OPENVPN_KEY_HTTP_PROXY_USERNAME "http-proxy-username" +#define NM_OPENVPN_KEY_REMOTE "remote" +#define NM_OPENVPN_KEY_REMOTE_RANDOM "remote-random" +#define NM_OPENVPN_KEY_REMOTE_IP "remote-ip" +#define NM_OPENVPN_KEY_STATIC_KEY "static-key" +#define NM_OPENVPN_KEY_STATIC_KEY_DIRECTION "static-key-direction" +#define NM_OPENVPN_KEY_TA "ta" +#define NM_OPENVPN_KEY_TA_DIR "ta-dir" +#define NM_OPENVPN_KEY_TUNNEL_MTU "tunnel-mtu" +#define NM_OPENVPN_KEY_USERNAME "username" +#define NM_OPENVPN_KEY_TAP_DEV "tap-dev" +#define NM_OPENVPN_KEY_DEV "dev" +#define NM_OPENVPN_KEY_DEV_TYPE "dev-type" +#define NM_OPENVPN_KEY_TUN_IPV6 "tun-ipv6" +#define NM_OPENVPN_KEY_TLS_CIPHER "tls-cipher" +#define NM_OPENVPN_KEY_TLS_CRYPT "tls-crypt" +#define NM_OPENVPN_KEY_TLS_REMOTE "tls-remote" +#define NM_OPENVPN_KEY_VERIFY_X509_NAME "verify-x509-name" +#define NM_OPENVPN_KEY_REMOTE_CERT_TLS "remote-cert-tls" +#define NM_OPENVPN_KEY_MAX_ROUTES "max-routes" + +#define NM_OPENVPN_KEY_PASSWORD "password" +#define NM_OPENVPN_KEY_CERTPASS "cert-pass" +#define NM_OPENVPN_KEY_HTTP_PROXY_PASSWORD "http-proxy-password" +/* Internal auth-dialog -> service token indicating that no secrets are + * required for the connection. + */ +#define NM_OPENVPN_KEY_NOSECRET "no-secret" + +#define NM_OPENVPN_KEY_RENEG_SECONDS "reneg-seconds" + +#define NM_OPENVPN_AUTH_NONE "none" +#define NM_OPENVPN_AUTH_RSA_MD4 "RSA-MD4" +#define NM_OPENVPN_AUTH_MD5 "MD5" +#define NM_OPENVPN_AUTH_SHA1 "SHA1" +#define NM_OPENVPN_AUTH_SHA224 "SHA224" +#define NM_OPENVPN_AUTH_SHA256 "SHA256" +#define NM_OPENVPN_AUTH_SHA384 "SHA384" +#define NM_OPENVPN_AUTH_SHA512 "SHA512" +#define NM_OPENVPN_AUTH_RIPEMD160 "RIPEMD160" + +#define NM_OPENVPN_CONTYPE_TLS "tls" +#define NM_OPENVPN_CONTYPE_STATIC_KEY "static-key" +#define NM_OPENVPN_CONTYPE_PASSWORD "password" +#define NM_OPENVPN_CONTYPE_PASSWORD_TLS "password-tls" + +/* arguments of "--remote-cert-tls" */ +#define NM_OPENVPN_REM_CERT_TLS_CLIENT "client" +#define NM_OPENVPN_REM_CERT_TLS_SERVER "server" + +/* arguments of "--ns-cert-type" */ +#define NM_OPENVPN_NS_CERT_TYPE_CLIENT "client" +#define NM_OPENVPN_NS_CERT_TYPE_SERVER "server" + +/* possible types for verify-x509-name */ +#define NM_OPENVPN_VERIFY_X509_NAME_TYPE_SUBJECT "subject" +#define NM_OPENVPN_VERIFY_X509_NAME_TYPE_NAME "name" +#define NM_OPENVPN_VERIFY_X509_NAME_TYPE_NAME_PREFIX "name-prefix" + +#endif /* NM_OPENVPN_SERVICE_H */ diff --git a/src/vpn/nm-pptp-service.h b/src/vpn/nm-pptp-service.h new file mode 100644 index 0000000..e2baf44 --- /dev/null +++ b/src/vpn/nm-pptp-service.h @@ -0,0 +1,56 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* nm-pptp-service - PPTP VPN integration with NetworkManager + * + * Dan Williams + * + * 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 2 of the License, 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, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2008 Red Hat, Inc. //krazy:exclude=copyright + */ + +#ifndef NM_PPTP_SERVICE_H +#define NM_PPTP_SERVICE_H + +#define NM_DBUS_SERVICE_PPTP_PPP "org.freedesktop.NetworkManager.pptp-ppp" +#define NM_DBUS_PATH_PPTP_PPP "/org/freedesktop/NetworkManager/pptp/ppp" +#define NM_DBUS_INTERFACE_PPTP_PPP "org.freedesktop.NetworkManager.pptp.ppp" + + +/* For the NM <-> VPN plugin service */ +#define NM_DBUS_SERVICE_PPTP "org.freedesktop.NetworkManager.pptp" +#define NM_DBUS_INTERFACE_PPTP "org.freedesktop.NetworkManager.pptp" +#define NM_DBUS_PATH_PPTP "/org/freedesktop/NetworkManager/pptp" + +#define NM_PPTP_KEY_GATEWAY "gateway" +#define NM_PPTP_KEY_USER "user" +#define NM_PPTP_KEY_PASSWORD "password" +#define NM_PPTP_KEY_DOMAIN "domain" +#define NM_PPTP_KEY_REFUSE_EAP "refuse-eap" +#define NM_PPTP_KEY_REFUSE_PAP "refuse-pap" +#define NM_PPTP_KEY_REFUSE_CHAP "refuse-chap" +#define NM_PPTP_KEY_REFUSE_MSCHAP "refuse-mschap" +#define NM_PPTP_KEY_REFUSE_MSCHAPV2 "refuse-mschapv2" +#define NM_PPTP_KEY_REQUIRE_MPPE "require-mppe" +#define NM_PPTP_KEY_REQUIRE_MPPE_40 "require-mppe-40" +#define NM_PPTP_KEY_REQUIRE_MPPE_128 "require-mppe-128" +#define NM_PPTP_KEY_MPPE_STATEFUL "mppe-stateful" +#define NM_PPTP_KEY_NOBSDCOMP "nobsdcomp" +#define NM_PPTP_KEY_NODEFLATE "nodeflate" +#define NM_PPTP_KEY_NO_VJ_COMP "no-vj-comp" +#define NM_PPTP_KEY_LCP_ECHO_FAILURE "lcp-echo-failure" +#define NM_PPTP_KEY_LCP_ECHO_INTERVAL "lcp-echo-interval" + + +#endif /* NM_PPTP_PLUGIN_H */ diff --git a/src/vpn/vpn.cpp b/src/vpn/vpn.cpp new file mode 100644 index 0000000..2dc3e92 --- /dev/null +++ b/src/vpn/vpn.cpp @@ -0,0 +1,28 @@ +#include "vpn.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +VPN::VPN(QObject *parent) + : QObject(parent) +{ + +} + +void VPN::activateVPNConnection(const QString &connection, const QString &device, const QString &specificObject) +{ +} diff --git a/src/vpn/vpn.h b/src/vpn/vpn.h new file mode 100644 index 0000000..a71bf0e --- /dev/null +++ b/src/vpn/vpn.h @@ -0,0 +1,16 @@ +#ifndef VPN_H +#define VPN_H + +#include + +class VPN : public QObject +{ + Q_OBJECT + +public: + explicit VPN(QObject *parent = nullptr); + + Q_INVOKABLE void activateVPNConnection(const QString &connection, const QString &device, const QString &specificParameter); +}; + +#endif // VPN_H diff --git a/translations/en_US.ts b/translations/en_US.ts index 835457a..5fb3d82 100644 --- a/translations/en_US.ts +++ b/translations/en_US.ts @@ -468,20 +468,30 @@ - + Bluetooth Bluetooth - + Connected devices - + Available devices + + + Disconnect + + + + + Forget This Device + + @@ -606,6 +616,12 @@ Pointer acceleration + + + + VPN + + PairDialog @@ -656,12 +672,12 @@ SideBar - + User - + Display @@ -674,6 +690,7 @@ + Network and connection @@ -683,26 +700,26 @@ - + Display and appearance - + Appearance Appearance - + Mouse - + Fonts @@ -712,54 +729,59 @@ Bluetooth - - Background + + VPN + Background + + + + Dock - - - + + + System - + Touchpad - + Date & Time - + Language Language - + Battery - + Power - + About About diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 79f45ed..d1b047c 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -468,20 +468,30 @@ - + Bluetooth 蓝牙 - + Connected devices 已连接设备 - + Available devices 可用设备 + + + Disconnect + 断开连接 + + + + Forget This Device + 忽略此设备 + @@ -606,6 +616,12 @@ Pointer acceleration 指针速度 + + + + VPN + VPN + PairDialog @@ -656,7 +672,7 @@ SideBar - + Display 显示 @@ -664,6 +680,7 @@ + Network and connection 网络与连接 @@ -673,41 +690,41 @@ 以太网络 - + Display and appearance 显示与外观 - + Appearance 外观 - + Mouse 鼠标 - + Fonts 字体 - + Dock 程序坞 - + User 用户 - + Background 背景 @@ -722,44 +739,49 @@ 蓝牙 - + + VPN + VPN + + - - + + + System 系统 - + Touchpad 触摸版 - + Date & Time 日期和时间 - + Language 语言 - + Battery 电池 - + Power 电源 - + About 关于