Warning, /plasma/drkonqi/src/qml/LoginPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2022-2023 Harald Sitter <sitter@kde.org> 0003 0004 import QtQuick 2.15 0005 import QtQuick.Layouts 1.15 0006 import QtQuick.Controls 2.15 as QQC2 0007 import org.kde.kirigami 2.12 as Kirigami 0008 import org.kde.kitemmodels 1.0 as KItemModels 0009 import org.kde.syntaxhighlighting 1.0 0010 0011 import org.kde.drkonqi 1.0 0012 0013 Kirigami.ScrollablePage { 0014 id: page 0015 title: i18nc("@title", "Login into the bug tracking system") 0016 0017 property bool loggedIn: false 0018 0019 onLoggedInChanged: { 0020 console.log("logged in changed") 0021 if (loggedIn) { 0022 pageStack.push('qrc:/ui/DuplicatesLoadingPage.qml') 0023 } 0024 } 0025 0026 Connections { 0027 target: bugzilla 0028 function onLoginFinished(loggedIn) { 0029 console.log("logged in " + loggedIn) 0030 page.loggedIn = loggedIn 0031 if (rememberBox.checked) { 0032 credentialStore.email = emailField.text 0033 credentialStore.password = passwordField.text 0034 credentialStore.store() 0035 } else { 0036 credentialStore.drop() 0037 } 0038 } 0039 function onLoginError(error) { 0040 console.log("error " + error) 0041 inlineMessage.text = error 0042 page.enabled = true 0043 } 0044 enabled: !page.loggedIn 0045 } 0046 0047 ColumnLayout { 0048 CredentialStore { 0049 id: credentialStore 0050 onEmailChanged: emailField.text = email 0051 onPasswordChanged: passwordField.text = password 0052 window: root 0053 Component.onCompleted: load() 0054 } 0055 0056 Kirigami.InlineMessage { 0057 id: inlineMessage 0058 Layout.fillWidth: true 0059 type: Kirigami.MessageType.Error 0060 visible: text !== "" 0061 } 0062 0063 QQC2.Label { 0064 Layout.fillWidth: true 0065 wrapMode: Text.Wrap 0066 text: i18nc("@info:status '1' is replaced with the short URL of the bugzilla ", 0067 "You need to login with your %1 account in order to proceed.", Globals.bugzillaShortUrl); 0068 } 0069 Kirigami.FormLayout { 0070 QQC2.TextField { 0071 id: emailField 0072 Kirigami.FormData.label: i18nc("@label:textbox bugzilla account email", "E-mail Address:") 0073 Accessible.name: Kirigami.FormData.label 0074 onAccepted: loginAction.trigger() 0075 } 0076 Kirigami.PasswordField { 0077 id: passwordField 0078 Kirigami.FormData.label: i18nc("@label:textbox bugzilla account password", "Password:") 0079 Accessible.description: Kirigami.FormData.label 0080 onAccepted: loginAction.trigger() 0081 } 0082 QQC2.CheckBox { 0083 id: rememberBox 0084 checked: true 0085 text: i18nc("@option:check", "Save login information using the KDE Wallet system") 0086 } 0087 } 0088 QQC2.Label { 0089 Layout.fillWidth: true 0090 wrapMode: Text.Wrap 0091 text: xi18nc("@info/rich", 0092 `<note>You need a user account on the <link url='%1'>KDE bug tracking system</link> in order to file a bug report, because we may need to contact you later 0093 for requesting further information. If you do not have one, you can freely <link url='%2'>create one here</link>. Please do not use disposable email accounts.</note>`, 0094 CrashedApplication.bugReportAddress, 0095 Globals.bugzillaCreateAccountUrl) 0096 onLinkActivated: Qt.openUrlExternally(link) 0097 } 0098 } 0099 0100 footer: FooterActionBar { 0101 actions: [ 0102 Kirigami.Action { 0103 id: loginAction 0104 enabled: emailField.text.length() > 0 && passwordField.text.length() > 0 0105 iconName: "network-connect" 0106 text: i18nc("@action:button", "Login") 0107 tooltip: xi18nc("@info:tooltip", "Use this button to login to the KDE bug tracking system using the provided e-mail address and password.") 0108 onTriggered: { 0109 bugzilla.tryLogin(emailField.text, passwordField.text) 0110 page.enabled = false 0111 } 0112 Component.onCompleted: { // auto-login if possible 0113 if (emailField.text !== "" && passwordField.text !== "") { 0114 trigger() 0115 } 0116 } 0117 } 0118 ] 0119 } 0120 0121 Component.onCompleted: emailField.forceActiveFocus() 0122 }