aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-08-08 11:29:02 +0200
committerJaquee <jaquee.monero@gmail.com>2017-11-03 16:57:12 +0100
commitb9152286ecb9fa6ab4479760f2ae8d6371d187d6 (patch)
tree4220cfab062b3fcd916bd10f3261a4c675680a7d
parent72d220462a246099629947d8ba8661980757077e (diff)
downloadmonzero-gui-b9152286ecb9fa6ab4479760f2ae8d6371d187d6.tar.gz
monzero-gui-b9152286ecb9fa6ab4479760f2ae8d6371d187d6.tar.xz
monzero-gui-b9152286ecb9fa6ab4479760f2ae8d6371d187d6.zip
Android: handle back-button + add statusBox
-rw-r--r--main.qml62
1 files changed, 61 insertions, 1 deletions
diff --git a/main.qml b/main.qml
index 2a4f2af3..e6342d8a 100644
--- a/main.qml
+++ b/main.qml
@@ -69,6 +69,7 @@ ApplicationWindow {
property var isMobile: (appWindow.width > 700 && !isAndroid) ? false : true
property var cameraUi
property bool remoteNodeConnected: false
+ property bool androidCloseTapped: false;
// Default daemon addresses
readonly property string localDaemonAddress : !persistentSettings.testnet ? "localhost:18081" : "localhost:28081"
property string currentDaemonAddress;
@@ -1406,11 +1407,69 @@ ApplicationWindow {
}
}
+ // TODO: Make the callback dynamic
+ Timer {
+ id: statusMessageTimer
+ interval: 5;
+ running: false;
+ repeat: false
+ onTriggered: resetAndroidClose()
+ triggeredOnStart: false
+ }
+
+ Rectangle {
+ id: statusMessage
+ visible: false
+ property alias text: statusMessageText.text
+ anchors.bottom: parent.bottom
+ width: 200 * scaleRatio
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "black"
+ height: 40 * scaleRatio
+ Text {
+ id: statusMessageText
+ anchors.fill: parent
+ anchors.margins: 10 * scaleRatio
+ font.pixelSize: 14 * scaleRatio
+ color: "white"
+ }
+ }
+
+ function resetAndroidClose() {
+ console.log("resetting android close");
+ androidCloseTapped = false;
+ statusMessage.visible = false
+ }
+
+ function showStatusMessage(msg,timeout) {
+ console.log("showing status message")
+ statusMessageTimer.interval = timeout * 1000;
+ statusMessageTimer.start()
+ statusMessageText.text = msg;
+ statusMessage.visible = true
+ }
+
onClosing: {
+ close.accepted = false;
+ console.log("blocking close event");
+ if(isAndroid) {
+ console.log("blocking android exit");
+ if(qrScannerEnabled)
+ cameraUi.state = "Stopped"
+
+ if(!androidCloseTapped) {
+ androidCloseTapped = true;
+ appWindow.showStatusMessage(qsTr("Tap again to close..."),3)
+
+ // first close
+ return;
+ }
+
+
+ }
// If daemon is running - prompt user before exiting
if(typeof daemonManager != "undefined" && daemonManager.running(persistentSettings.testnet)) {
- close.accepted = false;
// Show confirmation dialog
confirmationDialog.title = qsTr("Daemon is running") + translationManager.emptyString;
@@ -1434,6 +1493,7 @@ ApplicationWindow {
}
function closeAccepted(){
+ console.log("close accepted");
// Close wallet non async on exit
daemonManager.exit();
walletManager.closeWallet();