Warning, /system/mycroft-gui/containments/mark2/package/contents/ui/networking/SelectNetwork.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright 2018 by Aditya Mehra <aix.m@outlook.com>
0003  *
0004  * Licensed under the Apache License, Version 2.0 (the "License");
0005  * you may not use this file except in compliance with the License.
0006  * You may obtain a copy of the License at
0007  *
0008  *    http://www.apache.org/licenses/LICENSE-2.0
0009  *
0010  * Unless required by applicable law or agreed to in writing, software
0011  * distributed under the License is distributed on an "AS IS" BASIS,
0012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013  * See the License for the specific language governing permissions and
0014  * limitations under the License.
0015  *
0016  */
0017 
0018 import QtQuick.Layouts 1.4
0019 import QtQuick 2.4
0020 import QtQuick.Controls 2.0
0021 import org.kde.kirigami 2.5 as Kirigami
0022 import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
0023 
0024 Item {
0025     id: networkSelectionView
0026     anchors.fill: parent
0027     property var pathToRemove
0028     property bool isStartUp: false
0029         
0030     function removeConnection(){
0031         handler.removeConnection(pathToRemove)
0032     }
0033     
0034     PlasmaNM.NetworkStatus {
0035         id: networkStatus
0036     }
0037 
0038     PlasmaNM.ConnectionIcon {
0039         id: connectionIconProvider
0040     }
0041 
0042     PlasmaNM.Handler {
0043         id: handler
0044     }
0045 
0046     PlasmaNM.AvailableDevices {
0047         id: availableDevices
0048     }
0049 
0050     PlasmaNM.NetworkModel {
0051         id: connectionModel
0052     }
0053 
0054     PlasmaNM.AppletProxyModel {
0055         id: appletProxyModel
0056         sourceModel: connectionModel
0057     }
0058     Item {
0059         id: topArea
0060         anchors.left: parent.left
0061         anchors.right: parent.right
0062         anchors.top: parent.top
0063         height: Kirigami.Units.gridUnit * 2
0064         
0065         Kirigami.Heading {
0066             id: connectionTextHeading
0067             level: 1
0068             wrapMode: Text.WordWrap
0069             anchors.centerIn: parent
0070             font.bold: true
0071             text: "Select Your Wi-Fi"
0072             color: Kirigami.Theme.linkColor
0073         }
0074     }
0075 
0076     Item {
0077         anchors.top: topArea.bottom
0078         anchors.topMargin: Kirigami.Units.largeSpacing
0079         anchors.left: parent.left
0080         anchors.right: parent.right
0081         anchors.bottom: areaSep.top
0082         anchors.bottomMargin: Kirigami.Units.largeSpacing
0083         
0084         ListView {
0085             id: connectionView
0086             property bool availableConnectionsVisible: true
0087             anchors.fill: parent
0088             clip: true
0089             model: appletProxyModel
0090             currentIndex: -1
0091             boundsBehavior: Flickable.StopAtBounds
0092             delegate: NetworkItem{}
0093         }
0094     }
0095     
0096     Kirigami.Separator {
0097         id: areaSep
0098         anchors.bottom: bottomArea.top
0099         anchors.left: parent.left
0100         anchors.right: parent.right
0101         height: 1
0102     }
0103     
0104     Item {
0105         id: bottomArea
0106         anchors.left: parent.left
0107         anchors.right: parent.right
0108         anchors.bottom: parent.bottom
0109         anchors.bottomMargin: Kirigami.Units.largeSpacing * 1.15
0110         height: backIcon.implicitHeight + Kirigami.Units.largeSpacing * 1.15
0111         visible: isStartUp ? 0 : 1
0112         enabled: isStartUp ? 0 : 1
0113                 
0114         RowLayout {
0115             anchors.fill: parent
0116             
0117             Kirigami.Icon {
0118                 id: backIcon
0119                 source: "system-reboot"
0120                 Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0121                 Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0122             }
0123             
0124             Kirigami.Heading {
0125                 level: 2
0126                 wrapMode: Text.WordWrap
0127                 font.bold: true
0128                 text: "Refresh"
0129                 Layout.fillWidth: true
0130                 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
0131             }
0132         }
0133         
0134         MouseArea {
0135             anchors.fill: parent
0136             onClicked: {
0137                 handler.requestScan();
0138             }
0139         }
0140     }
0141     
0142     Kirigami.OverlaySheet {
0143         id: networkActions
0144         leftPadding: 0
0145         rightPadding: 0
0146         parent: networkSelectionView
0147          
0148         ColumnLayout {
0149             implicitWidth: Kirigami.Units.gridUnit * 25
0150             spacing: 0 
0151          
0152             Button {
0153                 Layout.fillWidth: true
0154                 Layout.fillHeight: true
0155                 text: "Forget Network"
0156                 
0157                 onClicked: {
0158                     removeConnection()
0159                     networkActions.close()
0160                 }
0161             }
0162         }
0163     }
0164 }