Skip to content

Commit

Permalink
Merge pull request #5571 from opengisch/hard-exit-reboot
Browse files Browse the repository at this point in the history
Hard exit reboot
  • Loading branch information
nirvn authored Aug 16, 2024
2 parents 6f12de7 + 3a57a4b commit ec78ee4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -541,5 +541,6 @@
<file>themes/qfield/nodpi/ic_password_48dp.svg</file>
<file>themes/qfield/nodpi/ic_arrow_drop_down_48dp.svg</file>
<file>themes/qfield/nodpi/ic_arrow_drop_up_48dp.svg</file>
<file>themes/qfield/nodpi/ic_shutdown_24dp.svg</file>
</qresource>
</RCC>
1 change: 1 addition & 0 deletions images/themes/qfield/nodpi/ic_shutdown_24dp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/qml/WelcomeScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,23 @@ Page {
}
}

QfToolButton {
id: exitButton
visible: false
anchors {
top: parent.top
right: parent.right
topMargin: mainWindow.sceneTopMargin
}
iconSource: Theme.getThemeVectorIcon('ic_shutdown_24dp')
iconColor: Theme.mainTextColor

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

// Sparkles & unicorns
Rectangle {
anchors.fill: parent
Expand Down Expand Up @@ -887,6 +904,7 @@ Page {
if (visible) {
const currentProjectButtonVisible = !!qgisProject.fileName;
currentProjectButton.visible = currentProjectButtonVisible;
exitButton.visible = currentProjectButtonVisible && (Qt.platform.os === "ios" || Qt.platform.os === "android");
if (firstShown) {
welcomeText.text = " ";
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3847,17 +3847,17 @@ ApplicationWindow {
state: iface.hasProjectOnLaunch() ? "visible" : "hidden"
}

property bool alreadyCloseRequested: false
property bool closeAlreadyRequested: false

onClosing: close => {
if (screenLocker.enabled) {
close.accepted = false;
displayToast(qsTr("Unlock the screen to to close project and app"));
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 @@ -3869,7 +3869,7 @@ ApplicationWindow {
id: closingTimer
interval: 2000
onTriggered: {
alreadyCloseRequested = false;
closeAlreadyRequested = false;
}
}

Expand Down

1 comment on commit ec78ee4

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.