Warning, /network/neochat/src/qml/Email.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Layouts
0006 
0007 import org.kde.kirigami as Kirigami
0008 import org.kde.kirigamiaddons.formcard as FormCard
0009 
0010 import org.kde.neochat
0011 
0012 LoginStep {
0013     id: root
0014 
0015     onActiveFocusChanged: if (activeFocus) emailField.forceActiveFocus()
0016 
0017     FormCard.FormTextFieldDelegate {
0018         id: emailField
0019         label: i18n("Add an e-mail address:")
0020         placeholderText: "user@example.com"
0021         onTextChanged: Registration.email = text
0022         Keys.onReturnPressed: {
0023             if (root.nextAction.enabled) {
0024                 root.nextAction.trigger()
0025             }
0026         }
0027     }
0028 
0029     FormCard.FormTextDelegate {
0030         id: confirmMessage
0031         text: i18n("Confirm e-mail address")
0032         visible: false
0033         description: i18n("A confirmation e-mail has been sent to your address. Please continue here <b>after</b> clicking on the confirmation link in the e-mail")
0034     }
0035 
0036     FormCard.FormButtonDelegate {
0037         id: resendButton
0038         text: i18nc("@button", "Re-send confirmation e-mail")
0039         onClicked: Registration.registerEmail()
0040         visible: false
0041     }
0042 
0043     nextAction: Kirigami.Action {
0044         enabled: emailField.text.length > 0
0045         onTriggered: {
0046             if (confirmMessage.visible) {
0047                 Registration.registerAccount()
0048             } else {
0049                 Registration.registerEmail()
0050                 confirmMessage.visible = true
0051                 resendButton.visible = true
0052             }
0053         }
0054     }
0055     previousAction: Kirigami.Action {
0056         onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
0057     }
0058 }