Commit 7601936e authored by Jan Grulich's avatar Jan Grulich
Browse files

Move applet configuration to KCM

Summary:
It doesn't make sense to have additional applet configuration, especially when
the configuration is not related only to the applet.

BUG:  407561

Reviewers: ngraham, #plasma

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26041
parent b91f05b7
/*
Copyright 2017 Jan Grulich <jgrulich@redhat.com>
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 <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
id: configModel
ConfigCategory {
name: i18n("General")
icon: "plasma"
source: "configGeneral.qml"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="unlockModemOnDetection" type="Bool">
<label>If true request PIN code as soon as modem is detected.</label>
<default>true</default>
</entry>
<entry name="manageVirtualConnections" type="Bool">
<label>If true plasma-nm will be able to show and configure virtual connections.</label>
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -47,9 +47,8 @@ Item {
function action_openKCM() {
KCMShell.open(kcm)
}
function action_showPortal() {
Qt.openUrlExternally("http://networkcheck.kde.org")
}
......@@ -58,6 +57,7 @@ Item {
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 @@ Item {
onTriggered: handler.requestScan()
}
PlasmaNM.Configuration {
id: configuration
unlockModemOnDetection: plasmoid.configuration.unlockModemOnDetection
manageVirtualConnections: plasmoid.configuration.manageVirtualConnections
}
}
......@@ -30,8 +30,9 @@ install(TARGETS kcm_networkmanagement DESTINATION ${KDE_INSTALL_PLUGINDIR} )
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
......
/*
Copyright 2017 Jan Grulich <jgrulich@redhat.com>
Copyright 2019 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -19,34 +19,91 @@
*/
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 {
id: generalPage
Kirigami.FormLayout {
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: units.gridUnit
anchors.left: parent.left
anchors.right: parent.right
QQC2.CheckBox {
id: unlockModem
text: i18n("Ask for PIN on modem detection")
onClicked: okButton.enabled = true
Component.onCompleted: checked = configuration.unlockModemOnDetection
}
signal configurationChanged
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()
}
}
property alias cfg_unlockModemOnDetection: unlockModem.checked
property alias cfg_manageVirtualConnections: manageVirtualConnections.checked
QQC2.Button {
id: cancelButton
text: i18n("Cancel")
QQC2.CheckBox {
id: unlockModem
text: i18n("Ask for PIN on modem detection")
onClicked: {
generalPage.configurationChanged()
onClicked: {
configurationDialog.close()
}
}
}
}
QQC2.CheckBox {
id: manageVirtualConnections
text: i18n("Show virtual connections")
onClicked: {
generalPage.configurationChanged()
onVisibleChanged: {
if (visible) {
unlockModem.checked = configuration.unlockModemOnDetection
manageVirtualConnections.checked = configuration.manageVirtualConnections
}
}
onAccepted: {
configuration.unlockModemOnDetection = unlockModem.checked
configuration.manageVirtualConnections = manageVirtualConnections.checked
}
}
......@@ -78,8 +78,8 @@ Item {
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 @@ Item {
}
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 @@ Item {
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,9 +175,8 @@ Item {
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)
......@@ -187,6 +184,30 @@ Item {
}
}
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,7 +228,7 @@ Item {
}
}
Dialog {
AddConnectionDialog {
id: addNewConnectionDialog
onRequestCreateConnection: {
......@@ -215,6 +236,10 @@ Item {
}
}
ConfigurationDialog {
id: configurationDialog
}
function deselectConnections() {
connectionView.currentConnectionPath = ""
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment