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.syntaxhighlighting 1.0 0009 0010 import org.kde.drkonqi 1.0 0011 0012 Kirigami.ScrollablePage { 0013 id: page 0014 title: i18nc("@title", "Login into the bug tracking system") 0015 0016 property bool loggedIn: false 0017 0018 onLoggedInChanged: { 0019 console.log("logged in changed") 0020 if (loggedIn) { 0021 pageStack.push('qrc:/ui/ReportPage.qml') 0022 } 0023 } 0024 0025 Connections { 0026 target: bugzilla 0027 function onLoginFinished(loggedIn) { 0028 console.log("logged in " + loggedIn) 0029 page.loggedIn = loggedIn 0030 if (rememberBox.checked) { 0031 credentialStore.email = emailField.text 0032 credentialStore.password = passwordField.text 0033 credentialStore.store() 0034 } else { 0035 credentialStore.drop() 0036 } 0037 } 0038 function onLoginError(error) { 0039 console.log("error " + error) 0040 inlineMessage.text = error 0041 page.enabled = true 0042 } 0043 enabled: !page.loggedIn 0044 } 0045 0046 ColumnLayout { 0047 CredentialStore { 0048 id: credentialStore 0049 onEmailChanged: emailField.text = email 0050 onPasswordChanged: passwordField.text = password 0051 window: root 0052 Component.onCompleted: load() 0053 } 0054 0055 Kirigami.InlineMessage { 0056 id: inlineMessage 0057 Layout.fillWidth: true 0058 type: Kirigami.MessageType.Error 0059 visible: text !== "" 0060 } 0061 0062 QQC2.Label { 0063 Layout.fillWidth: true 0064 wrapMode: Text.Wrap 0065 text: i18nc("@info:status '1' is replaced with the short URL of the bugzilla ", 0066 "You need to login with your %1 account in order to proceed.", Globals.bugzillaShortUrl); 0067 } 0068 Kirigami.FormLayout { 0069 QQC2.TextField { 0070 id: emailField 0071 Kirigami.FormData.label: i18nc("@label:textbox bugzilla account email", "E-mail Address:") 0072 Accessible.name: Kirigami.FormData.label 0073 onAccepted: loginAction.trigger() 0074 } 0075 Kirigami.PasswordField { 0076 id: passwordField 0077 Kirigami.FormData.label: i18nc("@label:textbox bugzilla account password", "Password:") 0078 Accessible.description: Kirigami.FormData.label 0079 onAccepted: loginAction.trigger() 0080 } 0081 QQC2.CheckBox { 0082 id: rememberBox 0083 checked: true 0084 text: i18nc("@option:check", "Save login information using the KDE Wallet system") 0085 } 0086 } 0087 QQC2.Label { 0088 Layout.fillWidth: true 0089 wrapMode: Text.Wrap 0090 text: xi18nc("@info/rich", 0091 `<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 0092 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>`, 0093 CrashedApplication.bugReportAddress, 0094 Globals.bugzillaCreateAccountUrl) 0095 onLinkActivated: link => Qt.openUrlExternally(link) 0096 } 0097 } 0098 0099 footer: FooterActionBar { 0100 actions: [ 0101 Kirigami.Action { 0102 id: loginAction 0103 enabled: emailField.text.length > 0 && passwordField.text.length > 0 0104 icon.name: "network-connect" 0105 text: i18nc("@action:button", "Login") 0106 tooltip: xi18nc("@info:tooltip", "Use this button to login to the KDE bug tracking system using the provided e-mail address and password.") 0107 onTriggered: { 0108 bugzilla.tryLogin(emailField.text, passwordField.text) 0109 page.enabled = false 0110 } 0111 Component.onCompleted: { // auto-login if possible 0112 if (emailField.text !== "" && passwordField.text !== "") { 0113 trigger() 0114 } 0115 } 0116 } 0117 ] 0118 } 0119 0120 Component.onCompleted: emailField.forceActiveFocus() 0121 }