From 842210c80d1618a78928fb2bf93cc4a4c77a3ccf Mon Sep 17 00:00:00 2001
From: Dirk Hohndel <dirk@hohndel.org>
Date: Mon, 6 Aug 2018 18:38:52 -0700
Subject: [PATCH] QML UI: show download page when device was plugged in

Unless, of course, the user was editing or adding a dive - that would
be annoying to have interrupted (even though, of course, it's the user
plugging in the device which would trigger this in the first place).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
---
 mobile-widgets/qml/main.qml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index f74b28b71..069024cc8 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -612,7 +612,13 @@ if you have network connectivity and want to sync your data to cloud storage."),
 	}
 
 	onPluggedInDeviceNameChanged: {
-		console.log("Show download page for device " + pluggedInDeviceName);
+		if (detailsWindow.state === 'edit' || detailsWindow.state === 'add') {
+			/* we're in the middle of editing / adding a dive */
+			console.log("Download page requested by Android Intent, but adding/editing dive; no action taken")
+		} else {
+			console.log("Show download page for device " + pluggedInDeviceName)
+			diveList.showDownloadPage()
+		}
 	}
 
 	Component.onCompleted: {