Skip to content

Commit

Permalink
Testing a hard exit
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Mar 19, 2024
1 parent 52355fe commit e0bc5f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
17 changes: 17 additions & 0 deletions src/qml/WelcomeScreen.qml
Expand Up @@ -766,6 +766,22 @@ Page {
}
}

QfToolButton {
id: exitButton
visible: false
anchors {
top: parent.top
right: parent.right
topMargin: mainWindow.sceneTopMargin
}
bgcolor: "red"

onClicked: {
mainWindow.closeAlreadyRequested = true
mainWindow.close()
}
}

// Sparkles & unicorns
Rectangle {
anchors.fill: parent
Expand Down Expand Up @@ -872,6 +888,7 @@ Page {
if (visible) {
const currentProjectButtonVisible = !!qgisProject.fileName;
currentProjectButton.visible = currentProjectButtonVisible
exitButton.visible = currentProjectButtonVisible

if (firstShown) {
welcomeText.text = " ";
Expand Down
8 changes: 4 additions & 4 deletions src/qml/qgismobileapp.qml
Expand Up @@ -3908,7 +3908,7 @@ ApplicationWindow {
state: iface.hasProjectOnLaunch() ? "visible" : "hidden"
}

property bool alreadyCloseRequested: false
property bool closeAlreadyRequested: false

onClosing: (close) => {
if (screenLocker.enabled) {
Expand All @@ -3917,9 +3917,9 @@ ApplicationWindow {
return
}

if (!alreadyCloseRequested) {
if (!closeAlreadyRequested) {
close.accepted = false
alreadyCloseRequested = true
closeAlreadyRequested = true
displayToast(qsTr("Press back again to close project and app"))
closingTimer.start()
} else {
Expand All @@ -3931,7 +3931,7 @@ ApplicationWindow {
id: closingTimer
interval: 2000
onTriggered: {
alreadyCloseRequested = false
closeAlreadyRequested = false
}
}

Expand Down

0 comments on commit e0bc5f8

Please sign in to comment.