@@ -16,15 +16,17 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19+import Ubuntu.Components.ListItems 0.1
19import "../Components"
20import "../Components"
23 anchors.centerIn: parent
24 anchors.centerIn: parent
24− spacing: units.gu(2.5)
25+ spacing: units.gu(3.5)
26 property alias placeholderText: pinentryField.placeholderText
27 property alias placeholderText: pinentryField.placeholderText
27− property int padWidth: units.gu(32)
28+ property int padWidth: units.gu(34)
29+ property int padHeight: units.gu(28)
28 property int pinLength: 4
30 property int pinLength: 4
30 signal entered(string passphrase)
32 signal entered(string passphrase)
@@ -37,70 +39,137 @@ Column {
41 id: pinentryField
44 id: pinentryField
42 objectName: "pinentryField"
45 objectName: "pinentryField"
43 anchors.horizontalCenter: parent.horizontalCenter
46 anchors.horizontalCenter: parent.horizontalCenter
44− width: units.gu(32)
47+ color: "#55000000"
45 height: units.gu(5)
49 height: units.gu(5)
46− echoMode: TextInput.Password
50+ radius: "medium"
47− font.pixelSize: units.dp(44)
51+ property string text: ""
48− color: "white"
52+ property string placeholderText: ""
50− hasClearButton: false
51− horizontalAlignment: Text.AlignHCenter
53 onTextChanged: {
53 onTextChanged: {
54+ pinentryFieldLabel.text = "";
55+ for (var i = 0; i < text.length; ++i) {
56+ pinentryFieldLabel.text += "•";
54− if (pinentryField.text.length === root.pinLength) {
58+ if (text.length === root.pinLength) {
55− root.entered(pinentryField.text);
59+ root.entered(text);
59− // Using a MouseArea to eat clicks. We don't want to disable the TextField for styling reasons
63+ Label {
60− MouseArea {
64+ id: pinentryFieldLabel
61− anchors.fill: parent
65+ anchors.centerIn: parent
66+ font.pixelSize: units.dp(44)
71+ id: pinentryFieldPlaceHolder
72+ anchors.centerIn: parent
74+ text: parent.placeholderText
75+ visible: pinentryFieldLabel.text.length == 0
65− Grid {
79+ UbuntuShape {
67 left: parent.left
81 left: parent.left
68 right: parent.right
82 right: parent.right
69 margins: (parent.width - root.padWidth) / 2
83 margins: (parent.width - root.padWidth) / 2
85+ height: root.padHeight
94+ topMargin: root.padHeight / 4
101+ verticalCenter: parent.verticalCenter
108+ bottom: parent.bottom
109+ bottomMargin: root.padHeight / 4
72− columns: 3
113+ ThinDivider {
73− spacing: units.gu(1)
114+ anchors.centerIn: parent
115+ anchors.horizontalCenterOffset: -root.padWidth / 6
116+ width: root.padHeight
120+ anchors.centerIn: parent
121+ anchors.horizontalCenterOffset: root.padWidth / 6
122+ width: root.padHeight
75− Repeater {
126+ Grid {
76− model: 9
127+ anchors {
130+ margins: (parent.width - root.padWidth) / 2
78− PinPadButton {
138+ PinPadButton {
79− objectName: "pinPadButton" + (index + 1)
139+ objectName: "pinPadButton" + (index + 1)
140+ width: root.padWidth / 3
141+ height: root.padHeight / 4
80− text: index + 1
142+ text: index + 1
82− onClicked: {
144+ onClicked: {
83− pinentryField.text = pinentryField.text + text
145+ pinentryField.text = pinentryField.text + text;
88− PinPadButton {
150+ PinPadButton {
89− objectName: "pinPadButtonBack"
151+ objectName: "pinPadButtonBack"
152+ width: root.padWidth / 3
153+ height: root.padHeight / 4
90− iconName: "back"
154+ iconName: "back"
91− onClicked: root.cancel();
155+ onClicked: root.cancel();
94− PinPadButton {
158+ PinPadButton {
95− objectName: "pinPadButton0"
159+ objectName: "pinPadButton0"
160+ width: root.padWidth / 3
161+ height: root.padHeight / 4
96− text: "0"
162+ text: "0"
97− onClicked: pinentryField.text = pinentryField.text + text
163+ onClicked: pinentryField.text = pinentryField.text + text
100− PinPadButton {
166+ PinPadButton {
101− objectName: "pinPadButtonErase"
167+ objectName: "pinPadButtonErase"
168+ width: root.padWidth / 3
169+ height: root.padHeight / 4
102− iconName: "erase"
170+ iconName: "erase"
103− onClicked: pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1)
171+ onClicked: pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1)