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) {
0015         usernameField.forceActiveFocus();
0016     }
0017 
0018     FormCard.FormTextFieldDelegate {
0019         id: usernameField
0020         label: i18n("Username:")
0021         placeholderText: "user"
0022         onTextChanged: timer.restart()
0023         statusMessage: Registration.status === Registration.UsernameTaken ? i18n("Username unavailable") : ""
0024         Keys.onReturnPressed: {
0025             if (root.nextAction.enabled) {
0026                 root.nextAction.trigger();
0027             }
0028         }
0029     }
0030 
0031     Timer {
0032         id: timer
0033         interval: 500
0034         onTriggered: Registration.username = usernameField.text
0035     }
0036 
0037     nextAction: Kirigami.Action {
0038         text: Registration.status === Registration.TestingUsername ? i18n("Loading") : null
0039 
0040         onTriggered: root.processed("qrc:/org/kde/neochat/qml/RegisterPassword.qml")
0041         enabled: Registration.status === Registration.Ready
0042     }
0043 
0044     previousAction: Kirigami.Action {
0045         onTriggered: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml")
0046     }
0047 }