Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d254892b authored by Martin Kacej's avatar Martin Kacej

Different dialogs for detail view and editor, source reformated

parent 97b4cb99
import QtQuick 2.2
import QtQuick.Controls 1.4 as Controls
import QtQuick.Layouts 1.2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item{
property var details: []
anchors.fill:parent
height: 100
function clicked(f){
details = f
}
Column {
anchors.fill: parent
Text{
text:details[0]
anchors.fill:parent
}
Repeater {
id: repeater
property int contentHeight: 0
property int longestString: 0
model: details.length / 2
Item {
anchors {
left: parent.left
right: parent.right
topMargin: Math.round(units.gridUnit / 3)
}
height: Math.max(detailNameLabel.height, detailValueLabel.height)
PlasmaComponents.Label {
id: detailNameLabel
property var details
property var str: 0
anchors {
left: parent.left
// leftMargin: repeater.longestString - paintedWidth + Math.round(units.gridUnit / 2)
verticalCenter: parent.verticalCenter
}
height: paintedHeight
font.pointSize: theme.smallestFont.pointSize
horizontalAlignment: Text.AlignRight
opacity: 0.6
text: "<b>" + details[index*2] + "</b>: &nbsp"
Component.onCompleted: {
if (paintedWidth > repeater.longestString) {
repeater.longestString = paintedWidth
}
}
}
Column{
anchors.fill: parent
PlasmaComponents.Label {
id: detailValueLabel
PlasmaComponents.Label{
anchors.left: parent.left
text: "SSID"
}
anchors {
left: detailNameLabel.right
right: parent.right
verticalCenter: parent.verticalCenter
}
height: paintedHeight
elide: Text.ElideRight
font.pointSize: theme.smallestFont.pointSize
opacity: 0.6
text: details[(index*2)+1]
textFormat: Text.PlainText
PlasmaComponents.TextField{
width:100 // units.GridUnit * 100
}
}
PlasmaComponents.Label{
anchors.left: parent.left
text: "Security"
}
Controls.ComboBox{
model: ["None","WEP","WPA","802.1x EAP"]
}
RowLayout{
PlasmaComponents.Label{
anchors.left: parent.left
text: "Advanced options"
}
PlasmaComponents.Switch{
// Count total height from added items, somehow contentRect.height doesn't work
onItemAdded: {
contentHeight = contentHeight + item.height
}
}
}
}
import QtQuick 2.2
import QtQuick.Controls 1.4 as Controls
import QtQuick.Layouts 1.2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import QtQuick 2.0
Item {
property var details
property var str: 0
Column{
PlasmaComponents.Label{
anchors.left: parent.left
text: "Strength: "
}
PlasmaComponents.Label{
anchors.right: parent.right
text: str
}
}
function fillDetails(){
for(var i=0;i<(details.length/2);i++){
console.info(details[(i*2)+1])
}
str = details[3]
}
}
......@@ -7,33 +7,21 @@ import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
PlasmaComponents.ListItem {
width: parent.width
property var foo : []
enabled: true
RowLayout {
width: parent.width
MouseArea{
anchors.fill: parent
onClicked: {
foo = ConnectionDetails
clicked(foo)
connectionEditorDialog.open()
}
}
PlasmaComponents.Label {
id: connectionNameLabel
anchors {
leftMargin: Math.round(units.gridUnit / 2)
}
height: paintedHeight
elide: Text.ElideRight
font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal
font.italic: ConnectionState == PlasmaNM.Enums.Activating ? true : false
text: ItemUniqueName
textFormat: Text.PlainText
}
PlasmaCore.SvgItem {
......@@ -52,23 +40,4 @@ PlasmaComponents.ListItem {
}
}
}
PlasmaComponents.CommonDialog {
id: connectionEditorDialog
titleText: i18n("Connection Editor")
buttonTexts: [i18n("Close")]
onButtonClicked: close()
content: Loader {
id: connectionEditorDialogLoader
width: units.gridUnit * 22
height: units.gridUnit * 25
}
onStatusChanged: {
if (status == PlasmaComponents.DialogStatus.Open) {
connectionEditorDialogLoader.source = "ConnectionEditorDialog.qml"
connectionEditorDialogLoader.item.focusTextInput()
}
}
}
}
\ No newline at end of file
}
......@@ -33,28 +33,28 @@ Item {
objectName: "wifiMain"
width: units.gridUnit * 30
height: width * 1.5
PlasmaNM.Handler{
id: handler
}
PlasmaNM.EnabledConnections {
id: enabledConnections
onWirelessEnabledChanged: {
wifiSwitchButton.checked = wifiSwitchButton.enabled && enabled
wifiSwitchButton.checked = wifiSwitchButton.enabled
}
}
PlasmaNM.NetworkModel {
id: connectionModel
}
PlasmaNM.MobileAppletProxyModel{
id: mobileappletProxyModel
sourceModel: connectionModel
}
Column {
id: formLayout
spacing: units.gridUnit
......@@ -67,26 +67,24 @@ Item {
RowLayout{
id:layoutrow
width: parent.width
PlasmaComponents.Label {
anchors.left: parent.left
text: i18n("Wifi")
Layout.fillWidth: true
}
PlasmaComponents.Switch {
id: wifiSwitch
checked: enabled && enabledConnections.wirelessEnabled
enabled: enabledConnections.wirelessHwEnabled
&& availableDevices.wirelessDeviceAvailable
enabled: enabledConnections.wirelessHwEnabled
//icon: enabled ? "network-wireless-on" : "network-wireless-off"
onClicked: {
handler.enableWireless(checked);
}
}
}
Rectangle{
id: separator
anchors.top: layoutrow.bottom
......@@ -94,7 +92,7 @@ Item {
height: units.gridUnit/8
border.color: "grey"
}
PlasmaComponents.Label {
id:label
anchors{
......@@ -114,12 +112,10 @@ Item {
left: parent.left
right: parent.right
}
ListView {
property bool availableConnectionsVisible: false
property int currentVisibleButtonIndex: -1
id:view
//property bool availableConnectionsVisible: false
anchors.fill: parent
anchors.margins: units.gridUnit
clip: true
......@@ -127,18 +123,74 @@ Item {
currentIndex: -1
boundsBehavior: Flickable.StopAtBounds
model: mobileappletProxyModel
delegate: RowItemDelegate{
delegate: RowItemDelegate {
onClicked: {
networkDetailsViewContent.details = ConnectionDetails
if (ConnectionDetails[1] != ""){
detailsDialog.titleText = ConnectionDetails[1]
}else{
detailsDialog.titleText = "Network details"
}
networkDetailsViewContent.fillDetails()
detailsDialog.open()
}
}
}
}
PlasmaComponents.Button{
id:customConnectionButton
anchors.top:wifiarea.bottom
text:"Add custom connection"
onClicked: connectionEditorDialog.open()
}
}
}
PlasmaComponents.CommonDialog {
id: connectionEditorDialog
titleText: i18n("Connection Editor")
buttonTexts: [i18n("Close")]
onButtonClicked: {
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 {
id: detailsDialog
titleText: i18n("Network Details")
buttonTexts: [i18n("Close")]
onButtonClicked: {
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