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

0001 // SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Layouts
0007 
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.kirigamiaddons.formcard as FormCard
0010 
0011 import org.kde.neochat
0012 
0013 LoginStep {
0014     id: root
0015 
0016     onActiveFocusChanged: if (activeFocus)
0017         matrixIdField.forceActiveFocus()
0018 
0019     Component.onCompleted: {
0020         LoginHelper.matrixId = "";
0021     }
0022 
0023     FormCard.FormTextFieldDelegate {
0024         id: matrixIdField
0025         label: i18n("Matrix ID:")
0026         placeholderText: "@user:example.org"
0027         Accessible.name: i18n("Matrix ID")
0028         onTextChanged: {
0029             LoginHelper.matrixId = text;
0030         }
0031 
0032         Keys.onReturnPressed: {
0033             root.nextAction.trigger();
0034         }
0035     }
0036 
0037     nextAction: Kirigami.Action {
0038         text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue")
0039         onTriggered: {
0040             if (LoginHelper.supportsSso && LoginHelper.supportsPassword) {
0041                 processed("qrc:/org/kde/neochat/qml/LoginMethod.qml");
0042             } else if (LoginHelper.supportsSso) {
0043                 processed("qrc:/org/kde/neochat/qml/Sso.qml");
0044             } else {
0045                 processed("qrc:/org/kde/neochat/qml/Password.qml");
0046             }
0047         }
0048         enabled: LoginHelper.homeserverReachable
0049     }
0050     previousAction: Kirigami.Action {
0051         onTriggered: {
0052             root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml");
0053         }
0054     }
0055 }