18 import Ubuntu.Components 0.1
19 import Ubuntu.Components.ListItems 0.1
20 import
"../Components"
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