on xenial help sign in
reworked the Account page
3370734Lukáš Tinkl
qml/Wizard/Pages/60-account.qml+29−104
@@ -21,7 +21,7 @@ import ".." as LocalComponents
21
21
22LocalComponents.Page {
22LocalComponents.Page {
23 objectName: "accountPage"
23 objectName: "accountPage"
24− title: i18n.tr("User Details")
24+ title: i18n.tr("Personalize Your Device")
25
25
26 forwardButtonSourceComponent: forwardButton
26 forwardButtonSourceComponent: forwardButton
27
27
@@ -32,12 +32,12 @@ LocalComponents.Page {
32 QtObject {
32 QtObject {
33 id: d
33 id: d
34
34
35− readonly property bool validInput: true //nameInput.text !== ""
36− // && pass2Input.text.length > 7 && passInput.text === pass2Input.text
37−
38 function advance() {
35 function advance() {
39− //root.password = passInput.text;
36+ var tmp = nameInput.text + " " + surnameInput.text;
40− AccountsService.realName = nameInput.text;
37+ var realName = tmp.trim();
38+ if (realName !== "") {
39+ AccountsService.realName = realName;
40+ }
41 pageStack.next();
41 pageStack.next();
42 }
42 }
43 }
43 }
@@ -50,132 +50,57 @@ LocalComponents.Page {
50 anchors.leftMargin: parent.leftMargin
50 anchors.leftMargin: parent.leftMargin
51 anchors.rightMargin: parent.rightMargin
51 anchors.rightMargin: parent.rightMargin
52 anchors.topMargin: customMargin
52 anchors.topMargin: customMargin
53− height: contentHeight - buttonBarHeight - (Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0) - titleRectHeight
54− contentHeight: contentItem.childrenRect.height
55−
56− Behavior on contentY { UbuntuNumberAnimation{} }
57
53
58− // notice
54+ // name
59 Label {
55 Label {
60− id: noticeLabel
56+ id: nameLabel
61 anchors.left: parent.left
57 anchors.left: parent.left
62 anchors.right: parent.right
58 anchors.right: parent.right
63− wrapMode: Text.Wrap
59+ text: i18n.tr("Your Name")
64− text: i18n.tr("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.")
65 color: textColor
60 color: textColor
66− fontSize: "small"
67 font.weight: Font.Light
61 font.weight: Font.Light
68− lineHeight: 1.2
69− width: content.width
70 }
62 }
71
63
72− // username
64+ LocalComponents.WizardTextField {
65+ id: nameInput
66+ objectName: "nameInput"
67+ anchors.left: parent.left
68+ anchors.right: parent.right
69+ anchors.top: nameLabel.bottom
70+ anchors.topMargin: units.gu(1)
71+ inputMethodHints: Qt.ImhNoPredictiveText
72+ onAccepted: surnameInput.forceActiveFocus()
73+ }
74+
75+ // surname
73 Label {
76 Label {
74− id: nameLabel
77+ id: surnameLabel
75 anchors.left: parent.left
78 anchors.left: parent.left
76 anchors.right: parent.right
79 anchors.right: parent.right
77− anchors.top: noticeLabel.bottom
80+ anchors.top: nameInput.bottom
78 anchors.topMargin: units.gu(3)
81 anchors.topMargin: units.gu(3)
79− text: i18n.tr("Your name")
82+ text: i18n.tr("Your Surname")
80 color: textColor
83 color: textColor
81 font.weight: Font.Light
84 font.weight: Font.Light
82 }
85 }
83
86
84 LocalComponents.WizardTextField {
87 LocalComponents.WizardTextField {
85− id: nameInput
88+ id: surnameInput
86− objectName: "nameInput"
89+ objectName: "surnameInput"
87 anchors.left: parent.left
90 anchors.left: parent.left
88 anchors.right: parent.right
91 anchors.right: parent.right
89− anchors.top: nameLabel.bottom
92+ anchors.top: surnameLabel.bottom
90 anchors.topMargin: units.gu(1)
93 anchors.topMargin: units.gu(1)
91−// onActiveFocusChanged: {
92−// if (activeFocus) {
93−// column.contentY = nameLabel.y
94−// }
95−// }
96 inputMethodHints: Qt.ImhNoPredictiveText
94 inputMethodHints: Qt.ImhNoPredictiveText
97− //onAccepted: passInput.forceActiveFocus()
95+ onAccepted: d.advance()
98 }
96 }
99−
100−// // password
101−// Label {
102−// id: passLabel
103−// anchors.left: parent.left
104−// anchors.right: parent.right
105−// anchors.top: nameInput.bottom
106−// anchors.topMargin: units.gu(2)
107−// text: i18n.tr("Password")
108−// color: textColor
109−// font.weight: Font.Light
110−// }
111−
112−// LocalComponents.WizardTextField {
113−// id: passInput
114−// objectName: "passInput"
115−// anchors.left: parent.left
116−// anchors.right: parent.right
117−// anchors.top: passLabel.bottom
118−// anchors.topMargin: units.gu(1)
119−// echoMode: TextInput.Password
120−// placeholderText: i18n.tr("Use letters and numbers")
121−// inputMethodHints: Qt.ImhNoPredictiveText
122−// onActiveFocusChanged: {
123−// if (activeFocus) {
124−// column.contentY = passLabel.y
125−// }
126−// }
127−// onAccepted: pass2Input.forceActiveFocus()
128−// }
129−
130−// // password meter
131−// LocalComponents.PasswordMeter {
132−// id: passMeter
133−// anchors.left: parent.left
134−// anchors.right: parent.right
135−// anchors.top: passInput.bottom
136−// anchors.topMargin: units.gu(1)
137−// password: passInput.text
138−// }
139−
140−// // repeat password
141−// Label {
142−// id: pass2Label
143−// anchors.left: parent.left
144−// anchors.right: parent.right
145−// anchors.top: passMeter.bottom
146−// anchors.topMargin: passInput.text !== "" ? units.gu(4) : units.gu(2)
147−// wrapMode: Text.Wrap
148−// text: i18n.tr("Repeat password")
149−// color: textColor
150−// font.weight: Font.Light
151−// }
152−
153−// LocalComponents.WizardTextField {
154−// id: pass2Input
155−// objectName: "pass2Input"
156−// anchors.left: parent.left
157−// anchors.right: parent.right
158−// anchors.top: pass2Label.bottom
159−// anchors.topMargin: units.gu(1)
160−// echoMode: TextInput.Password
161−// inputMethodHints: Qt.ImhNoPredictiveText
162−// onActiveFocusChanged: {
163−// if (activeFocus) {
164−// column.contentY = pass2Label.y
165−// }
166−// }
167−// onAccepted: if (d.validInput) d.advance();
168−// }
169 }
97 }
170
98
171 Component {
99 Component {
172 id: forwardButton
100 id: forwardButton
173 LocalComponents.StackButton {
101 LocalComponents.StackButton {
174− enabled: d.validInput
175 text: i18n.tr("Next")
102 text: i18n.tr("Next")
176− onClicked: {
103+ onClicked: d.advance();
177− d.advance();
178− }
179 }
104 }
180 }
105 }
181}
106}