diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b12916b..55fa2d81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,135 +1,135 @@ cmake_minimum_required(VERSION 3.0) project(plasma-networkmanagement) set(PROJECT_VERSION "5.19.80") set(PROJECT_VERSION_MAJOR 5) set(QT_MIN_VERSION "5.14.0") -set(KF5_MIN_VERSION "5.66.0") +set(KF5_MIN_VERSION "5.71.0") set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED On) ################# set KDE specific information ################# find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDEClangFormat) include(ECMQMLModules) include(FeatureSummary) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core DBus Network Quick QuickWidgets Widgets ) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED ConfigWidgets Completion CoreAddons Declarative DBusAddons KIO I18n IconThemes NetworkManagerQt Notifications Plasma Service Solid Wallet WidgetsAddons WindowSystem ) find_package(KF5ModemManagerQt ${KF5_MIN_VERSION}) set_package_properties(KF5ModemManagerQt PROPERTIES TYPE OPTIONAL) ecm_find_qmlmodule(org.kde.prison 1.0) find_package(KF5Kirigami2 ${KF5_MIN_VERSION} CONFIG) set_package_properties(KF5Kirigami2 PROPERTIES DESCRIPTION "A QtQuick based components set" PURPOSE "Required at runtime by the KCMs" TYPE RUNTIME ) # Required only for getting information about NetworkManager version in CMake find_package(NetworkManager 1.4.0) set_package_properties(NetworkManager PROPERTIES TYPE REQUIRED) find_package(MobileBroadbandProviderInfo) set_package_properties(MobileBroadbandProviderInfo PROPERTIES DESCRIPTION "Database of mobile broadband service providers" URL "https://wiki.gnome.org/action/show/Projects/NetworkManager/MobileBroadband/ServiceProviders" TYPE OPTIONAL) find_package(Qca-qt5 2.1.0) set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Support for encryption" URL "https://download.kde.org/stable/qca-qt5/" TYPE REQUIRED) find_package(KF5Prison ${KF5_MIN_VERSION}) set_package_properties(KF5Prison PROPERTIES DESCRIPTION "Prison library" URL "https://commits.kde.org/prison" TYPE RUNTIME PURPOSE "Needed to create mobile barcodes for WiFi networks" ) if (DISABLE_MODEMMANAGER_SUPPORT) message(STATUS "Disabling ModemManager support") set(WITH_MODEMMANAGER_SUPPORT 0) else() if (KF5ModemManagerQt_FOUND) message(STATUS "Enabling ModemManager support") set(WITH_MODEMMANAGER_SUPPORT 1) else() message(STATUS "ModemManager or ModemManagerQt not found") set(WITH_MODEMMANAGER_SUPPORT 0) endif() endif() add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) add_definitions(-DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY) add_definitions(-DWITH_MODEMMANAGER_SUPPORT=${WITH_MODEMMANAGER_SUPPORT}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs ${CMAKE_CURRENT_SOURCE_DIR}/libs/editor/) add_subdirectory(applet) add_subdirectory(kded) add_subdirectory(kcm) add_subdirectory(libs) add_subdirectory(vpn) if (BUILD_MOBILE) add_subdirectory(mobile) endif() # Enable unit testing if (BUILD_TESTING) add_subdirectory(tests) endif() # add clang-format target for all our real source files file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/applet/contents/ui/Toolbar.qml b/applet/contents/ui/Toolbar.qml index 700bb0b1..1e29578f 100644 --- a/applet/contents/ui/Toolbar.qml +++ b/applet/contents/ui/Toolbar.qml @@ -1,250 +1,250 @@ /* Copyright 2013-2017 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 . */ import QtQuick 2.2 import QtQuick.Layouts 1.2 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.kquickcontrolsaddons 2.0 ColumnLayout { id: toolbar spacing: units.smallSpacing readonly property var displayWifiMessage: !wifiSwitchButton.checked && wifiSwitchButton.visible readonly property var displayWwanMessage: !wwanSwitchButton.checked && wwanSwitchButton.visible readonly property var displayplaneModeMessage: planeModeSwitchButton.checked && planeModeSwitchButton.visible function closeSearch() { searchToggleButton.checked = false } PlasmaCore.Svg { id: lineSvg imagePath: "widgets/line" } PlasmaNM.EnabledConnections { id: enabledConnections onWirelessEnabledChanged: { wifiSwitchButton.checked = wifiSwitchButton.enabled && enabled } onWirelessHwEnabledChanged: { wifiSwitchButton.enabled = enabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled } onWwanEnabledChanged: { wwanSwitchButton.checked = wwanSwitchButton.enabled && enabled } onWwanHwEnabledChanged: { wwanSwitchButton.enabled = enabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled } } PlasmaNM.Configuration { id: configuration } RowLayout { spacing: units.smallSpacing SwitchButton { id: wifiSwitchButton checked: enabled && enabledConnections.wirelessEnabled enabled: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled tooltip: i18n("Enable wireless") icon: enabled ? "network-wireless-on" : "network-wireless-off" visible: availableDevices.wirelessDeviceAvailable onClicked: { handler.enableWireless(checked); } } SwitchButton { id: wwanSwitchButton checked: enabled && enabledConnections.wwanEnabled enabled: enabledConnections.wwanHwEnabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled tooltip: i18n("Enable mobile network") icon: enabled ? "network-mobile-on" : "network-mobile-off" visible: availableDevices.modemDeviceAvailable onClicked: { handler.enableWwan(checked); } } SwitchButton { id: planeModeSwitchButton property bool initialized: false property bool airplaneModeEnabled: false checked: airplaneModeEnabled tooltip: i18n("Enable airplane mode") icon: airplaneModeEnabled ? "network-flightmode-on" : "network-flightmode-off" visible: availableDevices.modemDeviceAvailable || availableDevices.wirelessDeviceAvailable onClicked: { handler.enableAirplaneMode(checked); airplaneModeEnabled = !airplaneModeEnabled; } Binding { target: configuration property: "airplaneModeEnabled" value: planeModeSwitchButton.airplaneModeEnabled when: planeModeSwitchButton.initialized } Component.onCompleted: { airplaneModeEnabled = configuration.airplaneModeEnabled initialized = true } } Item { Layout.fillWidth: true } PlasmaComponents3.ToolButton { id: hotspotButton icon { height: units.iconSizes.small width: units.iconSizes.small name: "network-wireless-on" } checkable: true text: i18n("Hotspot") visible: handler.hotspotSupported onClicked: { if (configuration.hotspotConnectionPath) { checked = false handler.stopHotspot() } else { checked = true handler.createHotspot() } } PlasmaComponents3.ToolTip { id: tooltip } Connections { target: handler onHotspotCreated: { hotspotButton.checked = true tooltip.text = i18n("Disable Hotspot") } onHotspotDisabled: { hotspotButton.checked = false tooltip.text = i18n("Create Hotspot") } } Component.onCompleted: { checked = configuration.hotspotConnectionPath tooltip.text = configuration.hotspotConnectionPath ? i18n("Disable Hotspot") : i18n("Create Hotspot") } } PlasmaComponents3.ToolButton { id: searchToggleButton icon { height: units.iconSizes.small width: units.iconSizes.small name: "search" } checkable: true PlasmaComponents3.ToolTip { text: i18ndc("plasma-nm", "button tooltip", "Search the connections") } } PlasmaComponents3.ToolButton { id: openEditorButton icon { height: units.iconSizes.small width: units.iconSizes.small name: "configure" } visible: mainWindow.kcmAuthorized PlasmaComponents3.ToolTip { text: i18n("Configure network connections...") } onClicked: { - KCMShell.open(mainWindow.kcm) + KCMShell.openSystemSettings(mainWindow.kcm) } } } PlasmaComponents.TextField { id: searchTextField Layout.fillWidth: true Layout.leftMargin: units.smallSpacing Layout.rightMargin: units.smallSpacing Layout.topMargin: units.smallSpacing Layout.bottomMargin: units.smallSpacing focus: true clearButtonShown: true placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") visible: searchToggleButton.checked onVisibleChanged: { if (visible) { searchTextField.forceActiveFocus() } else { text = "" } } Keys.onEscapePressed: { //Check if the searchbar is actually visible before accepting the escape key. Otherwise, the escape key cannot dismiss the applet until one interacts with some other element. if (searchToggleButton.checked) { searchToggleButton.checked = false; } else { event.accepted = false; } } onTextChanged: { // Show search field when starting to type directly if (text.length && !searchToggleButton.checked) { searchToggleButton.checked = true } appletProxyModel.setFilterRegExp(text) } } } diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml index d2eafb7e..9f48699c 100644 --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -1,86 +1,86 @@ /* Copyright 2013-2017 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 . */ import QtQuick 2.2 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.kquickcontrolsaddons 2.0 import QtQuick.Layouts 1.1 Item { id: mainWindow - readonly property string kcm: "kcm_networkmanagement.desktop" - readonly property bool kcmAuthorized: KCMShell.authorize(kcm).length == 1 + readonly property string kcm: "kcm_networkmanagement" + readonly property bool kcmAuthorized: KCMShell.authorize("kcm_networkmanagement.desktop").length == 1 Plasmoid.toolTipMainText: i18n("Networks") Plasmoid.toolTipSubText: networkStatus.activeConnections Plasmoid.icon: connectionIconProvider.connectionTooltipIcon Plasmoid.switchWidth: units.gridUnit * 10 Plasmoid.switchHeight: units.gridUnit * 10 Plasmoid.compactRepresentation: CompactRepresentation { } Plasmoid.fullRepresentation: PopupDialog { id: dialogItem Layout.minimumWidth: units.iconSizes.medium * 10 Layout.minimumHeight: units.gridUnit * 20 anchors.fill: parent focus: true } function action_openKCM() { - KCMShell.open(kcm) + KCMShell.openSystemSettings(kcm) } function action_showPortal() { Qt.openUrlExternally("http://networkcheck.kde.org") } Component.onCompleted: { if (kcmAuthorized) { plasmoid.setAction("openKCM", i18n("&Configure Network Connections..."), "preferences-system-network"); } plasmoid.removeAction("configure"); plasmoid.setAction("showPortal", i18n("Open Network Login Page..."), "internet-services"); var action = plasmoid.action("showPortal"); action.visible = Qt.binding(function() { return connectionIconProvider.needsPortal; }) } PlasmaNM.NetworkStatus { id: networkStatus } PlasmaNM.ConnectionIcon { id: connectionIconProvider } PlasmaNM.Handler { id: handler } Timer { id: scanTimer interval: 10200 repeat: true running: plasmoid.expanded && !connectionIconProvider.airplaneMode onTriggered: handler.requestScan() } }