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

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 11 19:53:12 UTC 2019


 loleaflet/src/control/Control.MobileWizard.js |    8 +++++---
 loleaflet/src/control/Control.Toolbar.js      |    3 +--
 loleaflet/src/layer/tile/TileLayer.js         |   12 ++++++++----
 loleaflet/src/map/Map.js                      |   13 +++++--------
 4 files changed, 19 insertions(+), 17 deletions(-)

New commits:
commit 924869c3f4296f25a841732cdf410d1d43bc3844
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Dec 11 13:12:03 2019 -0500
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Wed Dec 11 20:52:54 2019 +0100

    leaflet: sidebar is now always active for mobile but visible on demand
    
    Because we can't control the sidebar when in Chart edit
    mode, we must have it active before we start Chart editing.
    Besides that, on mobile we show/hide the sidebar quite
    frequently, and there is no point in activating/deactivating
    the sidebar on every tap.
    
    So we have the sidebar enabled in the background at all times.
    We then track whether it's visible or not (window.mobileWizard)
    and show/hide it. Furthermore, we now handle the sidebar
    close notification from Core, which we don't expect, really,
    now that we don't close it. However, we need to have a way
    to re-activate the sidebar when it is closed. Something
    we don't do right now, and we need to tack the Core
    sidebar state as we can only toggle the sidebar.
    
    Change-Id: Id7774b84cd0604055c708eb0912e17988f5823d2
    Reviewed-on: https://gerrit.libreoffice.org/84974
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 0a17ac6bf..4715f0694 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -26,6 +26,7 @@ L.Control.MobileWizard = L.Control.extend({
 		this.map = map;
 		map.on('mobilewizard', this._onMobileWizard, this);
 		map.on('closemobilewizard', this._hideWizard, this);
+		map.on('showmobilewizard', this._showWizard, this);
 
 		this._setupBackButton();
 	},
@@ -72,7 +73,6 @@ L.Control.MobileWizard = L.Control.extend({
 			var toolbar = w2ui['actionbar'];
 			if (toolbar && toolbar.get('mobile_wizard').checked)
 				toolbar.uncheck('mobile_wizard');
-			this.map.sendUnoCommand('.uno:Sidebar');
 			window.mobileWizard = false;
 		}
 
@@ -242,8 +242,10 @@ L.Control.MobileWizard = L.Control.extend({
 
 			this._reset();
 
-			this._showWizard();
-			this._hideKeyboard();
+			if (window.mobileWizard) {
+				this._showWizard();
+				this._hideKeyboard();
+			}
 
 			// We can change the sidebar as we want here
 			if (data.id === '') { // sidebar indicator
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 1fa5f333d..4e8c1943e 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -339,7 +339,6 @@ function onClick(e, id, item, subItem) {
 	else if (id === 'mobile_wizard') {
 		if (window.mobileWizard) {
 			window.mobileWizard = false;
-			map.sendUnoCommand('.uno:Sidebar');
 			map.fire('closemobilewizard');
 			toolbar.uncheck(id);
 		}
@@ -347,7 +346,7 @@ function onClick(e, id, item, subItem) {
 			if (window.insertionMobileWizard)
 				this.onClick(null, 'insertion_mobile_wizard');
 			window.mobileWizard = true;
-			map.sendUnoCommand('.uno:Sidebar');
+			map.fire('showmobilewizard');
 			toolbar.check(id);
 		}
 	}
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index e7faca385..d6e406884 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -875,14 +875,18 @@ L.TileLayer = L.GridLayer.extend({
 		this._map.fire('mobilewizard', data);
 	},
 
-	_closeMobileWizard: function() {
-		this._map.fire('closemobilewizard');
+	_closeMobileWizard: function(data) {
+		this._map.fire('closemobilewizard', data);
 	},
 
 	_onJSDialogMsg: function (textMsg) {
-		if (window.mode.isMobile() && window.mobileWizard === true) {
+		if (window.mode.isMobile()) {
 			var msgData = JSON.parse(textMsg.substring('jsdialog:'.length + 1));
-			this._openMobileWizard(msgData);
+			if (msgData.enabled) {
+				this._openMobileWizard(msgData);
+			} else {
+				this._closeMobileWizard(msgData);
+			}
 		}
 	},
 
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index a199716c9..af149f236 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -285,19 +285,16 @@ L.Map = L.Evented.extend({
 				// Let the first page finish loading then load the sidebar.
 				var map = this;
 				setTimeout(function () {
-                    // This triggers all sidebar decks, so they would
-                    // be loaded and show rather quickly on first use.
-                    // Also, triggers sidebar window creation in the client.
+					// This triggers all sidebar decks, so they would
+					// be loaded and show rather quickly on first use.
+					// Also, triggers sidebar window creation in the client.
 					map._socket.sendMessage('uno .uno:Sidebar');
 
 					// HACK: The initial state of sidebar is that the core
 					// thinks it is shown, so the command has to be triggered
 					// once again for it to be visible on the desktop
-					// (because the first .uno:Sidebar has actually hidden
-					// that)
-					if (!window.mode.isMobile() && !window.mode.isTablet() && !window.ThisIsAMobileApp) {
-						map._socket.sendMessage('uno .uno:Sidebar');
-					}
+					// (because the first .uno:Sidebar has actually hid it)
+					map._socket.sendMessage('uno .uno:Sidebar');
 				}, 200);
 			}
 


More information about the Libreoffice-commits mailing list