diff --git a/applet/contents/config/config.qml b/applet/contents/config/config.qml deleted file mode 100644 --- a/applet/contents/config/config.qml +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright 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.0 - -import org.kde.plasma.configuration 2.0 - -ConfigModel { - id: configModel - - ConfigCategory { - name: i18n("General") - icon: "plasma" - source: "configGeneral.qml" - } -} diff --git a/applet/contents/config/main.xml b/applet/contents/config/main.xml deleted file mode 100644 --- a/applet/contents/config/main.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - true - - - - false - - - - diff --git a/applet/contents/ui/configGeneral.qml b/applet/contents/ui/configGeneral.qml deleted file mode 100644 --- a/applet/contents/ui/configGeneral.qml +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright 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.5 -import QtQuick.Controls 2.5 as QQC2 - -import org.kde.kirigami 2.5 as Kirigami - -Kirigami.FormLayout { - id: generalPage - - anchors.left: parent.left - anchors.right: parent.right - - signal configurationChanged - - property alias cfg_unlockModemOnDetection: unlockModem.checked - property alias cfg_manageVirtualConnections: manageVirtualConnections.checked - - QQC2.CheckBox { - id: unlockModem - text: i18n("Ask for PIN on modem detection") - onClicked: { - generalPage.configurationChanged() - } - } - - QQC2.CheckBox { - id: manageVirtualConnections - text: i18n("Show virtual connections") - onClicked: { - generalPage.configurationChanged() - } - } -} diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -47,17 +47,17 @@ function action_openKCM() { KCMShell.open(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"); @@ -84,10 +84,4 @@ onTriggered: handler.requestScan() } - - PlasmaNM.Configuration { - id: configuration - unlockModemOnDetection: plasmoid.configuration.unlockModemOnDetection - manageVirtualConnections: plasmoid.configuration.manageVirtualConnections - } } diff --git a/kcm/CMakeLists.txt b/kcm/CMakeLists.txt --- a/kcm/CMakeLists.txt +++ b/kcm/CMakeLists.txt @@ -30,8 +30,9 @@ install( FILES kcm_networkmanagement.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) install( FILES + qml/AddConnectionDialog.qml + qml/ConfigurationDialog.qml qml/ConnectionItem.qml - qml/Dialog.qml qml/Header.qml qml/ListItem.qml qml/main.qml diff --git a/kcm/qml/Dialog.qml b/kcm/qml/AddConnectionDialog.qml rename from kcm/qml/Dialog.qml rename to kcm/qml/AddConnectionDialog.qml diff --git a/kcm/qml/ConfigurationDialog.qml b/kcm/qml/ConfigurationDialog.qml new file mode 100644 --- /dev/null +++ b/kcm/qml/ConfigurationDialog.qml @@ -0,0 +1,109 @@ +/* + Copyright 2019 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.5 +import QtQuick.Dialogs 1.2 +import QtQuick.Controls 2.5 as QQC2 +import org.kde.kirigami 2.5 as Kirigami +import org.kde.plasma.networkmanagement 0.2 as PlasmaNM + +Dialog { + id: configurationDialog + standardButtons: Dialog.Ok | Dialog.Cancel + title: i18nc("@title:window", "Configuration") + + PlasmaNM.Configuration { + id: configuration + } + + contentItem: Item { + implicitHeight: 200 + implicitWidth: 400 + + Rectangle { + id: background + anchors.fill: parent + focus: true + color: baseColor + } + + Kirigami.FormLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: units.gridUnit + + QQC2.CheckBox { + id: unlockModem + text: i18n("Ask for PIN on modem detection") + onClicked: okButton.enabled = true + Component.onCompleted: checked = configuration.unlockModemOnDetection + } + + QQC2.CheckBox { + id: manageVirtualConnections + text: i18n("Show virtual connections") + onClicked: okButton.enabled = true + Component.onCompleted: checked = configuration.manageVirtualConnections + } + } + + Row { + id: buttonRow + anchors { + bottom: parent.bottom + right: parent.right + margins: units.smallSpacing + } + spacing: units.smallSpacing + + QQC2.Button { + id: okButton + enabled: false + text: i18n("Ok") + + onClicked: { + configurationDialog.accept() + } + } + + QQC2.Button { + id: cancelButton + text: i18n("Cancel") + + onClicked: { + configurationDialog.close() + } + } + } + } + + onVisibleChanged: { + if (visible) { + unlockModem.checked = configuration.unlockModemOnDetection + manageVirtualConnections.checked = configuration.manageVirtualConnections + } + } + + onAccepted: { + configuration.unlockModemOnDetection = unlockModem.checked + configuration.manageVirtualConnections = manageVirtualConnections.checked + } +} + diff --git a/kcm/qml/main.qml b/kcm/qml/main.qml --- a/kcm/qml/main.qml +++ b/kcm/qml/main.qml @@ -78,8 +78,8 @@ Component.onCompleted: background.visible = true // show frame anchors { - bottom: buttonRow.top - bottomMargin: Math.round(units.gridUnit / 3) + bottom: rightButtonRow.top + bottomMargin: units.smallSpacing left: parent.left right: parent.right top: searchField.bottom @@ -131,23 +131,22 @@ } Row { - id: buttonRow + id: rightButtonRow anchors { bottom: parent.bottom right: parent.right - margins: Math.round(units.gridUnit / 3) + margins: units.smallSpacing } - spacing: Math.round(units.gridUnit / 2) + spacing: units.smallSpacing QQC2.ToolButton { id: addConnectionButton icon.name: "list-add" - QQC2.ToolTip { - text: i18n("Add new connection") - } + QQC2.ToolTip.text: i18n("Add new connection") + QQC2.ToolTip.visible: hovered onClicked: { addNewConnectionDialog.open() @@ -160,9 +159,8 @@ enabled: connectionView.currentConnectionPath && connectionView.currentConnectionPath.length icon.name: "list-remove" - QQC2.ToolTip { - text: i18n("Remove selected connection") - } + QQC2.ToolTip.text: i18n("Remove selected connection") + QQC2.ToolTip.visible: hovered onClicked: { deleteConfirmationDialog.connectionName = connectionView.currentConnectionName @@ -177,16 +175,39 @@ enabled: connectionView.currentConnectionExportable icon.name: "document-export" - QQC2.ToolTip { - text: i18n("Export selected connection") - } + QQC2.ToolTip.text: i18n("Export selected connection") + QQC2.ToolTip.visible: hovered onClicked: { root.requestExportConnection(connectionView.currentConnectionPath) } } } + Row { + id: leftButtonRow + + anchors { + bottom: parent.bottom + left: parent.left + margins: units.smallSpacing + } + spacing: units.smallSpacing + + QQC2.ToolButton { + id: configureButton + + icon.name: "configure" + + QQC2.ToolTip.text: i18n("Configuration") + QQC2.ToolTip.visible: hovered + + onClicked: { + configurationDialog.open() + } + } + } + MessageDialog { id: deleteConfirmationDialog @@ -207,14 +228,18 @@ } } - Dialog { + AddConnectionDialog { id: addNewConnectionDialog onRequestCreateConnection: { root.requestCreateConnection(type, vpnType, specificType, shared) } } + ConfigurationDialog { + id: configurationDialog + } + function deselectConnections() { connectionView.currentConnectionPath = "" }