Warning, /network/tokodon/src/content/ui/LoginPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 import QtQuick 2.15
0005 import org.kde.kirigami 2.19 as Kirigami
0006 import QtQuick.Controls 2.15 as QQC2
0007 import QtQuick.Layouts 1.15
0008 import QtQml.Models 2.15
0009 import org.kde.kmasto 1.0
0010 import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
0011 
0012 MastoPage {
0013     objectName: 'loginPage'
0014     title: i18n("Login")
0015 
0016     leftPadding: 0
0017     rightPadding: 0
0018 
0019     Connections {
0020         target: Controller
0021         function onNetworkErrorOccurred(error) {
0022             applicationWindow().showPassiveNotification(i18nc("@info:status Network status", "Failed to contact server: %1. Please check your settings.", error));
0023         }
0024     }
0025 
0026     ColumnLayout {
0027         width: parent.width
0028         MobileForm.FormCard {
0029             Layout.topMargin: Kirigami.Units.largeSpacing
0030             Layout.fillWidth: true
0031             contentItem: ColumnLayout {
0032                 spacing: 0
0033 
0034                 MobileForm.FormCardHeader {
0035                     title: i18n("Welcome to Tokodon")
0036                 }
0037 
0038                 MobileForm.FormTextFieldDelegate {
0039                     id: instanceUrl
0040                     label: i18n("Instance Url:")
0041                     onAccepted: continueButton.clicked()
0042                     inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
0043                 }
0044 
0045                 MobileForm.FormDelegateSeparator { above: continueButton }
0046 
0047                 MobileForm.FormButtonDelegate {
0048                     id: continueButton
0049                     text: i18n("Continue")
0050                     onClicked: {
0051                         if (!instanceUrl.text) {
0052                             applicationWindow().showPassiveNotification(i18n("Instance URL must not be empty!"));
0053                             return;
0054                         }
0055 
0056                         const account = AccountManager.createNewAccount(instanceUrl.text, sslErrors.checked);
0057 
0058                         account.registered.connect(() => {
0059                             const page = pageStack.layers.push('qrc:/content/ui/AuthorizationPage.qml', {
0060                                 account: account,
0061                             });
0062 
0063                         });
0064                     }
0065                 }
0066             }
0067         }
0068 
0069         MobileForm.FormCard {
0070             Layout.topMargin: Kirigami.Units.largeSpacing
0071             Layout.fillWidth: true
0072             contentItem: ColumnLayout {
0073                 spacing: 0
0074 
0075                 MobileForm.FormCardHeader {
0076                     title: i18nc("@title:group Login page", "Network Settings")
0077                 }
0078 
0079                 MobileForm.FormSwitchDelegate {
0080                     id: sslErrors
0081                     text: i18nc("@option:check Login page", "Ignore SSL errors")
0082                 }
0083 
0084                 MobileForm.FormDelegateSeparator { above: proxySettingDelegate; below: sslErrors }
0085 
0086                 MobileForm.FormButtonDelegate {
0087                     id: proxySettingDelegate
0088                     text: i18n("Proxy Settings")
0089                     onClicked: pageStack.layers.push('qrc:/content/ui/Settings/NetworkProxyPage.qml')
0090                 }
0091             }
0092         }
0093     }
0094 }