Debian Codegraph @

src/app/qml/dialogs/NetAuthenticationDialog.qml

raw
1 /*
2 * Copyright (C) 2015 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Carlos Jose Mazieri <[email protected]>
17 */
18 import QtQuick 2.4
19 import Lomiri.Components 1.3
20 import Lomiri.Components.Popups 1.3
21 import QtQuick.Layouts 1.1
22
23 import "../components"
24
25 Dialog {
26 id: authenticationDialog
27 objectName: "authenticationDialog"
28 title: i18n.tr("Authentication required")
29
30 property alias currentPath: authenticationDialog.text
31 property alias currentUserName: authUserName.text
32 property alias currentPassword: authPassword.text
33 property alias savePassword: autcheckSavePassword.checked
34
35 signal ok()
36
37 Component.onCompleted: {
38 authUserName.forceActiveFocus()
39 authUserName.cursorPosition = authUserName.text.length
40 }
41
42 Label {
43 color: theme.palette.normal.backgroundTertiaryText
44 textSize: Label.Small
45 text: i18n.tr("User")
46 }
47
48 TextField {
49 id: authUserName
50 objectName: "authUserName"
51 visible: true
52 focus: true
53 }
54
55 Label {
56 color: theme.palette.normal.backgroundTertiaryText
57 textSize: Label.Small
58 text: i18n.tr("Password")
59 }
60
61 TextField {
62 id: authPassword
63 objectName: "authPassword"
64 echoMode: TextInput.Password
65 focus: true
66 onAccepted: authOkButton.clicked()
67 }
68
69 ListItem {
70 divider.visible: false
71 ListItemLayout {
72 title.text: i18n.tr("Save password")
73 title.color: theme.palette.normal.backgroundSecondaryText
74
75 Switch {
76 SlotsLayout.position: SlotsLayout.Last
77 id: autcheckSavePassword
78 objectName: "autcheckSavePassword"
79 onCheckedChanged: {
80 console.log("NetAuthenticationDialog::onCheckedChanged() checked="+checked)
81 savePasswordChanged(checked)
82 }
83
84 }
85 }
86 }
87
88 RowLayout {
89 anchors { left: parent.left; right: parent.right }
90 height: units.gu(4)
91 layoutDirection: Qt.RightToLeft
92
93 Button {
94 id: authCancelButton
95 objectName: "authCancelButton"
96 text: i18n.tr("Cancel")
97 Layout.fillHeight: true
98 Layout.fillWidth: true
99
100 onClicked: {
101 PopupUtils.close(authenticationDialog)
102 }
103 }
104
105 Button {
106 id: authOkButton
107 objectName: "authOkButton"
108 text: i18n.tr("Ok")
109 Layout.fillHeight: true
110 Layout.fillWidth: true
111
112 onClicked: {
113 ok()
114 PopupUtils.close(authenticationDialog)
115 }
116 }
117 }
118 }