Warning, /plasma/plasma-workspace/kcms/users/src/ui/ChangePassword.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Carson Black <uhhadd@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 import QtQuick 2.6 0008 import QtQuick.Layouts 1.3 0009 0010 import org.kde.kirigami 2.20 as Kirigami 0011 import org.kde.plasma.kcm.users 1.0 as UsersKCM 0012 0013 Kirigami.PromptDialog { 0014 id: passwordRoot 0015 0016 preferredWidth: Kirigami.Units.gridUnit * 20 0017 0018 function openAndClear() { 0019 verifyField.text = "" 0020 passwordField.text = "" 0021 passwordField.forceActiveFocus() 0022 this.open() 0023 } 0024 0025 property UsersKCM.User user 0026 0027 title: i18n("Change Password") 0028 0029 standardButtons: Kirigami.Dialog.NoButton 0030 customFooterActions: Kirigami.Action { 0031 id: passAction 0032 text: i18n("Set Password") 0033 enabled: !passwordWarning.visible && verifyField.text && passwordField.text 0034 onTriggered: apply() 0035 0036 function apply() { 0037 if (passwordField.text !== verifyField.text) { 0038 debouncer.isTriggered = true 0039 return 0040 } 0041 passwordRoot.user.password = passwordField.text 0042 passwordRoot.close() 0043 } 0044 } 0045 0046 ColumnLayout { 0047 id: mainColumn 0048 spacing: Kirigami.Units.smallSpacing 0049 0050 Kirigami.PasswordField { 0051 id: passwordField 0052 0053 Layout.fillWidth: true 0054 0055 placeholderText: i18n("Password") 0056 onTextChanged: debouncer.reset() 0057 0058 onAccepted: { 0059 if (!passwordWarning.visible && verifyField.text && passwordField.text) { 0060 passAction.trigger() 0061 } 0062 } 0063 } 0064 0065 Kirigami.PasswordField { 0066 id: verifyField 0067 0068 Layout.fillWidth: true 0069 0070 placeholderText: i18n("Confirm password") 0071 onTextChanged: debouncer.reset() 0072 0073 onAccepted: { 0074 if (!passwordWarning.visible && verifyField.text && passwordField.text) { 0075 passAction.trigger() 0076 } 0077 } 0078 } 0079 0080 Debouncer { 0081 id: debouncer 0082 } 0083 0084 Kirigami.InlineMessage { 0085 id: passwordWarning 0086 0087 Layout.fillWidth: true 0088 type: Kirigami.MessageType.Error 0089 text: i18n("Passwords must match") 0090 visible: passwordField.text !== "" 0091 && verifyField.text !== "" 0092 && passwordField.text !== verifyField.text 0093 && debouncer.isTriggered 0094 } 0095 } 0096 }