diff --git a/libs/declarative/networkstatus.cpp b/libs/declarative/networkstatus.cpp index 769dfc29..21abd950 100644 --- a/libs/declarative/networkstatus.cpp +++ b/libs/declarative/networkstatus.cpp @@ -1,240 +1,239 @@ /* Copyright 2013 Jan Grulich This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #include "networkstatus.h" #include "uiutils.h" #include #include #include #include NetworkStatus::SortedConnectionType NetworkStatus::connectionTypeToSortedType(NetworkManager::ConnectionSettings::ConnectionType type) { switch (type) { case NetworkManager::ConnectionSettings::Adsl: return NetworkStatus::NetworkStatus::Adsl; break; case NetworkManager::ConnectionSettings::Bluetooth: return NetworkStatus::Bluetooth; break; case NetworkManager::ConnectionSettings::Cdma: return NetworkStatus::Cdma; break; case NetworkManager::ConnectionSettings::Gsm: return NetworkStatus::Gsm; break; case NetworkManager::ConnectionSettings::Infiniband: return NetworkStatus::Infiniband; break; case NetworkManager::ConnectionSettings::OLPCMesh: return NetworkStatus::OLPCMesh; break; case NetworkManager::ConnectionSettings::Pppoe: return NetworkStatus::Pppoe; break; case NetworkManager::ConnectionSettings::Vpn: return NetworkStatus::Vpn; break; case NetworkManager::ConnectionSettings::Wired: return NetworkStatus::Wired; break; case NetworkManager::ConnectionSettings::Wireless: return NetworkStatus::Wireless; break; default: return NetworkStatus::Other; break; } } NetworkStatus::NetworkStatus(QObject* parent) : QObject(parent) { connect(NetworkManager::notifier(), &NetworkManager::Notifier::statusChanged, this, &NetworkStatus::statusChanged); connect(NetworkManager::notifier(), &NetworkManager::Notifier::activeConnectionsChanged, this, QOverload<>::of(&NetworkStatus::activeConnectionsChanged)); activeConnectionsChanged(); statusChanged(NetworkManager::status()); } NetworkStatus::~NetworkStatus() { } QString NetworkStatus::activeConnections() const { return m_activeConnections; } QString NetworkStatus::networkStatus() const { return m_networkStatus; } void NetworkStatus::activeConnectionsChanged() { Q_FOREACH (const NetworkManager::ActiveConnection::Ptr & active, NetworkManager::activeConnections()) { connect(active.data(), &NetworkManager::ActiveConnection::default4Changed, this, &NetworkStatus::defaultChanged, Qt::UniqueConnection); connect(active.data(), &NetworkManager::ActiveConnection::default6Changed, this, &NetworkStatus::defaultChanged, Qt::UniqueConnection); connect(active.data(), &NetworkManager::ActiveConnection::stateChanged, this, &NetworkStatus::changeActiveConnections); } changeActiveConnections(); } void NetworkStatus::defaultChanged() { statusChanged(NetworkManager::status()); } void NetworkStatus::statusChanged(NetworkManager::Status status) { switch (status) { case NetworkManager::ConnectedLinkLocal: m_networkStatus = i18nc("A network device is connected, but there is only link-local connectivity", "Connected"); break; case NetworkManager::ConnectedSiteOnly: m_networkStatus = i18nc("A network device is connected, but there is only site-local connectivity", "Connected"); break; case NetworkManager::Connected: m_networkStatus = i18nc("A network device is connected, with global network connectivity", "Connected"); break; case NetworkManager::Asleep: m_networkStatus = i18nc("Networking is inactive and all devices are disabled", "Inactive"); break; case NetworkManager::Disconnected: m_networkStatus = i18nc("There is no active network connection", "Disconnected"); break; case NetworkManager::Disconnecting: m_networkStatus = i18nc("Network connections are being cleaned up", "Disconnecting"); break; case NetworkManager::Connecting: m_networkStatus = i18nc("A network device is connecting to a network and there is no other available network connection", "Connecting"); break; default: m_networkStatus = checkUnknownReason(); break; } if (status == NetworkManager::ConnectedLinkLocal || status == NetworkManager::ConnectedSiteOnly || status == NetworkManager::Connected) { changeActiveConnections(); } else { m_activeConnections = m_networkStatus; Q_EMIT activeConnectionsChanged(m_activeConnections); } Q_EMIT networkStatusChanged(m_networkStatus); } void NetworkStatus::changeActiveConnections() { if (NetworkManager::status() != NetworkManager::Connected && NetworkManager::status() != NetworkManager::ConnectedLinkLocal && NetworkManager::status() != NetworkManager::ConnectedSiteOnly) { return; } QString activeConnections; const QString format = QStringLiteral("%1: %2"); QList activeConnectionList = NetworkManager::activeConnections(); std::sort(activeConnectionList.begin(), activeConnectionList.end(), [] (const NetworkManager::ActiveConnection::Ptr &left, const NetworkManager::ActiveConnection::Ptr &right) { return NetworkStatus::connectionTypeToSortedType(left->type()) < NetworkStatus::connectionTypeToSortedType(right->type()); }); Q_FOREACH (const NetworkManager::ActiveConnection::Ptr & active, activeConnectionList) { if (!active->devices().isEmpty() && UiUtils::isConnectionTypeSupported(active->type())) { NetworkManager::Device::Ptr device = NetworkManager::findNetworkInterface(active->devices().first()); #if NM_CHECK_VERSION(0, 9, 10) if (device && device->type() != NetworkManager::Device::Generic && device->type() <= NetworkManager::Device::Team) { #else if (device) { #endif bool connecting = false; bool connected = false; QString conType; QString status; NetworkManager::VpnConnection::Ptr vpnConnection; if (active->vpn()) { conType = i18n("VPN"); vpnConnection = active.objectCast(); } else { conType = UiUtils::interfaceTypeLabel(device->type(), device); } if (vpnConnection && active->vpn()) { if (vpnConnection->state() >= NetworkManager::VpnConnection::Prepare && vpnConnection->state() <= NetworkManager::VpnConnection::GettingIpConfig) { connecting = true; } else if (vpnConnection->state() == NetworkManager::VpnConnection::Activated) { connected = true; } } else { if (active->state() == NetworkManager::ActiveConnection::Activated) { connected = true; } else if (active->state() == NetworkManager::ActiveConnection::Activating) { connecting = true; } } NetworkManager::Connection::Ptr connection = active->connection(); - const QString connectionName = connection->name().replace('&', "&").replace('<', "<").replace('>', ">"); if (connecting) { - status = i18n("Connecting to %1", connectionName); + status = i18n("Connecting to %1", connection->name()); } else if (connected) { - status = i18n("Connected to %1", connectionName); + status = i18n("Connected to %1", connection->name()); } if (!activeConnections.isEmpty()) { activeConnections += '\n'; } activeConnections += format.arg(conType, status); connect(connection.data(), &NetworkManager::Connection::updated, this, &NetworkStatus::changeActiveConnections, Qt::UniqueConnection); } } } m_activeConnections = activeConnections; Q_EMIT activeConnectionsChanged(activeConnections); } QString NetworkStatus::checkUnknownReason() const { // Check if NetworkManager is running. if (!QDBusConnection::systemBus().interface()->isServiceRegistered(NM_DBUS_INTERFACE)) { return i18n("NetworkManager not running"); } // Check for compatible NetworkManager version. if (NetworkManager::compareVersion(0, 9, 8) < 0) { return i18n("NetworkManager 0.9.8 required, found %1.", NetworkManager::version()); } return i18nc("global connection state", "Unknown"); } diff --git a/vpn/fortisslvpn/plasmanetworkmanagement_fortisslvpnui.desktop b/vpn/fortisslvpn/plasmanetworkmanagement_fortisslvpnui.desktop index 0fe3fccb..fdf3ae55 100644 --- a/vpn/fortisslvpn/plasmanetworkmanagement_fortisslvpnui.desktop +++ b/vpn/fortisslvpn/plasmanetworkmanagement_fortisslvpnui.desktop @@ -1,86 +1,86 @@ [Desktop Entry] Type=Service Icon= ServiceTypes=PlasmaNetworkManagement/VpnUiPlugin X-KDE-Library=plasmanetworkmanagement_fortisslvpnui X-NetworkManager-Services=org.freedesktop.NetworkManager.fortisslvpn X-KDE-PluginInfo-Author=Jan Grulich X-KDE-PluginInfo-Email=jgrulich@redhat.com X-KDE-PluginInfo-Name=plasmanetworkmanagement_fortisslvpnui X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website= X-KDE-PluginInfo-Category=VPNService X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false Name=Fortinet SSLVPN (fortisslvpn) Name[ca]=Fortinet SSLVPN (fortisslvpn) Name[ca@valencia]=Fortinet SSLVPN (fortisslvpn) Name[da]=Fortinet SSLVPN (fortisslvpn) Name[de]=Fortinet SSLVPN (fortisslvpn) Name[el]=Fortinet SSLVPN (fortisslvpn) Name[en_GB]=Fortinet SSLVPN (fortisslvpn) Name[es]=SSLVPN de Fortinet (fortisslvpn) Name[eu]=Fortinet SSLVPN (fortisslvpn) Name[fi]=Fortinet SSLVPN (fortisslvpn) Name[fr]=SSLVPN Fortinet (fortisslvpn) Name[gl]=VPN SSL de Fortinet (fortisslvpn) Name[hu]=Fortinet SSLVPN (fortisslvpn) Name[id]=Fortinet SSLVPN (fortisslvpn) Name[it]=Fortinet SSLVPN (fortisslvpn) Name[ko]=Fortinet SSLVPN (fortisslvpn) Name[nl]=Fortinet SSLVPN (fortisslvpn) Name[nn]=Fortinet SSLVPN (fortisslvpn) Name[pa]=ਫੋਰਟੀਨੈੱਟ SSLVPN (fortisslvpn) Name[pl]=Fortinet SSLVPN (fortisslvpn) Name[pt]=SSLVPN do Fortinet (fortisslvpn) Name[pt_BR]=Fortinet SSLVPN (fortisslvpn) Name[ru]=Fortinet SSLVPN (fortisslvpn) Name[sk]=Fortinet SSLVPN (fortisslvpn) Name[sl]=Fortinet SSLVPN (fortisslvpn) Name[sr]=Фортинетов ССЛ ВПН Name[sr@ijekavian]=Фортинетов ССЛ ВПН Name[sr@ijekavianlatin]=Fortinetov SSL VPN Name[sr@latin]=Fortinetov SSL VPN Name[sv]=Fortinet SSLVPN (fortisslvpn) Name[tr]=Fortinet SSLVPN (fortisslvpn) Name[uk]=Fortinet SSLVPN (fortisslvpn) Name[x-test]=xxFortinet SSLVPN (fortisslvpn)xx Name[zh_CN]=Fortinet SSLVPN (fortisslvpn) Name[zh_TW]=Fortinet SSLVPN (fortisslvpn) Comment=Fortinet SSLVPN virtual private networks Comment[ca]=Xarxes privades virtuals Fortinet SSLVPN Comment[ca@valencia]=Xarxes privades virtuals Fortinet SSLVPN Comment[da]=Fortinet SSLVPN virtuelle private netværk Comment[de]=Virtuelles privates Netzwerk Fortinet-SSLVPN Comment[el]=Εικονικά ιδωτικά δίκτυα Fortinet SSLVPN Comment[en_GB]=Fortinet SSLVPN virtual private networks Comment[es]=Redes privadas virtuales SSLVPN de Fortinet Comment[eu]=Fortinet SSLVPN alegiazko sare pribatuak Comment[fi]=Fortinet SSLVPN -virtuaaliyksityisverkot Comment[fr]=Réseaux privés virtuels SSLVPN Fortinet Comment[gl]=Redes privadas virtuais SSL de Fortinet Comment[hu]=Fortinet SSLVPN virtuális magánhálózat Comment[id]=Network privat virtual Fortinet SSLVPN Comment[it]=Reti private virtuali Fortinet SSLVPN Comment[ko]=Fortinet SSLVPN 가상 개인 네트워크 Comment[nl]=Fortinet SSLVPN virtuele private netwerken Comment[nn]=Fortinet SSLVPN virtuelle private nettverk Comment[pa]=ਫੋਰਟੀਨੈੱਟ SSLVPN ਵਰਚੁਅਲ ਪਰਾਈਵੇਟ ਨੈੱਟਵਰਕ Comment[pl]=Fortinet SSLVPN wirtualne prywatne sieci Comment[pt]=Redes privadas virtuais do SSLVPN do Fortinet Comment[pt_BR]=Redes privadas virtuais Fortinet SSLVPN Comment[ru]=Виртуальные частные сети Fortinet SSLVPN Comment[sk]=Virtuálne privátne siete Fortinet SSLVPN Comment[sl]=Navidezna zasebna omrežja Fortinet SSLVPN Comment[sr]=Виртуелне приватне мреже преко Фортинетовог ССЛ ВПН‑а Comment[sr@ijekavian]=Виртуелне приватне мреже преко Фортинетовог ССЛ ВПН‑а Comment[sr@ijekavianlatin]=Virtuelne privatne mreže preko Fortinetovog SSL VPN‑a Comment[sr@latin]=Virtuelne privatne mreže preko Fortinetovog SSL VPN‑a Comment[sv]=Fortinet SSLVPN virtuella privata nätverk Comment[tr]=Fortinet SSLVPN sanal özel ağlar Comment[uk]=Віртуальні приватні мережі SSLVPN Fortinet Comment[x-test]=xxFortinet SSLVPN virtual private networksxx -Comment[zh_CN]=Fortinet SSLVPN 虚拟专网 +Comment[zh_CN]=Fortinet SSLVPN 虛拟私人网络 Comment[zh_TW]=Fortinet SSLVPN 虛擬私人網路 diff --git a/vpn/openconnect/CMakeLists.txt b/vpn/openconnect/CMakeLists.txt index cf43740d..c3f07088 100644 --- a/vpn/openconnect/CMakeLists.txt +++ b/vpn/openconnect/CMakeLists.txt @@ -1,67 +1,71 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasmanetworkmanagement_openconnectui\") set (MINIMUM_OPENCONNECT_VERSION_REQUIRED "3.99") set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH}) find_package(OpenConnect ${MINIMUM_OPENCONNECT_VERSION_REQUIRED} MODULE) if (OPENCONNECT_FOUND) + + find_package(Qt5Xml ${QT_MIN_VERSION} CONFIG REQUIRED) + if (${OPENCONNECT_VERSION} VERSION_LESS "3.99") # macro_optional_find_package(OpenSSL) # macro_log_feature(OpenSSL_FOUND "OpenSSL headers" "Encryption suite" "http://www.openssl.org" FALSE "" "Needed for OpenConnect support in Network Management") find_package(OpenSSL) set_package_properties(OpenSSL PROPERTIES DESCRIPTION "Encryption suite" URL "http://www.openssl.org" TYPE OPTIONAL ) if (OpenSSL_FOUND) set (MINIMUM_OPENCONNECT_VERSION_REQUIRED "3.03") set (maybe_OPENSSL_LIBRARIES ${OpenSSL_LIBRARIES}) endif() endif() if (${OPENCONNECT_VERSION} VERSION_GREATER ${MINIMUM_OPENCONNECT_VERSION_REQUIRED} OR ${OPENCONNECT_VERSION} VERSION_EQUAL ${MINIMUM_OPENCONNECT_VERSION_REQUIRED}) include_directories(${OPENCONNECT_INCLUDE_DIRS}) set(openconnect_SRCS ../../libs/debug.cpp openconnectui.cpp openconnectwidget.cpp openconnectauth.cpp openconnectauthworkerthread.cpp ) ki18n_wrap_ui(openconnect_SRCS openconnectprop.ui openconnectauth.ui) add_library(plasmanetworkmanagement_openconnectui ${openconnect_SRCS}) target_link_libraries(plasmanetworkmanagement_openconnectui plasmanm_internal plasmanm_editor ${NETWORKMANAGERQT5_LDFLAGS} KF5::I18n KF5::WidgetsAddons KF5::IconThemes KF5::KIOWidgets KF5::CoreAddons + Qt5::Xml ${OPENCONNECT_LIBRARIES} ${maybe_OPENSSL_LIBRARIES} ) install(TARGETS plasmanetworkmanagement_openconnectui DESTINATION ${KDE_INSTALL_PLUGINDIR}) install(FILES plasmanetworkmanagement_openconnectui.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) install(FILES plasmanetworkmanagement_openconnect_juniperui.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) else() message("ERROR: OpenConnection version '${OPENCONNECT_VERSION}' does not match minimum required (${MINIMUM_OPENCONNECT_VERSION_REQUIRED})") message("OpenConnect plugin will not be built") set(OPENCONNECT_FOUND False) endif() else (OPENCONNECT_FOUND) message("OpenConnect plugin will not be built") endif (OPENCONNECT_FOUND) #macro_log_feature(OPENCONNECT_FOUND "OpenConnect headers and library" "Cisco AnyConnect compatible VPN client" "http://www.infradead.org/openconnect.html" FALSE ${MINIMUM_OPENCONNECT_VERSION_REQUIRED} "Needed for OpenConnect support in Plasma NM")