From 96cb0a51992ad0f72fb8788f7b83024c7df28ad4 Mon Sep 17 00:00:00 2001 From: lysec Date: Tue, 21 Oct 2025 14:44:22 +0200 Subject: [PATCH] IPC: lockScreen toggle is deprecated, use lockScreen lock --- Modules/LockScreen/LockScreen.qml | 67 ++++++++++++++++++++++++++++++- Services/IPCService.qml | 19 ++++++++- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index 09a91ff8..2b8add42 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -17,11 +17,18 @@ Loader { id: lockScreen active: false + // Track if triggered via deprecated IPC call + property bool triggeredViaDeprecatedCall: false + Timer { id: unloadAfterUnlockTimer interval: 250 repeat: false - onTriggered: lockScreen.active = false + onTriggered: { + lockScreen.active = false + // Reset the deprecation flag when unlocking + lockScreen.triggeredViaDeprecatedCall = false + } } function scheduleUnloadAfterUnlock() { @@ -424,6 +431,64 @@ Loader { } } + // Deprecation warning (shown above error notification) + Rectangle { + width: Math.min(650, parent.width - 40) + implicitHeight: deprecationContent.implicitHeight + 24 + height: implicitHeight + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: (Settings.data.general.compactLockScreen ? 320 : 400) * Style.uiScaleRatio + radius: Style.radiusL + color: Qt.alpha(Color.mTertiary, 0.95) + border.color: Color.mTertiary + border.width: 2 + visible: lockScreen.triggeredViaDeprecatedCall + opacity: visible ? 1.0 : 0.0 + + ColumnLayout { + id: deprecationContent + anchors.fill: parent + anchors.margins: 12 + spacing: 6 + + RowLayout { + Layout.alignment: Qt.AlignHCenter + spacing: 8 + + NIcon { + icon: "alert-triangle" + pointSize: Style.fontSizeL + color: Color.mOnTertiary + } + + NText { + text: "Deprecated IPC Call" + color: Color.mOnTertiary + pointSize: Style.fontSizeL + font.weight: Font.Bold + } + } + + NText { + text: "The 'lockScreen toggle' IPC call is deprecated. Use 'lockScreen lock' instead." + color: Color.mOnTertiary + pointSize: Style.fontSizeM + horizontalAlignment: Text.AlignHCenter + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + wrapMode: Text.WordWrap + } + } + + Behavior on opacity { + NumberAnimation { + duration: 300 + easing.type: Easing.OutCubic + } + } + } + // Error notification Rectangle { width: 450 diff --git a/Services/IPCService.qml b/Services/IPCService.qml index 3d1d3924..12c7c204 100644 --- a/Services/IPCService.qml +++ b/Services/IPCService.qml @@ -77,9 +77,26 @@ Item { IpcHandler { target: "lockScreen" - function toggle() { + + // New preferred method - lock the screen + function lock() { // Only lock if not already locked (prevents the red screen issue) // Note: No unlock via IPC for security reasons + if (!lockScreen.active) { + lockScreen.triggeredViaDeprecatedCall = false + lockScreen.active = true + } + } + + // Deprecated: Use 'lockScreen lock' instead + function toggle() { + // Mark as triggered via deprecated call - warning will show in lock screen + lockScreen.triggeredViaDeprecatedCall = true + + // Log deprecation warning for users checking logs + Logger.w("IPC", "The 'lockScreen toggle' IPC call is deprecated. Use 'lockScreen lock' instead.") + + // Still functional for backward compatibility if (!lockScreen.active) { lockScreen.active = true }