Warning, /system/mycroft-gui/containments/mark2/package/contents/ui/networking/NetworkConnect.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.9
0020 import QtQuick.Controls 2.0
0021 import org.kde.kirigami 2.5 as Kirigami
0022 import org.kde.plasma.components 2.0 as PlasmaComponents
0023 import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
0024 
0025 Item {
0026     id: networkPasswordScreen
0027     anchors.fill: parent
0028     
0029     PlasmaNM.Handler {
0030         id: handler
0031     }
0032     
0033     Item {
0034         id: topArea
0035         anchors.left: parent.left
0036         anchors.right: parent.right
0037         anchors.top: parent.top
0038         anchors.topMargin: Kirigami.Units.largeSpacing * 1.5
0039         height: Kirigami.Units.gridUnit * 2
0040         
0041         Kirigami.Heading {
0042             id: connectionTextHeading
0043             level: 1
0044             wrapMode: Text.WordWrap
0045             width: parent.width
0046             anchors.centerIn: parent
0047             font.bold: true
0048             text: "Enter Password For " + connectionName
0049             color: Kirigami.Theme.linkColor
0050         }
0051     }
0052     
0053     Item {
0054         anchors.top: topArea.bottom
0055         anchors.topMargin: Kirigami.Units.largeSpacing
0056         anchors.left: parent.left
0057         anchors.right: parent.right
0058         anchors.bottom: areaSep.top
0059         
0060         PlasmaComponents.TextField {
0061             id: passField
0062             anchors.top: parent.top
0063             anchors.topMargin: Kirigami.Units.largeSpacing
0064             width: parent.width
0065             height: Kirigami.Units.gridUnit * 3
0066             property int securityType
0067             echoMode: TextInput.Password
0068             revealPasswordButtonShown: true
0069             placeholderText: i18n("Password...")
0070             validator: RegExpValidator {
0071                             regExp: if (securityType == PlasmaNM.Enums.StaticWep) {
0072                                         /^(?:.{5}|[0-9a-fA-F]{10}|.{13}|[0-9a-fA-F]{26}){1}$/
0073                                     } else {
0074                                         /^(?:.{8,64}){1}$/
0075                                     }
0076                             }
0077                             
0078             onAccepted: {
0079                  networkingLoader.source = "../networking/Connecting.qml"
0080                  handler.addAndActivateConnection(devicePath, specificPath, passField.text)
0081             }
0082         }
0083     
0084         Button {
0085             anchors.top: passField.bottom
0086             anchors.topMargin: Kirigami.Units.largeSpacing
0087             anchors.left: parent.left
0088             anchors.right: parent.right
0089             height: Kirigami.Units.gridUnit * 3
0090             text: "Connect"
0091         
0092             onClicked: {
0093                     networkingLoader.source = "../networking/Connecting.qml"
0094                     handler.addAndActivateConnection(devicePath, specificPath, passField.text)
0095             }
0096         }
0097     }
0098     
0099     Kirigami.Separator {
0100         id: areaSep
0101         anchors.bottom: bottomArea.top
0102         anchors.left: parent.left
0103         anchors.right: parent.right
0104         height: 1
0105     }
0106     
0107     Item {
0108         id: bottomArea
0109         anchors.left: parent.left
0110         anchors.right: parent.right
0111         anchors.bottom: parent.bottom
0112         anchors.bottomMargin: Kirigami.Units.largeSpacing * 1.15
0113         height: backIcon.implicitHeight + Kirigami.Units.largeSpacing * 1.15
0114                 
0115         RowLayout {
0116             anchors.fill: parent
0117             
0118             Kirigami.Icon {
0119                 id: backIcon
0120                 source: "go-previous"
0121                 Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0122                 Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0123             }
0124             
0125             Kirigami.Heading {
0126                 level: 2
0127                 wrapMode: Text.WordWrap
0128                 font.bold: true
0129                 text: "Select Wi-Fi Network"
0130                 Layout.fillWidth: true
0131                 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
0132             }
0133         }
0134         
0135         MouseArea {
0136             anchors.fill: parent
0137             onClicked: {
0138                 networkingLoader.source = "../networking/SelectNetwork.qml"
0139             }
0140         }
0141     }
0142 }