Warning, /network/neochat/src/qml/Homeserver.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         urlField.forceActiveFocus();
0017     }
0018 
0019     FormCard.FormTextFieldDelegate {
0020         id: urlField
0021         label: i18n("Server Url:")
0022         validator: RegularExpressionValidator {
0023             regularExpression: /([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9]+(:[0-9]+)?/
0024         }
0025         onTextChanged: timer.restart()
0026         statusMessage: Registration.status === Registration.ServerNoRegistration ? i18n("Registration is disabled on this server.") : ""
0027         Keys.onReturnPressed: {
0028             if (root.nextAction.enabled) {
0029                 root.nextAction.trigger();
0030             }
0031         }
0032     }
0033 
0034     Timer {
0035         id: timer
0036         interval: 500
0037         onTriggered: Registration.homeserver = urlField.text
0038     }
0039 
0040     nextAction: Kirigami.Action {
0041         text: Registration.testing ? i18n("Loading") : null
0042         enabled: Registration.status > Registration.ServerNoRegistration
0043         onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
0044     }
0045     previousAction: Kirigami.Action {
0046         onTriggered: root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml")
0047     }
0048 }