Warning, /network/tokodon/src/content/ui/LoginFlow/LoginPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> 0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 0004 import QtQuick 0005 import QtQuick.Controls 2 as QQC2 0006 import QtQuick.Layouts 0007 import QtQml.Models 0008 0009 import org.kde.kirigami 2 as Kirigami 0010 import org.kde.kirigamiaddons.formcard 1 as FormCard 0011 import org.kde.kirigamiaddons.components 1 as Components 0012 0013 import org.kde.tokodon 0014 0015 MastoPage { 0016 title: i18nc("@title:window", "Login") 0017 0018 data: Connections { 0019 target: Controller 0020 function onNetworkErrorOccurred(error) { 0021 message.text = i18nc("@info:status Network status", "Failed to contact server: %1. Please check your proxy settings.", error) 0022 message.visible = true; 0023 } 0024 } 0025 0026 header: Components.Banner { 0027 id: message 0028 type: Kirigami.MessageType.Error 0029 width: parent.width 0030 0031 showCloseButton: true 0032 0033 actions: Kirigami.Action { 0034 text: i18n("Proxy Settings") 0035 icon.name: "settings-configure" 0036 onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.tokodon", "NetworkProxyPage")) 0037 } 0038 } 0039 0040 Component.onCompleted: instanceUrl.forceActiveFocus() 0041 0042 FormCard.FormHeader { 0043 title: i18nc("@title:group", "Login") 0044 } 0045 0046 FormCard.FormCard { 0047 FormCard.FormTextFieldDelegate { 0048 id: instanceUrl 0049 label: i18n("Server URL:") 0050 placeholderText: i18n("mastodon.social") 0051 onAccepted: continueButton.clicked() 0052 inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase 0053 } 0054 0055 FormCard.FormDelegateSeparator { above: adminScopeDelegate } 0056 0057 FormCard.FormCheckDelegate { 0058 id: adminScopeDelegate 0059 text: i18n("Enable moderation tools") 0060 description: i18n("Allow Tokodon to access moderation tools. Try disabling this if you have trouble logging in.") 0061 checked: true 0062 } 0063 0064 FormCard.FormDelegateSeparator { above: continueButton } 0065 0066 FormCard.FormButtonDelegate { 0067 id: continueButton 0068 text: i18n("Continue") 0069 onClicked: { 0070 instanceUrl.statusMessage = ""; 0071 0072 if (!instanceUrl.text) { 0073 instanceUrl.status = Kirigami.MessageType.Error; 0074 instanceUrl.statusMessage = i18n("Server URL must not be empty!"); 0075 return; 0076 } 0077 0078 const account = AccountManager.createNewAccount(instanceUrl.text, sslErrors.checked, adminScopeDelegate.checked); 0079 0080 account.registered.connect(() => { 0081 Window.window.pageStack.layers.push(Qt.createComponent("org.kde.tokodon", "AuthorizationPage"), { 0082 account: account, 0083 }); 0084 }); 0085 } 0086 } 0087 } 0088 0089 FormCard.FormHeader { 0090 title: i18nc("@title:group", "Network Settings") 0091 } 0092 0093 FormCard.FormCard { 0094 FormCard.FormSwitchDelegate { 0095 id: sslErrors 0096 text: i18nc("@option:check Login page", "Ignore SSL errors") 0097 } 0098 0099 FormCard.FormDelegateSeparator { above: proxySettingDelegate; below: sslErrors } 0100 0101 FormCard.FormButtonDelegate { 0102 id: proxySettingDelegate 0103 text: i18n("Proxy Settings") 0104 onClicked: Window.window.pageStack.layers.push(Qt.createComponent("org.kde.tokodon", "NetworkProxyPage")) 0105 } 0106 } 0107 }