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