Warning, /plasma/plasma-mobile/initialstart/modules/wifi/package/contents/ui/ConnectDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.15
0005 import QtQuick.Layouts 1.15
0006 import QtQuick.Controls 2.15 as Controls
0007 
0008 import org.kde.kirigami 2.20 as Kirigami
0009 
0010 Kirigami.PromptDialog {
0011     id: dialogRoot
0012     property int securityType
0013     property string headingText
0014     property string devicePath
0015     property string specificPath
0016 
0017     signal donePressed(string password)
0018 
0019     function openAndClear() {
0020         warning.visible = false;
0021         this.open();
0022         passwordField.text = "";
0023         passwordField.focus = true;
0024     }
0025 
0026     title: headingText
0027     standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel
0028 
0029     onOpened: passwordField.forceActiveFocus()
0030     onRejected: {
0031         dialogRoot.close();
0032         passwordField.focus = false;
0033     }
0034     onAccepted: {
0035         if (passwordField.acceptableInput) {
0036             dialogRoot.close();
0037             handler.addAndActivateConnection(devicePath, specificPath, passwordField.text);
0038         } else {
0039             warning.visible = true;
0040         }
0041         passwordField.focus = false;
0042     }
0043 
0044     ColumnLayout {
0045         id: column
0046         spacing: Kirigami.Units.largeSpacing
0047 
0048         PasswordField {
0049             id: passwordField
0050             Layout.fillWidth: true
0051             securityType: dialogRoot.securityType
0052             onAccepted: dialogRoot.accept()
0053         }
0054 
0055         Controls.Label {
0056             id: warning
0057             text: i18n("Invalid input.")
0058             visible: false
0059         }
0060     }
0061 }