Warning, /network/neochat/src/qml/Username.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 
0006 import org.kde.kirigami as Kirigami
0007 import org.kde.kirigamiaddons.formcard as FormCard
0008 
0009 import org.kde.neochat
0010 
0011 LoginStep {
0012     id: root
0013 
0014     onActiveFocusChanged: if (activeFocus) usernameField.forceActiveFocus()
0015 
0016     FormCard.FormTextFieldDelegate {
0017         id: usernameField
0018         label: i18n("Username:")
0019         placeholderText: "user"
0020         onTextChanged: timer.restart()
0021         statusMessage: Registration.status === Registration.UsernameTaken ? i18n("Username unavailable") : ""
0022         Keys.onReturnPressed: {
0023             if (root.nextAction.enabled) {
0024                 root.nextAction.trigger()
0025             }
0026         }
0027     }
0028 
0029     Timer {
0030         id: timer
0031         interval: 500
0032         onTriggered: Registration.username = usernameField.text
0033     }
0034 
0035     nextAction: Kirigami.Action {
0036         text: Registration.status === Registration.TestingUsername ? i18n("Loading") : null
0037 
0038         onTriggered: root.processed("qrc:/org/kde/neochat/qml/RegisterPassword.qml")
0039         enabled: Registration.status === Registration.Ready
0040     }
0041 
0042     previousAction: Kirigami.Action {
0043         onTriggered: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml")
0044     }
0045 }