2020-08-13 11:15:26 +03:00
|
|
|
/*
|
|
|
|
Copyright (C) 2020 Sebastian J. Wolf
|
|
|
|
|
|
|
|
This file is part of Fernschreiber.
|
|
|
|
|
2020-08-13 18:08:14 +03:00
|
|
|
Fernschreiber is free software: you can redistribute it and/or modify
|
2020-08-13 11:15:26 +03:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
2020-08-13 18:08:14 +03:00
|
|
|
Fernschreiber is distributed in the hope that it will be useful,
|
2020-08-13 11:15:26 +03:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-10-18 01:16:15 +03:00
|
|
|
import QtQuick 2.0
|
2020-08-13 11:15:26 +03:00
|
|
|
import Sailfish.Silica 1.0
|
2020-08-13 16:35:43 +03:00
|
|
|
import WerkWolf.Fernschreiber 1.0
|
2020-08-13 11:15:26 +03:00
|
|
|
|
|
|
|
Page {
|
|
|
|
id: initializationPage
|
|
|
|
allowedOrientations: Orientation.All
|
2020-08-18 00:44:37 +03:00
|
|
|
backNavigation: false
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-08-13 16:35:43 +03:00
|
|
|
property bool loading: true
|
|
|
|
property int authorizationState: TelegramAPI.Closed
|
2020-10-01 01:55:26 +03:00
|
|
|
property var authorizationStateData: null
|
2020-08-13 16:35:43 +03:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
initializationPage.authorizationState = tdLibWrapper.getAuthorizationState();
|
2020-10-01 01:55:26 +03:00
|
|
|
initializationPage.authorizationStateData = tdLibWrapper.getAuthorizationStateData();
|
2020-08-13 16:35:43 +03:00
|
|
|
initializationPage.loading = false;
|
2020-10-01 01:55:26 +03:00
|
|
|
|
|
|
|
switch (authorizationState) {
|
|
|
|
case TelegramAPI.WaitCode:
|
|
|
|
initializationPage.loading = false;
|
|
|
|
welcomeColumn.visible = false;
|
2020-08-13 16:35:43 +03:00
|
|
|
enterPinColumn.visible = true;
|
2020-10-18 01:16:15 +03:00
|
|
|
enterPinField.focus = true
|
2020-09-16 23:36:43 +03:00
|
|
|
enterPasswordColumn.visible = false;
|
2020-10-01 01:55:26 +03:00
|
|
|
waitRegistrationColumn.visible = false;
|
|
|
|
break;
|
|
|
|
case TelegramAPI.WaitPassword:
|
|
|
|
initializationPage.loading = false;
|
|
|
|
welcomeColumn.visible = false;
|
2020-09-16 23:36:43 +03:00
|
|
|
enterPinColumn.visible = false;
|
|
|
|
enterPasswordColumn.visible = true;
|
2020-10-01 01:55:26 +03:00
|
|
|
waitRegistrationColumn.visible = false;
|
|
|
|
break;
|
|
|
|
case TelegramAPI.WaitRegistration:
|
|
|
|
initializationPage.loading = false;
|
|
|
|
welcomeColumn.visible = false;
|
|
|
|
enterPinColumn.visible = false;
|
|
|
|
enterPasswordColumn.visible = false;
|
|
|
|
waitRegistrationColumn.visible = true;
|
2020-10-18 01:16:15 +03:00
|
|
|
pageHeader.title = qsTr("User Registration")
|
2020-10-01 01:55:26 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// Nothing ;)
|
2020-08-13 16:35:43 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: tdLibWrapper
|
|
|
|
onAuthorizationStateChanged: {
|
|
|
|
switch (authorizationState) {
|
|
|
|
case TelegramAPI.WaitCode:
|
|
|
|
initializationPage.loading = false;
|
|
|
|
enterPinColumn.visible = true;
|
2020-10-18 01:16:15 +03:00
|
|
|
enterPinField.focus = true
|
2020-09-16 23:36:43 +03:00
|
|
|
enterPasswordColumn.visible = false;
|
2020-10-01 01:55:26 +03:00
|
|
|
waitRegistrationColumn.visible = false;
|
2020-09-16 23:36:43 +03:00
|
|
|
break;
|
|
|
|
case TelegramAPI.WaitPassword:
|
|
|
|
initializationPage.loading = false;
|
|
|
|
enterPinColumn.visible = false;
|
|
|
|
enterPasswordColumn.visible = true;
|
2020-10-01 01:55:26 +03:00
|
|
|
waitRegistrationColumn.visible = false;
|
|
|
|
break;
|
|
|
|
case TelegramAPI.WaitRegistration:
|
|
|
|
initializationPage.loading = false;
|
|
|
|
enterPinColumn.visible = false;
|
|
|
|
enterPasswordColumn.visible = false;
|
|
|
|
waitRegistrationColumn.visible = true;
|
2020-08-13 16:35:43 +03:00
|
|
|
break;
|
|
|
|
case TelegramAPI.AuthorizationReady:
|
2020-08-18 00:44:37 +03:00
|
|
|
initializationPage.loading = false;
|
2020-08-18 12:11:03 +03:00
|
|
|
pageStack.completeAnimation();
|
2020-08-18 00:44:37 +03:00
|
|
|
pageStack.pop();
|
2020-08-13 16:35:43 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// Nothing ;)
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
initializationPage.authorizationStateData = authorizationStateData;
|
2020-08-13 16:35:43 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-01 01:55:26 +03:00
|
|
|
|
|
|
|
SilicaFlickable {
|
|
|
|
id: welcomeFlickable
|
2020-10-18 01:16:15 +03:00
|
|
|
contentHeight: content.height
|
2020-10-01 01:55:26 +03:00
|
|
|
Behavior on contentHeight { NumberAnimation {} }
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Column {
|
2020-10-18 01:16:15 +03:00
|
|
|
id: content
|
2020-10-01 01:55:26 +03:00
|
|
|
width: parent.width
|
2020-10-18 01:16:15 +03:00
|
|
|
spacing: Theme.paddingLarge
|
2020-10-01 01:55:26 +03:00
|
|
|
|
|
|
|
PageHeader {
|
2020-10-18 01:16:15 +03:00
|
|
|
id: pageHeader
|
2020-10-01 01:55:26 +03:00
|
|
|
title: qsTr("Welcome to Fernschreiber!")
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
|
|
|
|
2020-10-01 01:55:26 +03:00
|
|
|
Image {
|
|
|
|
source: "../../images/fernschreiber.png"
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-01 01:55:26 +03:00
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
asynchronous: true
|
2020-10-18 01:16:15 +03:00
|
|
|
width: Math.min(2 * Theme.itemSizeHuge, Math.min(Screen.width, Screen.height) / 2)
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
BusyLabel {
|
|
|
|
text: qsTr("Loading...")
|
|
|
|
running: initializationPage.loading
|
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
visible: opacity > 0
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Column {
|
|
|
|
id: welcomeColumn
|
2020-10-01 01:55:26 +03:00
|
|
|
width: parent.width
|
2020-10-18 01:16:15 +03:00
|
|
|
spacing: Theme.paddingLarge
|
2020-09-16 23:36:43 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
opacity: visible ? 1 : 0
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
InfoLabel {
|
|
|
|
text: qsTr("Please enter your phone number to continue.")
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-09-16 23:36:43 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
TextField {
|
|
|
|
id: phoneNumberTextField
|
2020-10-19 17:02:34 +03:00
|
|
|
placeholderText: qsTr("Use the international format, e.g. %1").arg("+4912342424242")
|
2020-10-18 01:16:15 +03:00
|
|
|
inputMethodHints: Qt.ImhDialableCharactersOnly
|
|
|
|
labelVisible: false
|
|
|
|
width: parent.width
|
|
|
|
readonly property bool validInput: text.match(/\+[1-9][0-9]{4,}/g)
|
|
|
|
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
|
|
|
EnterKey.enabled: validInput
|
|
|
|
EnterKey.onClicked: {
|
|
|
|
validator = filledValidator
|
|
|
|
if(acceptableInput) {
|
|
|
|
continueWithPhoneNumberButton.focus = true
|
|
|
|
continueWithPhoneNumberButton.enter()
|
|
|
|
}
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-09-16 23:36:43 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Button {
|
|
|
|
id: continueWithPhoneNumberButton
|
|
|
|
text: qsTr("Continue")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
enabled: phoneNumberTextField.validInput
|
|
|
|
onClicked: enter()
|
|
|
|
function enter() {
|
|
|
|
initializationPage.loading = true;
|
|
|
|
welcomeColumn.visible = false;
|
|
|
|
tdLibWrapper.setAuthenticationPhoneNumber(phoneNumberTextField.text);
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Column {
|
|
|
|
id: pinErrorColumn
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingLarge
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
opacity: visible ? 1 : 0
|
|
|
|
visible: false
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
InfoLabel {
|
|
|
|
id: errorInfoLabel
|
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
text: ""
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
|
|
|
|
Button {
|
|
|
|
text: qsTr("OK")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
pinErrorColumn.visible = false;
|
|
|
|
welcomeColumn.visible = true;
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Column {
|
|
|
|
id: enterPasswordColumn
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingLarge
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
opacity: visible ? 1.0 : 0.0
|
|
|
|
visible: false
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
InfoLabel {
|
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
text: qsTr("Please enter your password:")
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
PasswordField {
|
|
|
|
id: enterPasswordField
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
width: parent.width - 2 * Theme.horizontalPageMargin
|
|
|
|
horizontalAlignment: TextInput.AlignHCenter
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Button {
|
|
|
|
text: qsTr("OK")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
initializationPage.loading = true;
|
|
|
|
enterPasswordColumn.visible = false;
|
|
|
|
tdLibWrapper.setAuthenticationPassword(enterPasswordField.text);
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Column {
|
|
|
|
id: enterPinColumn
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingLarge
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
opacity: visible ? 1.0 : 0.0
|
|
|
|
visible: false
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
InfoLabel {
|
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
text: qsTr("Please enter the code that you received:")
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
TextField {
|
|
|
|
id: enterPinField
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
inputMethodHints: Qt.ImhDigitsOnly
|
|
|
|
font.pixelSize: Theme.fontSizeExtraLarge
|
|
|
|
width: parent.width - 4 * Theme.paddingLarge
|
|
|
|
horizontalAlignment: TextInput.AlignHCenter
|
|
|
|
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
|
|
|
EnterKey.enabled: text.length > 0
|
|
|
|
EnterKey.onClicked: enterPinButton.enter()
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Button {
|
|
|
|
id: enterPinButton
|
|
|
|
text: qsTr("OK")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
onClicked: enter()
|
|
|
|
function enter() {
|
|
|
|
initializationPage.loading = true;
|
|
|
|
enterPinColumn.visible = false;
|
|
|
|
tdLibWrapper.setAuthenticationCode(enterPinField.text);
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Column {
|
|
|
|
id: linkingErrorColumn
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingLarge
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
opacity: visible ? 1.0 : 0.0
|
|
|
|
visible: false
|
2020-08-13 11:15:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
InfoLabel {
|
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
text: qsTr("Unable to authenticate you with the entered code.")
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Button {
|
|
|
|
text: qsTr("Enter code again")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
onClicked: {
|
|
|
|
linkingErrorColumn.visible = false;
|
|
|
|
enterPinColumn.visible = true;
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Button {
|
|
|
|
text: qsTr("Restart authentication")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
linkingErrorColumn.visible = false;
|
|
|
|
welcomeColumn.visible = true;
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
Column {
|
|
|
|
id: waitRegistrationColumn
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingLarge
|
|
|
|
|
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
opacity: visible ? 1.0 : 0.0
|
|
|
|
visible: false
|
|
|
|
|
|
|
|
InfoLabel {
|
|
|
|
id: waitRegistrationInfoLabel
|
|
|
|
property bool acknowledged
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
linkColor: Theme.primaryColor
|
|
|
|
property var stateText: initializationPage.authorizationStateData.authorization_state && initializationPage.authorizationStateData.authorization_state.terms_of_service ?
|
|
|
|
initializationPage.authorizationStateData.authorization_state.terms_of_service.text :
|
|
|
|
null
|
|
|
|
visible: !!stateText && !acknowledged
|
|
|
|
text: {
|
|
|
|
if(!stateText) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
var entities = stateText.entities;
|
|
|
|
if(entities && entities.length > 0 && entities[0]["type"]["@type"] === "textEntityTypeTextUrl") { //we just use the first entity for now.
|
|
|
|
var offset = entities[0].offset;
|
|
|
|
var length = entities[0].length;
|
|
|
|
return (stateText.text.slice(0,entities[0].offset)
|
|
|
|
+ "<a href=\""+entities[0]["type"]["url"]+"\">"
|
|
|
|
+ stateText.text.slice(entities[0].offset, entities[0].offset + entities[0].length)
|
|
|
|
+ '</a>'
|
|
|
|
+ stateText.text.slice(entities[0].offset + entities[0].length)).replace(/\n/gm, "<br>");
|
|
|
|
}
|
|
|
|
return stateText.text.replace(/\n/gm, "<br>");
|
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
|
|
|
|
Button {
|
|
|
|
visible: waitRegistrationInfoLabel.visible
|
|
|
|
text: qsTr("OK")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
waitRegistrationInfoLabel.acknowledged = true;
|
|
|
|
userFirstNameTextField.focus = true
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
RegExpValidator {
|
|
|
|
id: filledValidator
|
|
|
|
regExp: /.+/
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
TextField {
|
|
|
|
id: userFirstNameTextField
|
|
|
|
visible: !waitRegistrationInfoLabel.visible
|
|
|
|
opacity: visible ? 1.0 : 0.0
|
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
placeholderText: qsTr("Enter your First Name")
|
|
|
|
labelVisible: false
|
|
|
|
width: parent.width
|
|
|
|
EnterKey.iconSource: !!text ? "image://theme/icon-m-enter-next" : "image://theme/icon-m-text-input"
|
|
|
|
EnterKey.onClicked: {
|
|
|
|
validator = filledValidator
|
|
|
|
if(acceptableInput) userLastNameTextField.focus = true;
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
TextField {
|
|
|
|
id: userLastNameTextField
|
|
|
|
visible: !waitRegistrationInfoLabel.visible
|
|
|
|
opacity: visible ? 1.0 : 0.0
|
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
placeholderText: qsTr("Enter your Last Name")
|
|
|
|
labelVisible: false
|
|
|
|
width: parent.width
|
|
|
|
EnterKey.iconSource: !!text ? "image://theme/icon-m-enter-accept" : "image://theme/icon-m-text-input"
|
|
|
|
EnterKey.onClicked: {
|
|
|
|
validator = filledValidator
|
|
|
|
if(acceptableInput) registerUserButton.onClicked(null);
|
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
Button {
|
|
|
|
id: registerUserButton
|
|
|
|
visible: !waitRegistrationInfoLabel.visible
|
|
|
|
opacity: visible ? 1.0 : 0.0
|
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
text: qsTr("Register User")
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
2020-10-01 01:55:26 +03:00
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
onClicked: {
|
|
|
|
userFirstNameTextField.validator = filledValidator
|
|
|
|
userLastNameTextField.validator = filledValidator
|
|
|
|
if(userFirstNameTextField.acceptableInput && userLastNameTextField.acceptableInput) {
|
|
|
|
tdLibWrapper.registerUser(userFirstNameTextField.text, userLastNameTextField.text);
|
|
|
|
} else if(!userFirstNameTextField.acceptableInput) {
|
|
|
|
userFirstNameTextField.focus = true;
|
|
|
|
} else {
|
|
|
|
userLastNameTextField.focus = true;
|
|
|
|
}
|
2020-10-01 01:55:26 +03:00
|
|
|
|
2020-10-18 01:16:15 +03:00
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
|
|
|
}
|
2020-10-18 01:16:15 +03:00
|
|
|
|
|
|
|
Item {
|
|
|
|
width: 1
|
|
|
|
height: Theme.paddingLarge
|
|
|
|
}
|
2020-08-13 11:15:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|