on xenial help sign in
Advance welcome wizard when pressing enter in text fields
0a3913bMiguel Gutiérrez
qml/Wizard/Pages/60-account.qml+10−10
@@ -26,9 +26,13 @@ LocalComponents.Page {
26 forwardButtonSourceComponent: forwardButton
26 forwardButtonSourceComponent: forwardButton
27 onlyOnInstall: true
27 onlyOnInstall: true
28
28
29− QtObject {
30− id: d
31− readonly property string validName: nameInput.text.trim()
29+ readonly property string validName: nameInput.text.trim()
30+
31+ function saveNameAndGoNext() {
32+ if (validName) {
33+ AccountsService.realName = validName;
34+ }
35+ pageStack.next();
32 }
36 }
33
37
34 Column {
38 Column {
@@ -57,19 +61,15 @@ LocalComponents.Page {
57 anchors.left: parent.left
61 anchors.left: parent.left
58 anchors.right: parent.right
62 anchors.right: parent.right
59 inputMethodHints: Qt.ImhNoPredictiveText
63 inputMethodHints: Qt.ImhNoPredictiveText
64+ onAccepted: saveNameAndGoNext()
60 }
65 }
61 }
66 }
62
67
63 Component {
68 Component {
64 id: forwardButton
69 id: forwardButton
65 LocalComponents.StackButton {
70 LocalComponents.StackButton {
66− text: d.validName ? i18n.tr("Next") : i18n.tr("Skip")
71+ text: validName ? i18n.tr("Next") : i18n.tr("Skip")
67− onClicked: {
72+ onClicked: saveNameAndGoNext()
68− if (d.validName) {
69− AccountsService.realName = d.validName;
70− }
71− pageStack.next();
72− }
73 }
73 }
74 }
74 }
75}
75}
qml/Wizard/Pages/passcode-desktop.qml+13−5
@@ -33,6 +33,12 @@ LocalComponents.Page {
33
33
34 readonly property alias password: passwordField.text
34 readonly property alias password: passwordField.text
35 readonly property alias password2: password2Field.text
35 readonly property alias password2: password2Field.text
36+ readonly property bool passwordsMatching: password != "" && password == password2
37+
38+ function savePasswordAndGoNext() {
39+ root.password = password;
40+ pageStack.next();
41+ }
36
42
37 Flickable {
43 Flickable {
38 id: column
44 id: column
@@ -105,6 +111,11 @@ LocalComponents.Page {
105 inputMethodHints: Qt.ImhDigitsOnly
111 inputMethodHints: Qt.ImhDigitsOnly
106 validator: RegExpValidator { regExp: /^\d{4}$/ }
112 validator: RegExpValidator { regExp: /^\d{4}$/ }
107 maximumLength: 4
113 maximumLength: 4
114+ onAccepted: {
115+ if (passwordsMatching) {
116+ savePasswordAndGoNext();
117+ }
118+ }
108 onActiveFocusChanged: {
119 onActiveFocusChanged: {
109 if (activeFocus) {
120 if (activeFocus) {
110 column.contentY = y
121 column.contentY = y
@@ -140,11 +151,8 @@ LocalComponents.Page {
140 id: forwardButton
151 id: forwardButton
141 LocalComponents.StackButton {
152 LocalComponents.StackButton {
142 text: i18n.tr("Next")
153 text: i18n.tr("Next")
143− enabled: password != "" && password == password2
154+ enabled: passwordsMatching
144− onClicked: {
155+ onClicked: savePasswordAndGoNext()
145− root.password = password;
146− pageStack.next();
147− }
148 }
156 }
149 }
157 }
150}
158}
qml/Wizard/Pages/password-set.qml+11−4
@@ -35,6 +35,11 @@ LocalComponents.Page {
35 readonly property alias password2: password2Field.text
35 readonly property alias password2: password2Field.text
36 readonly property bool passwordsMatching: password == password2 && password.trim().length > 7
36 readonly property bool passwordsMatching: password == password2 && password.trim().length > 7
37
37
38+ function savePasswordAndGoNext() {
39+ root.password = password;
40+ pageStack.next();
41+ }
42+
38 Flickable {
43 Flickable {
39 id: column
44 id: column
40 clip: true
45 clip: true
@@ -114,6 +119,11 @@ LocalComponents.Page {
114 id: password2Field
119 id: password2Field
115 objectName: "password2Field"
120 objectName: "password2Field"
116 echoMode: TextInput.Password
121 echoMode: TextInput.Password
122+ onAccepted: {
123+ if (passwordsMatching) {
124+ savePasswordAndGoNext();
125+ }
126+ }
117 onActiveFocusChanged: {
127 onActiveFocusChanged: {
118 if (activeFocus) {
128 if (activeFocus) {
119 column.contentY = pass2Label.y
129 column.contentY = pass2Label.y
@@ -141,10 +151,7 @@ LocalComponents.Page {
141 LocalComponents.StackButton {
151 LocalComponents.StackButton {
142 text: i18n.tr("Next")
152 text: i18n.tr("Next")
143 enabled: passwordsMatching
153 enabled: passwordsMatching
144− onClicked: {
154+ onClicked: savePasswordAndGoNext()
145− root.password = password;
146− pageStack.next();
147− }
148 }
155 }
149 }
156 }
150}
157}