From 22c5c456ccfb04bd73e8a28c335890b78ab6cb6c Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Mon, 8 Oct 2018 13:31:33 +0100
Subject: [PATCH] Launcher flight-planning: UI to sync initial location

Show a prompt message to ensure the initial startup location matches
the flight-plan departure airport.

https://sourceforge.net/p/flightgear/codetickets/2068/
---
 src/GUI/qml/FlightPlan.qml | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/GUI/qml/FlightPlan.qml b/src/GUI/qml/FlightPlan.qml
index 40e46d2b2..b60784f71 100644
--- a/src/GUI/qml/FlightPlan.qml
+++ b/src/GUI/qml/FlightPlan.qml
@@ -4,6 +4,10 @@ import FlightGear 1.0
 import "."
 
 Item {
+    id: root
+
+    // same name as Summary page
+    signal showSelectedLocation();
 
     Flickable {
         id: flick
@@ -214,7 +218,25 @@ Item {
                     id: departureTime
                     label: qsTr("Departure time:")
                 }
+            }
 
+            Row {
+                height: childrenRect.height
+                width: parent.width
+                spacing: Style.margin
+                ClickableText {
+                    width: parent.width
+                    text: qsTr("The flight-plan departure airport (%1) is different to the " +
+                               "initial location (%2). Click here to set the initial location to " +
+                               "the flight-plan's airport.").
+                          arg(_launcher.flightPlan.departure.name).arg(_launcher.location.description)
+                    visible: _launcher.flightPlan.departure.valid &&
+                             (_launcher.flightPlan.departure.guid !== _location.base.guid)
+                    onClicked: {
+                        _location.setBaseLocation(_launcher.flightPlan.departure)
+                        root.showSelectedLocation();
+                    }
+                }
             }
 
             // cruising speed + level