on bf461a2 help sign in
unity8/Greeter/PassphraseLockscreen.qml
87 lines 2.5 kB history raw
1/*
2 * Copyright (C) 2013 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 as published by
6 * the Free Software Foundation; version 3.
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 */
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../Components"
21Item {
22 id: root
23 height: highlightItem.height
25 property alias placeholderText: pinentryField.placeholderText
26 property string username: ""
28 signal entered(string passphrase)
29 signal cancel()
31 function clear(playAnimation) {
32 pinentryField.text = "";
33 if (playAnimation) {
34 wrongPasswordAnimation.start();
35 } else {
36 pinentryField.focus = false
37 }
38 }
40 Rectangle {
41 id: highlightItem
42 width: units.gu(32)
43 height: units.gu(10)
44 anchors.centerIn: parent
45 color: Qt.rgba(0.1, 0.1, 0.1, 0.4)
46 border.color: Qt.rgba(0.4, 0.4, 0.4, 0.4)
47 border.width: units.dp(1)
48 radius: units.gu(1.5)
49 antialiasing: true
51 Label {
52 objectName: "greeterLabel"
53 anchors {
54 left: parent.left
55 top: parent.top
56 right: parent.right
57 margins: units.gu(1.5)
58 }
59 text: root.username.length > 0 ? i18n.tr("Hello %1").arg(root.username) : i18n.tr("Hello")
60 color: "white"
61 }
63 TextField {
64 id: pinentryField
65 objectName: "pinentryField"
66 anchors {
67 horizontalCenter: parent.horizontalCenter
68 bottom: parent.bottom
69 margins: units.gu(1)
70 }
71 height: units.gu(4.5)
72 width: parent.width - units.gu(2)
73 echoMode: TextInput.Password
74 opacity: 0.9
75 hasClearButton: false
77 onAccepted: {
78 root.entered(pinentryField.text);
79 }
80 }
81 }
83 WrongPasswordAnimation {
84 id: wrongPasswordAnimation
85 target: pinentryField
86 }