@@ -0,0 +1,99 @@
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 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+ */
16+
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
19+import ".." as LocalComponents
20+
21+/**
22+ * See the main passwd-type page for an explanation of why we don't actually
23+ * directly set the password here.
24+ */
25+
26+LocalComponents.Page {
27+ id: passwdSetPage
28+ objectName: "passcodeDesktopPage"
29+ title: i18n.tr("Lock Screen Passcode")
30+ forwardButtonSourceComponent: forwardButton
31+
32+ property alias password: passwordField.text
33+
34+ Column {
35+ id: column
36+ anchors.fill: content
37+ anchors.leftMargin: leftMargin
38+ anchors.rightMargin: rightMargin
39+ anchors.topMargin: customMargin
40+ spacing: units.gu(3)
41+
42+ Label {
43+ id: infoLabel
44+ objectName: "infoLabel"
45+ anchors {
46+ left: parent.left
47+ right: parent.right
48+ }
49+ wrapMode: Text.Wrap
50+ font.weight: Font.Light
51+ color: textColor
52+ text: i18n.tr("Enter 4 numbers to setup your passcode")
53+ }
54+
55+ Grid {
56+ columns: 2
57+ spacing: units.gu(2)
58+ verticalItemAlignment: Grid.AlignVCenter
59+
60+ Label {
61+ text: i18n.tr("Choose passcode")
62+ color: textColor
63+ }
64+ LocalComponents.WizardTextField {
65+ id: passwordField
66+ objectName: "passwordField"
67+ echoMode: TextInput.Password
68+ inputMethodHints: Qt.ImhDigitsOnly
69+ validator: RegExpValidator { regExp: /^\d{4}$/ }
70+ maximumLength: 4
71+ }
72+
73+ Label {
74+ text: i18n.tr("Confirm passcode")
75+ color: textColor
76+ }
77+ LocalComponents.WizardTextField {
78+ id: password2Field
79+ objectName: "password2Field"
80+ echoMode: TextInput.Password
81+ inputMethodHints: Qt.ImhDigitsOnly
82+ validator: RegExpValidator { regExp: /^\d{4}$/ }
83+ maximumLength: 4
84+ }
85+ }
86+ }
87+
88+ Component {
89+ id: forwardButton
90+ LocalComponents.StackButton {
91+ text: i18n.tr("Next")
92+ enabled: password != "" && password == password2Field.text
93+ onClicked: {
94+ root.password = password;
95+ pageStack.next();
96+ }
97+ }
98+ }
99+}