From 6b45bb680dc59e109a23e1d0476739a420f1ab3f Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Thu, 16 Nov 2023 20:34:26 +0700 Subject: [PATCH] Fix screen lock not blocking back button presses --- src/qml/qgismobileapp.qml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index 01d9627199..f11eac75d6 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -3583,17 +3583,20 @@ ApplicationWindow { property bool alreadyCloseRequested: false onClosing: (close) => { - if( !alreadyCloseRequested ) - { - close.accepted = false - alreadyCloseRequested = true - displayToast( qsTr( "Press back again to close project and app" ) ) - closingTimer.start() - } - else - { - close.accepted = true - } + if (screenLocker.enabled) { + close.accepted = false + displayToast(qsTr("Unlock the screen to to close project and app")) + return + } + + if (!alreadyCloseRequested) { + close.accepted = false + alreadyCloseRequested = true + displayToast(qsTr("Press back again to close project and app")) + closingTimer.start() + } else { + close.accepted = true + } } Timer {