on xenial help sign in
one real name, Skip/Next buttons
d53f230Lukáš Tinkl
qml/Wizard/Pages/60-account.qml+10−53
@@ -31,30 +31,18 @@ LocalComponents.Page {
31
31
32 QtObject {
32 QtObject {
33 id: d
33 id: d
34−
34+ readonly property string validName: nameInput.text.trim()
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− }
43 }
35 }
44
36
45− Flickable {
37+ Column {
46 id: column
38 id: column
47− clip: true
39+ spacing: units.gu(1)
48− flickableDirection: Flickable.VerticalFlick
49 anchors {
40 anchors {
50 fill: content
41 fill: content
51 leftMargin: parent.leftMargin
42 leftMargin: parent.leftMargin
52 rightMargin: parent.rightMargin
43 rightMargin: parent.rightMargin
53 topMargin: customMargin
44 topMargin: customMargin
54 }
45 }
55− bottomMargin: Qt.inputMethod.visible && !Qt.inputMethod.animating ? Qt.inputMethod.keyboardRectangle.height : 0
56−
57− Behavior on contentY { UbuntuNumberAnimation {} }
58
46
59 // name
47 // name
60 Label {
48 Label {
@@ -71,51 +59,20 @@ LocalComponents.Page {
71 objectName: "nameInput"
59 objectName: "nameInput"
72 anchors.left: parent.left
60 anchors.left: parent.left
73 anchors.right: parent.right
61 anchors.right: parent.right
74− anchors.top: nameLabel.bottom
75− anchors.topMargin: units.gu(1)
76 inputMethodHints: Qt.ImhNoPredictiveText
62 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− }
111 }
63 }
112 }
64 }
113
65
114 Component {
66 Component {
115 id: forwardButton
67 id: forwardButton
116 LocalComponents.StackButton {
68 LocalComponents.StackButton {
117− text: i18n.tr("Next")
69+ text: d.validName ? i18n.tr("Next") : i18n.tr("Skip")
118− onClicked: d.advance();
70+ onClicked: {
71+ if (d.validName) {
72+ AccountsService.realName = d.validName;
73+ }
74+ pageStack.next();
75+ }
119 }
76 }
120 }
77 }
121}
78}