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) {
0016         emailField.forceActiveFocus();
0017     }
0018 
0019     FormCard.FormTextFieldDelegate {
0020         id: emailField
0021         label: i18n("Add an e-mail address:")
0022         placeholderText: "user@example.com"
0023         onTextChanged: Registration.email = text
0024         Keys.onReturnPressed: {
0025             if (root.nextAction.enabled) {
0026                 root.nextAction.trigger();
0027             }
0028         }
0029     }
0030 
0031     FormCard.FormTextDelegate {
0032         id: confirmMessage
0033         text: i18n("Confirm e-mail address")
0034         visible: false
0035         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")
0036     }
0037 
0038     FormCard.FormButtonDelegate {
0039         id: resendButton
0040         text: i18nc("@button", "Re-send confirmation e-mail")
0041         onClicked: Registration.registerEmail()
0042         visible: false
0043     }
0044 
0045     nextAction: Kirigami.Action {
0046         enabled: emailField.text.length > 0
0047         onTriggered: {
0048             if (confirmMessage.visible) {
0049                 Registration.registerAccount();
0050             } else {
0051                 Registration.registerEmail();
0052                 confirmMessage.visible = true;
0053                 resendButton.visible = true;
0054             }
0055         }
0056     }
0057     previousAction: Kirigami.Action {
0058         onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
0059     }
0060 }