@@ -33,6 +33,12 @@ LocalComponents.Page {
3333
3434 readonly property alias password: passwordField.text
3535 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+ }
3642
3743 Flickable {
3844 id: column
@@ -105,6 +111,11 @@ LocalComponents.Page {
105111 inputMethodHints: Qt.ImhDigitsOnly
106112 validator: RegExpValidator { regExp: /^\d{4}$/ }
107113 maximumLength: 4
114+ onAccepted: {
115+ if (passwordsMatching) {
116+ savePasswordAndGoNext();
117+ }
118+ }
108119 onActiveFocusChanged: {
109120 if (activeFocus) {
110121 column.contentY = y
@@ -140,11 +151,8 @@ LocalComponents.Page {
140151 id: forwardButton
141152 LocalComponents.StackButton {
142153 text: i18n.tr("Next")
143− enabled: password != "" && password == password2
144− onClicked: {
145− root.password = password;
146− pageStack.next();
147− }
154+ enabled: passwordsMatching
155+ onClicked: savePasswordAndGoNext()
148156 }
149157 }
150158}