Warning, /utilities/keysmith/src/contents/ui/SetupPassword.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-License-Identifier: GPL-3.0-or-later
0003 * SPDX-FileCopyrightText: 2020-2021 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
0004 * SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
0005 * SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
0006 */
0007
0008 import QtQuick
0009 import QtQuick.Layouts
0010 import QtQuick.Controls as Controls
0011 import org.kde.kirigami as Kirigami
0012 import org.kde.kirigamiaddons.formcard 1.0 as FormCard
0013 import org.kde.kirigamiaddons.components 1.0 as Components
0014
0015 import Keysmith.Application as Application
0016
0017 FormCard.FormCardPage {
0018 id: root
0019
0020 required property Application.SetupPasswordViewModel vm
0021
0022 title: i18nc("@title:window", "Password")
0023
0024 Component.onCompleted: newPassword.forceActiveFocus()
0025
0026 header: Components.Banner {
0027 id: errorMessage
0028 text: i18n("Failed to set up your password")
0029 visible: vm.failed
0030 showCloseButton: true
0031 }
0032
0033 Kirigami.Icon {
0034 source: "lock"
0035 Layout.fillWidth: true
0036 Layout.preferredHeight: Kirigami.Units.gridUnit * 8
0037 Layout.topMargin: Kirigami.Units.gridUnit
0038 Layout.bottomMargin: Kirigami.Units.gridUnit
0039 }
0040
0041 FormCard.FormHeader {
0042 title: i18n("Choose a password to protect your accounts")
0043 }
0044
0045 FormCard.FormCard {
0046 FormCard.FormTextFieldDelegate {
0047 id: newPassword
0048 echoMode: TextInput.Password
0049 label: i18nc("@label:textbox", "New Password:")
0050 enabled: !vm.busy
0051 onAccepted: newPasswordCopy.trigger()
0052 }
0053
0054 FormCard.FormDelegateSeparator {}
0055
0056 FormCard.FormTextFieldDelegate {
0057 id: newPasswordCopy
0058 echoMode: TextInput.Password
0059 enabled: !vm.busy
0060 label: i18nc("@label:textbox", "Verify password:")
0061 onAccepted: applyButton.clicked()
0062 }
0063
0064 FormCard.FormDelegateSeparator { above: applyButton }
0065
0066 FormCard.FormButtonDelegate {
0067 id: applyButton
0068 text: i18nc("@action:button", "Apply")
0069 icon.name: "answer-correct"
0070 enabled: !vm.busy && newPassword.text === newPasswordCopy.text && newPassword.text && newPassword.text.length > 0
0071 onClicked: vm.setup(newPassword.text, newPasswordCopy.text);
0072 }
0073 }
0074 }