From 5eefa330dd09c291357c93ca14949433a21cf3bf Mon Sep 17 00:00:00 2001
From: legoboyvdlp R <legoboyvdlp@gmail.com>
Date: Tue, 4 Aug 2020 13:00:31 +0100
Subject: [PATCH] Fix simbrief dialog

---
 AircraftConfig/acconfig.nas |  2 +-
 AircraftConfig/simbrief.xml | 25 ++++++++++++++++++-------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas
index 7ff2d44d..7f9e31f6 100644
--- a/AircraftConfig/acconfig.nas
+++ b/AircraftConfig/acconfig.nas
@@ -230,7 +230,7 @@ var readSettings = func {
 	setprop("/sim/model/autopush/route/show", getprop("/systems/acconfig/options/autopush/show-route"));
 	setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip"));
 	setprop("/options/system/fo-view", getprop("/systems/acconfig/options/fo-view"));
-	setprop("/FMGC/internal/simbrief-username", getprop("/systems/acconfig/options/simbrief-username"));
+	setprop("/FMGC/simbrief-username", getprop("/systems/acconfig/options/simbrief-username"));
 }
 
 var writeSettings = func {
diff --git a/AircraftConfig/simbrief.xml b/AircraftConfig/simbrief.xml
index 28fe1398..322311a8 100644
--- a/AircraftConfig/simbrief.xml
+++ b/AircraftConfig/simbrief.xml
@@ -9,6 +9,12 @@
     <name>simbrief</name>
     <layout>vbox</layout>
     
+	<nasal>
+		<close>
+			acconfig.writeSettings();
+		</close>
+	</nasal>
+	
     <group>
         <layout>hbox</layout>
         <text>
@@ -49,25 +55,30 @@
 		</text>
 		<text>
 			<halign>left</halign>
-			<label>4. Please enter your username in the following dialog box (not case sensitive)</label>
+			<label>4. Please enter your username in the following text field (not case sensitive)</label>
 		</text>
 		<group>
 			<layout>hbox</layout>
-			<text>
-				<halign>left</halign>
-				<label>Username: </label>
-			</text>
-			
 			<input>
 				<width>200</width>
 				<height>25</height>	
+				<label>Username</label>
 				<property>/FMGC/simbrief-username</property>
                 <binding>
                     <command>dialog-apply</command>
                 </binding>
-                <live>true</live>
+				<live type="bool">true</live>
 			</input>
 		</group>
+		
+	   <button>
+			<x>40</x>
+			<y>10</y>
+			<legend>Apply / Exit</legend>
+			<binding>
+				<command>dialog-close</command>
+			</binding>
+		</button>
 	</group>
     
 </PropertyList>