@@ -0,0 +1,185 @@
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.3
18+import Ubuntu.Components 1.2
19+import ".." as LocalComponents
20+
21+LocalComponents.Page {
22+ objectName: "ubuntuAccountSignUpPage"
23+
24+ title: i18n.tr("Create Account")
25+ customTitle: true
26+ backButtonText: i18n.tr("Cancel")
27+ forwardButtonSourceComponent: forwardButton
28+
29+ Item {
30+ id: column
31+ anchors.fill: content
32+
33+ // email
34+ Label {
35+ id: emailLabel
36+ anchors.left: parent.left
37+ anchors.right: parent.right
38+ wrapMode: Text.Wrap
39+ text: i18n.tr("Email:")
40+ color: "#525252"
41+ font.weight: Font.Light
42+ }
43+
44+ TextField {
45+ id: emailInput
46+ anchors.left: parent.left
47+ anchors.right: parent.right
48+ anchors.top: emailLabel.bottom
49+ anchors.topMargin: units.gu(1)
50+ inputMethodHints: Qt.ImhEmailCharactersOnly
51+ validator: RegExpValidator {
52+ regExp: /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i
53+ }
54+ KeyNavigation.tab: nameInput
55+ }
56+
57+ // name
58+ Label {
59+ id: nameLabel
60+ anchors.left: parent.left
61+ anchors.right: parent.right
62+ anchors.top: emailInput.bottom
63+ anchors.topMargin: units.gu(3)
64+ wrapMode: Text.Wrap
65+ text: i18n.tr("Your name:")
66+ color: "#525252"
67+ font.weight: Font.Light
68+ }
69+
70+ TextField {
71+ id: nameInput
72+ anchors.left: parent.left
73+ anchors.right: parent.right
74+ anchors.top: nameLabel.bottom
75+ anchors.topMargin: units.gu(1)
76+ KeyNavigation.tab: passInput
77+ }
78+
79+ // password
80+ Label {
81+ id: passLabel
82+ anchors.left: parent.left
83+ anchors.right: parent.right
84+ anchors.top: nameInput.bottom
85+ anchors.topMargin: units.gu(3)
86+ wrapMode: Text.Wrap
87+ text: i18n.tr("Password:")
88+ color: "#525252"
89+ font.weight: Font.Light
90+ }
91+
92+ TextField {
93+ id: passInput
94+ anchors.left: parent.left
95+ anchors.right: parent.right
96+ anchors.top: passLabel.bottom
97+ anchors.topMargin: units.gu(1)
98+ echoMode: TextInput.Password
99+ KeyNavigation.tab: pass2Input
100+ }
101+
102+ // password meter
103+ LocalComponents.PasswordMeter {
104+ id: passMeter
105+ anchors.left: parent.left
106+ anchors.right: parent.right
107+ anchors.top: passInput.bottom
108+ anchors.topMargin: units.gu(1)
109+ password: passInput.text
110+ }
111+
112+ // repeat password
113+ Label {
114+ id: pass2Label
115+ anchors.left: parent.left
116+ anchors.right: parent.right
117+ anchors.top: passMeter.bottom
118+ anchors.topMargin: passInput.text !== "" ? units.gu(6) : units.gu(3)
119+ wrapMode: Text.Wrap
120+ text: i18n.tr("Repeat password:")
121+ color: "#525252"
122+ font.weight: Font.Light
123+ }
124+
125+ TextField {
126+ id: pass2Input
127+ anchors.left: parent.left
128+ anchors.right: parent.right
129+ anchors.top: pass2Label.bottom
130+ anchors.topMargin: units.gu(1)
131+ echoMode: TextInput.Password
132+ KeyNavigation.tab: encryptCheck
133+ }
134+
135+ LocalComponents.CheckableSetting {
136+ id: encryptCheck
137+ objectName: "encryptCheck"
138+ showDivider: false
139+ anchors.left: parent.left
140+ anchors.right: parent.right
141+ anchors.top: pass2Input.bottom
142+ anchors.topMargin: units.gu(3)
143+ text: i18n.tr("Encrypt my content")
144+ KeyNavigation.tab: optoutCheck
145+ }
146+
147+ LocalComponents.CheckableSetting {
148+ id: optoutCheck
149+ objectName: "optoutCheck"
150+ showDivider: false
151+ anchors.left: parent.left
152+ anchors.right: parent.right
153+ anchors.top: encryptCheck.bottom
154+ anchors.topMargin: units.gu(3)
155+ text: i18n.tr("Opt out of cloud account (not recommended)")
156+ KeyNavigation.tab: termsCheck
157+ visible: false // TODO re-enable in Phase 2
158+ }
159+
160+ LocalComponents.CheckableSetting {
161+ id: termsCheck
162+ objectName: "termsCheck"
163+ showDivider: false
164+ anchors.left: parent.left
165+ anchors.right: parent.right
166+ anchors.top: optoutCheck.bottom
167+ anchors.topMargin: units.gu(1)
168+ text: i18n.tr("I have read and accept the Ubuntu account <a href='#'>terms of service</a>")
169+ //onLinkActivated: pageStack.load(Qt.resolvedUrl("here-terms.qml")) // TODO show terms
170+ KeyNavigation.tab: emailInput
171+ visible: false // TODO re-enable in Phase 2
172+ }
173+ }
174+
175+ Component {
176+ id: forwardButton
177+ LocalComponents.StackButton {
178+ enabled: emailInput.acceptableInput && nameInput.text !== "" &&
179+ //termsCheck.checked && // TODO re-enable in Phase 2
180+ pass2Input.text.length > 5 && passInput.text === pass2Input.text
181+ text: i18n.tr("Sign Up")
182+ onClicked: pageStack.next() // TODO sign up against U1
183+ }
184+ }
185+}