Warning, /utilities/keysmith/src/contents/ui/UnlockAccounts.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 QQC2
0011 import org.kde.kirigami as Kirigami
0012 import org.kde.kirigamiaddons.formcard 1 as FormCard
0013 import org.kde.kirigamiaddons.components 1 as Components
0014
0015 import Keysmith.Application as Application
0016
0017 FormCard.FormCardPage {
0018 id: root
0019
0020 required property Application.UnlockAccountsViewModel vm
0021
0022 title: i18nc("@title:window", "Password")
0023
0024 header: Components.Banner {
0025 id: errorMessage
0026 text: i18n("Failed to unlock your accounts")
0027 visible: vm.failed
0028 showCloseButton: true
0029 type: Kirigami.MessageType.Error
0030 }
0031
0032 Component.onCompleted: existingPassword.forceActiveFocus()
0033
0034 Kirigami.Icon {
0035 source: "lock"
0036 Layout.fillWidth: true
0037 Layout.preferredHeight: Kirigami.Units.gridUnit * 8
0038 Layout.topMargin: Kirigami.Units.gridUnit
0039 Layout.bottomMargin: Kirigami.Units.gridUnit
0040 }
0041
0042 FormCard.FormHeader {
0043 title: i18n("Please provide the password to unlock your accounts")
0044 }
0045
0046 FormCard.FormCard {
0047 FormCard.FormTextFieldDelegate {
0048 id: existingPassword
0049 echoMode: TextInput.Password
0050 label: i18nc("@label:textbox", "Password:")
0051 enabled: !vm.busy
0052 onAccepted: unlockButton.clicked()
0053 }
0054
0055 FormCard.FormDelegateSeparator { above: unlockButton }
0056
0057 FormCard.FormButtonDelegate {
0058 id: unlockButton
0059 text: i18nc("@action:button", "Unlock")
0060 icon.name: "unlock"
0061 enabled: !vm.busy && existingPassword.text && existingPassword.text.length > 0
0062 visible: !Kirigami.Settings.isMobile
0063 onClicked: vm.unlock(existingPassword.text);
0064 }
0065 }
0066 }