2 * Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
18import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1
24 anchors.centerIn: parent
25 spacing: units.gu(3.5)
27 property alias placeholderText: pinentryField.placeholderText
28 property int padWidth: units.gu(34)
29 property int padHeight: units.gu(28)
30 property int pinLength: -1
32 signal entered(string passphrase)
35 property bool entryEnabled: true
37 function clear(playAnimation) {
38 pinentryField.text = "";
40 wrongPasswordAnimation.start();
47 objectName: "pinentryField"
48 anchors.horizontalCenter: parent.horizontalCenter
53 property string text: ""
54 property string placeholderText: ""
56 pinentryFieldLabel.text = "";
57 for (var i = 0; i < text.length; ++i) {
58 pinentryFieldLabel.text += "•";
60 if (text.length === root.pinLength) {
66 id: pinentryFieldLabel
67 anchors.centerIn: parent
68 width: parent.width - (backspaceIcon.width + backspaceIcon.anchors.rightMargin) * 2
69 elide: Text.ElideMiddle
70 horizontalAlignment: Text.AlignHCenter
71 font.pixelSize: units.dp(44)
76 id: pinentryFieldPlaceHolder
77 anchors.centerIn: parent
79 text: parent.placeholderText
80 visible: pinentryFieldLabel.text.length == 0
85 objectName: "backspaceIcon"
88 topMargin: units.gu(1)
90 rightMargin: units.gu(2)
92 bottomMargin: units.gu(1)
94 visible: root.pinLength == -1
99 onClicked: pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
108 margins: (parent.width - root.padWidth) / 2
110 height: root.padHeight
119 topMargin: root.padHeight / 4
126 verticalCenter: parent.verticalCenter
133 bottom: parent.bottom
134 bottomMargin: root.padHeight / 4
139 anchors.centerIn: parent
140 anchors.horizontalCenterOffset: -root.padWidth / 6
141 width: root.padHeight
145 anchors.centerIn: parent
146 anchors.horizontalCenterOffset: root.padWidth / 6
147 width: root.padHeight
155 margins: (parent.width - root.padWidth) / 2
164 objectName: "pinPadButton" + (index + 1)
165 width: root.padWidth / 3
166 height: root.padHeight / 4
168 enabled: entryEnabled
171 pinentryField.text = pinentryField.text + text;
177 objectName: "pinPadButtonBack"
178 width: root.padWidth / 3
179 height: root.padHeight / 4
181 onClicked: root.cancel();
185 objectName: "pinPadButton0"
186 width: root.padWidth / 3
187 height: root.padHeight / 4
189 onClicked: pinentryField.text = pinentryField.text + text
190 enabled: entryEnabled
194 objectName: "pinPadButtonErase"
195 width: root.padWidth / 3
196 height: root.padHeight / 4
197 iconName: root.pinLength == -1 ? "" : "erase"
198 subText: root.pinLength == -1 ? "DONE" : ""
200 if (root.pinLength !== -1) {
201 pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
203 root.entered(pinentryField.text);
206 enabled: entryEnabled
211 WrongPasswordAnimation {
212 id: wrongPasswordAnimation
213 objectName: "wrongPasswordAnimation"
214 target: pinentryField
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list