[Libreoffice-commits] online.git: loleaflet/src

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Apr 24 22:24:00 UTC 2016


 loleaflet/src/control/Control.Dialog.js |    8 ++++++++
 loleaflet/src/map/Map.js                |    1 +
 2 files changed, 9 insertions(+)

New commits:
commit 8f7ddbc495676d7594caf190dcfa35e0616055f9
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 24 16:56:18 2016 -0400

    loleaflet: close an existing dialog before showing a new one
    
    Change-Id: Ic930fc692c93ff01a7b74f26f0153fd8a75692cb
    Reviewed-on: https://gerrit.libreoffice.org/24353
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/src/control/Control.Dialog.js b/loleaflet/src/control/Control.Dialog.js
index 4907107..c377248 100644
--- a/loleaflet/src/control/Control.Dialog.js
+++ b/loleaflet/src/control/Control.Dialog.js
@@ -10,6 +10,11 @@ L.Control.Dialog = L.Control.extend({
 	},
 
 	_onError: function (e) {
+		if (vex.dialog_id > 0) {
+			// Close other dialogs before presenting a new one.
+			vex.close(vex.dialog_id);
+		}
+
 		if (e.msg) {
 			vex.dialog.alert(e.msg);
 		}
@@ -18,6 +23,9 @@ L.Control.Dialog = L.Control.extend({
 						' parsing the \'' + e.cmd + '\' command.';
 			vex.dialog.alert(msg);
 		}
+
+		// Remember the current dialog ID to close it later.
+		vex.dialog_id = vex.globalID - 1;
 	},
 
 	_onPrint: function (e) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 5a8cd68..4abd285 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -705,6 +705,7 @@ L.Map = L.Evented.extend({
 
 			options = $.extend({}, vex.defaultOptions, {contentCSS: {"background":"rgba(0, 0, 0, 0)"}});
 			options.id = vex.globalID;
+			vex.dialog_id = options.id;
 			vex.globalID += 1;
 			options.$vex = $('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
 			  vex: options


More information about the Libreoffice-commits mailing list