on xenial help sign in
one real name, Skip/Next buttons
commitd53f2300745783da83854a4ca16194170fedad70 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 2 Mar 2016, 21:48 (11 years ago) parentcffa644
1 file changed+10−53
qml/Wizard/Pages/60-account.qml+10−53
qml/Wizard/Pages/60-account.qml+10−53
@@ -31,30 +31,18 @@ LocalComponents.Page {
3131
3232 QtObject {
3333 id: d
34−
35− function advance() {
36− var tmp = nameInput.text + " " + surnameInput.text;
37− var realName = tmp.trim();
38− if (realName !== "") {
39− AccountsService.realName = realName;
40− }
41− pageStack.next();
42− }
34+ readonly property string validName: nameInput.text.trim()
4335 }
4436
45− Flickable {
37+ Column {
4638 id: column
47− clip: true
48− flickableDirection: Flickable.VerticalFlick
39+ spacing: units.gu(1)
4940 anchors {
5041 fill: content
5142 leftMargin: parent.leftMargin
5243 rightMargin: parent.rightMargin
5344 topMargin: customMargin
5445 }
55− bottomMargin: Qt.inputMethod.visible && !Qt.inputMethod.animating ? Qt.inputMethod.keyboardRectangle.height : 0
56−
57− Behavior on contentY { UbuntuNumberAnimation {} }
5846
5947 // name
6048 Label {
@@ -71,51 +59,20 @@ LocalComponents.Page {
7159 objectName: "nameInput"
7260 anchors.left: parent.left
7361 anchors.right: parent.right
74− anchors.top: nameLabel.bottom
75− anchors.topMargin: units.gu(1)
7662 inputMethodHints: Qt.ImhNoPredictiveText
77− onAccepted: surnameInput.forceActiveFocus()
78− onActiveFocusChanged: {
79− if (activeFocus) {
80− column.contentY = nameLabel.y
81− }
82− }
83− }
84−
85− // surname
86− Label {
87− id: surnameLabel
88− anchors.left: parent.left
89− anchors.right: parent.right
90− anchors.top: nameInput.bottom
91− anchors.topMargin: units.gu(3)
92− text: i18n.tr("Your Surname")
93− color: textColor
94− font.weight: Font.Light
95− }
96−
97− LocalComponents.WizardTextField {
98− id: surnameInput
99− objectName: "surnameInput"
100− anchors.left: parent.left
101− anchors.right: parent.right
102− anchors.top: surnameLabel.bottom
103− anchors.topMargin: units.gu(1)
104− inputMethodHints: Qt.ImhNoPredictiveText
105− onAccepted: d.advance()
106− onActiveFocusChanged: {
107− if (activeFocus) {
108− column.contentY = surnameLabel.y
109− }
110− }
11163 }
11264 }
11365
11466 Component {
11567 id: forwardButton
11668 LocalComponents.StackButton {
117− text: i18n.tr("Next")
118− onClicked: d.advance();
69+ text: d.validName ? i18n.tr("Next") : i18n.tr("Skip")
70+ onClicked: {
71+ if (d.validName) {
72+ AccountsService.realName = d.validName;
73+ }
74+ pageStack.next();
75+ }
11976 }
12077 }
12178}