Commit fab05557 authored by Martin Kacej's avatar Martin Kacej

Dialogs transfered to Pages

parent db26d701
...@@ -22,39 +22,66 @@ import QtQuick.Controls 2.2 as Controls ...@@ -22,39 +22,66 @@ import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.2 as Kirigami
PlasmaExtras.ScrollArea { Kirigami.ScrollablePage{
property var details property var details
property var str: 0 property var str: 0
property var connection : ({}) property var connection : ({})
property var wirelessSettings: ({}) property var wirelessSettings: ({})
property var enabledSaving: (editorIpSection.enabledSave && editorSecuritySection.enabledSave && ssidField.text) property var enabledSaving: (editorIpSection.enabledSave && editorSecuritySection.enabledSave && ssidField.text)
title: i18n("Connection Editor")
ColumnLayout{ ColumnLayout{
id: columnlayout id: columnlayout
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.Label { Controls.Label {
text: i18n("SSID") text: i18n("SSID")
font.weight: Font.Bold font.weight: Font.Bold
anchors.horizontalCenter: parent.horizontalCenter
} }
PlasmaComponents.TextField { Controls.TextField {
id: ssidField id: ssidField
Layout.fillWidth: true anchors.horizontalCenter: parent.horizontalCenter
placeholderText: i18n("None") placeholderText: i18n("None")
} }
IPDetailsSection { IPDetailsSection {
id: editorIpSection id: editorIpSection
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
} }
SecuritySection { SecuritySection {
id: editorSecuritySection id: editorSecuritySection
//anchors.top: editorIpSection.bottom
anchors.topMargin: units.gridUnit anchors.topMargin: units.gridUnit
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
}
} }
actions {
left: Kirigami.Action {
text: "save"
enabled: enabledSaving
onTriggered: {
save()
applicationWindow().pageStack.pop()
}
}
right: Kirigami.Action {
iconName: "cancel"
onTriggered: {
applicationWindow().pageStack.pop()
}
} }
}
function save() { function save() {
var m = ({}); var m = ({});
connection["id"] = ssidField.text connection["id"] = ssidField.text
......
...@@ -29,7 +29,7 @@ PlasmaExtras.ScrollArea { ...@@ -29,7 +29,7 @@ PlasmaExtras.ScrollArea {
property alias signal_speed: linkSpeedLabel.text property alias signal_speed: linkSpeedLabel.text
property alias ip_address: ipAddressLabel.text property alias ip_address: ipAddressLabel.text
property alias security: securityLabel.text property alias security: securityLabel.text
property var map: [] property var activeMap: ({})
Column { Column {
Column { Column {
...@@ -89,13 +89,17 @@ PlasmaExtras.ScrollArea { ...@@ -89,13 +89,17 @@ PlasmaExtras.ScrollArea {
} }
} }
SecuritySection {
id: detailsSecuritySection
}
RowLayout { RowLayout {
PlasmaComponents.Label { Controls.Label {
anchors.left: parent.left anchors.left: parent.left
text: i18n("Advanced options") text: i18n("Advanced options")
} }
PlasmaComponents.Switch { Controls.Switch {
id: advancedOptionsSwitch id: advancedOptionsSwitch
checked: false checked: false
} }
...@@ -105,11 +109,6 @@ PlasmaExtras.ScrollArea { ...@@ -105,11 +109,6 @@ PlasmaExtras.ScrollArea {
id: detailsIP id: detailsIP
visible: advancedOptionsSwitch.checked visible: advancedOptionsSwitch.checked
} }
SecuritySection {
id: s
visible: advancedOptionsSwitch.checked
}
} }
function fillDetails() { function fillDetails() {
...@@ -117,11 +116,7 @@ PlasmaExtras.ScrollArea { ...@@ -117,11 +116,7 @@ PlasmaExtras.ScrollArea {
for (var i = 0; i < (details.length / 2); i++){ for (var i = 0; i < (details.length / 2); i++){
d[details[(i * 2)]] = details[(i * 2) + 1] d[details[(i * 2)]] = details[(i * 2) + 1]
} }
for (var i in map) {
if (map.hasOwnProperty(i)) {
console.info(i + ' = ' + map[i]);
}
}
if (d['Access point (SSID)']) if (d['Access point (SSID)'])
detailsDialog.titleText = d['Access point (SSID)'] detailsDialog.titleText = d['Access point (SSID)']
signal_strength = d['Signal strength'] signal_strength = d['Signal strength']
......
...@@ -155,8 +155,11 @@ Kirigami.SwipeListItem { ...@@ -155,8 +155,11 @@ Kirigami.SwipeListItem {
] ]
function getDetails() { function getDetails() {
applicationWindow().pageStack.push(networkDetailsViewComponent)
if (networkDetailsViewComponent.status == Component.Ready){
console.info("Network view ready")
if (ConnectionDetails) if (ConnectionDetails)
networkDetailsViewContent.details = ConnectionDetails networkDetailsViewComponentView.details = ConnectionDetails
if (ConnectionDetails[1] !== "") { if (ConnectionDetails[1] !== "") {
detailsDialog.titleText = ItemUniqueName detailsDialog.titleText = ItemUniqueName
} else { } else {
...@@ -164,11 +167,13 @@ Kirigami.SwipeListItem { ...@@ -164,11 +167,13 @@ Kirigami.SwipeListItem {
} }
map = handler.getConnectionSettings(ConnectionPath,"ipv4") map = handler.getConnectionSettings(ConnectionPath,"ipv4")
if (ConnectionState == PlasmaNM.Enums.Activated){ if (ConnectionState == PlasmaNM.Enums.Activated){
handler.getActiveConnectionInfo(ConnectionPath) networkDetailsViewComponentView.activeMap = handler.getActiveConnectionInfo(SpecificPath)
}
//networkDetailsViewContent.map = map
networkDetailsViewComponentView.fillDetails()
//applicationWindow().pageStack.push(networkDetailsViewComponent)
} }
networkDetailsViewContent.map = map
networkDetailsViewContent.fillDetails()
detailsDialog.open()
} }
function changeState() { function changeState() {
......
...@@ -25,11 +25,14 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras ...@@ -25,11 +25,14 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.kirigami 2.2 as Kirigami import org.kde.kirigami 2.2 as Kirigami
Kirigami.Page { Kirigami.ApplicationItem {
id: main id: main
objectName: "wifiMain" objectName: "wifiMain"
width: units.gridUnit * 30 //width: units.gridUnit * 30
height: width * 1.5 //height: width * 1.5
pageStack.defaultColumnWidth: Kirigami.Units.gridUnit * 25
pageStack.initialPage: formLayout
PlasmaNM.Handler { PlasmaNM.Handler {
id: handler id: handler
...@@ -43,6 +46,10 @@ Kirigami.Page { ...@@ -43,6 +46,10 @@ Kirigami.Page {
} }
} }
contextDrawer: Kirigami.ContextDrawer {
id: contextDrawer
}
PlasmaNM.NetworkModel { PlasmaNM.NetworkModel {
id: connectionModel id: connectionModel
} }
...@@ -56,15 +63,12 @@ Kirigami.Page { ...@@ -56,15 +63,12 @@ Kirigami.Page {
id: formLayout id: formLayout
anchors { anchors {
fill: parent fill: parent
margins: units.gridUnit
leftMargin: units.gridUnit / 2
} }
RowLayout { RowLayout {
id: layoutrow id: layoutrow
width: parent.width width: parent.width
PlasmaComponents.Label { Controls.Label {
anchors.left: parent.left anchors.left: parent.left
text: i18n("Wifi") text: i18n("Wifi")
Layout.fillWidth: true Layout.fillWidth: true
...@@ -80,6 +84,7 @@ Kirigami.Page { ...@@ -80,6 +84,7 @@ Kirigami.Page {
} }
} }
Rectangle { Rectangle {
id: separator id: separator
anchors.top: layoutrow.bottom anchors.top: layoutrow.bottom
...@@ -120,87 +125,32 @@ Kirigami.Page { ...@@ -120,87 +125,32 @@ Kirigami.Page {
model: mobileProxyModel model: mobileProxyModel
delegate: RowItemDelegate {} delegate: RowItemDelegate {}
} }
} }
PlasmaComponents.Button { Controls.Button {
id: customConnectionButton id: customConnectionButton
anchors.top: wifiarea.bottom anchors.top: wifiarea.bottom
anchors.topMargin: units.gridUnit anchors.topMargin: units.gridUnit
text: i18n("Add custom connection") text: i18n("Add custom connection")
onClicked: connectionEditorDialog.open() onClicked: {
applicationWindow().pageStack.push(connectionEditorDialogcomponent)
//Qt.resolvedUrl("./ConnectionEditorDialog.qml"))
} }
} }
contextualActions: [
Kirigami.Action {
text:"Add custom connection"
onTriggered: connectionEditorDialog.open()
},
Kirigami.Action {
text:"Create Hotspot"
onTriggered: showPassiveNotification("Open tethering")
} }
]
PlasmaComponents.Dialog { Component {
id: connectionEditorDialog id: connectionEditorDialogcomponent
title: i18n("Connection Editor") ConnectionEditorDialog {
buttons: RowLayout {
width: parent.width
PlasmaComponents.Button {
text: 'Save'
enabled: connectionEditorDialogContent.enabledSaving
onClicked:{
connectionEditorDialogContent.save()
connectionEditorDialog.close()
}
}
PlasmaComponents.Button {
anchors.right: parent.right
text: 'Cancel'
onClicked: connectionEditorDialog.close()
}
}
content: ConnectionEditorDialog {
id: connectionEditorDialogContent
width: units.gridUnit * 22
height: units.gridUnit * 25
Component.onDestruction: {
console.info("Destroyed editor content")
}
}
Component.onDestruction: {
console.info("Destroyed editor")
connectionEditorDialogContent.destroy()
} }
} }
PlasmaComponents.CommonDialog { Component {
id: detailsDialog id: networkDetailsViewComponent
titleText: i18n("Network Details") NetworkDetailsView {
buttonTexts: [i18n("Close")] id: networkDetailsViewComponentView
onButtonClicked: {
networkDetailsViewContent.clearDetails()
close()
} }
content: NetworkDetailsView {
id: networkDetailsViewContent
width: units.gridUnit * 22
height: units.gridUnit * 25
Component.onDestruction: {
console.info("Destroyed details content")
} }
}
Component.onDestruction: {
console.info("Destroyed details")
networkDetailsViewContent.destroy()
}
}
Component.onDestruction: {
console.error("Destroyed main")
connectionEditorDialog.destroy()
detailsDialog.destroy()
//connectionEditorDialog.connectionEditorDialogContent.destroy()
}
} }
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