1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
From c2d83388c2447004aed81c81a95e28108789a28f Mon Sep 17 00:00:00 2001
From: Yifan Zhu <fanzhuyifan@gmail.com>
Date: Fri, 10 Jan 2025 11:38:07 -0800
Subject: [PATCH] lockscreen: sync password across different screens
Test plan:
- lock screen in multiscreen setup
- type on one password box, verify password is synced to other screen
- make deletions and insertions in other screen, and verify changes are
synced back
CCBUG: 433563
---
desktoppackage/contents/lockscreen/MainBlock.qml | 7 +++++++
desktoppackage/contents/lockscreen/PasswordSync.qml | 13 +++++++++++++
desktoppackage/contents/lockscreen/qmldir | 4 ++++
3 files changed, 24 insertions(+)
create mode 100644 desktoppackage/contents/lockscreen/PasswordSync.qml
create mode 100644 desktoppackage/contents/lockscreen/qmldir
diff --git a/desktoppackage/contents/lockscreen/MainBlock.qml b/desktoppackage/contents/lockscreen/MainBlock.qml
index 5e26f84949..9874b800dd 100644
--- a/desktoppackage/contents/lockscreen/MainBlock.qml
+++ b/desktoppackage/contents/lockscreen/MainBlock.qml
@@ -60,6 +60,7 @@ SessionManagementScreen {
id: passwordBox
font.pointSize: Kirigami.Theme.defaultFont.pointSize + 1
Layout.fillWidth: true
+ text: PasswordSync.password
placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Password")
focus: true
@@ -95,12 +96,18 @@ SessionManagementScreen {
function onClearPassword() {
passwordBox.forceActiveFocus()
passwordBox.text = "";
+ passwordBox.text = Qt.binding(() => PasswordSync.password);
}
function onNotificationRepeated() {
sessionManager.playHighlightAnimation();
}
}
}
+ Binding {
+ target: PasswordSync
+ property: "password"
+ value: passwordBox.text
+ }
PlasmaComponents3.Button {
id: loginButton
diff --git a/desktoppackage/contents/lockscreen/PasswordSync.qml b/desktoppackage/contents/lockscreen/PasswordSync.qml
new file mode 100644
index 0000000000..e57b4e0e99
--- /dev/null
+++ b/desktoppackage/contents/lockscreen/PasswordSync.qml
@@ -0,0 +1,13 @@
+/*
+ SPDX-FileCopyrightText: 2025 Yifan Zhu <fanzhuyifan@gmail.com>
+
+ SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+pragma Singleton
+
+import QtQuick
+
+QtObject {
+ property string password
+}
diff --git a/desktoppackage/contents/lockscreen/qmldir b/desktoppackage/contents/lockscreen/qmldir
new file mode 100644
index 0000000000..759d12d542
--- /dev/null
+++ b/desktoppackage/contents/lockscreen/qmldir
@@ -0,0 +1,4 @@
+# SPDX-FileCopyrightText: 2025 Yifan Zhu <fanzhuyifan@gmail.com>
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+singleton PasswordSync 1.0 PasswordSync.qml
--
GitLab
|