loleaflet/src/control/Control.LokDialog.js    |    2 +-
 loleaflet/src/control/Control.MobileWizard.js |    2 --
 loleaflet/src/control/Control.Toolbar.js      |   16 ++--------------
 loleaflet/src/map/Map.js                      |   14 ++------------
 4 files changed, 5 insertions(+), 29 deletions(-)

New commits:
commit b4de4d77d00396f0ab4422bf14d50d7a1c2bdddb
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Dec 15 21:20:18 2019 -0500
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Dec 16 19:02:00 2019 +0100

    leaflet: improved sidebar control using new uno commands
    
    Change-Id: I90e0833e1bc4e71719c91afe971fe7180c743676
    Reviewed-on: https://gerrit.libreoffice.org/85193
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 7ac61c241..2e1e52d90 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -224,7 +224,6 @@ L.Control.LokDialog = L.Control.extend({
                }
 
                e.id = parseInt(e.id);
-               window.sidebarId = e.id;
                var strId = this._toStrId(e.id);
 
                var width = 0;
@@ -255,6 +254,7 @@ L.Control.LokDialog = L.Control.extend({
                                if (!window.mode.isMobile()) {
                                        this._launchSidebar(e.id, width, 
height);
                                } else {
+                                       // In mobile we get jsdialog messages.
                                        window.sidebarId = e.id;
                                }
                        } else if (e.winType === 'child') {
diff --git a/loleaflet/src/control/Control.MobileWizard.js 
b/loleaflet/src/control/Control.MobileWizard.js
index f5aa7c767..035d14f36 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -240,8 +240,6 @@ L.Control.MobileWizard = L.Control.extend({
                        if (!this._isActive && isSidebar) {
                                if (this.map.showSidebar == false)
                                        return;
-                               else
-                                       this._refreshSidebar();
                        }
 
                        this._isActive = true;
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index 2cb0b5289..bf1997688 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -339,6 +339,7 @@ function onClick(e, id, item, subItem) {
        else if (id === 'mobile_wizard') {
                if (window.mobileWizard) {
                        window.mobileWizard = false;
+                       map.sendUnoCommand('.uno:SidebarHide');
                        map.fire('closemobilewizard');
                        toolbar.uncheck(id);
                }
@@ -346,20 +347,7 @@ function onClick(e, id, item, subItem) {
                        if (window.insertionMobileWizard)
                                this.onClick(null, 'insertion_mobile_wizard');
                        window.mobileWizard = true;
-                       if (!map._sidebarVisible) {
-                               map._sidebarVisible = true;
-                               map.sendUnoCommand('.uno:Sidebar');
-                               if (map.hasObjectFocusDarkOverlay())
-                                       map.sendUnoCommand('.uno:Sidebar');
-                       } else {
-                               // As the sidebar LOKWindowId can and does 
change,
-                               // esp. between chart and other elements, we 
apparently
-                               // lose track, and there is currently no 
reliable way to
-                               // recover it (which is needed to request 
updates).
-                               // The following disable and enable the sidebar 
to get it.
-                               map.sendUnoCommand('.uno:Sidebar');
-                               map.sendUnoCommand('.uno:Sidebar');
-                       }
+                       map.sendUnoCommand('.uno:SidebarShow');
                        map.fire('showwizardsidebar');
                        toolbar.check(id);
                }
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index ed03f6098..d80a60f4b 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -111,8 +111,6 @@ L.Map = L.Evented.extend({
                this._disableDefaultAction = {}; // The events for which the 
default handler is disabled and only issues postMessage.
                this._winId = 0;
                this._activeDialog = null;
-               this._sidebarVisible = false; // The state of the sidebar in 
Core.
-               this._showSidebar = false; // Whether we have the sidebar 
visible in the UI or not (i.e. does the user want to see it or not).
 
                vex.dialogID = -1;
 
@@ -288,17 +286,9 @@ 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.
-                                       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 hid it)
+                                       // Show the sidebar by default, but not 
on mobile.
                                        if (!window.mode.isMobile() && 
!window.mode.isTablet() && !window.ThisIsAMobileApp) {
-                                               map._socket.sendMessage('uno 
.uno:Sidebar');
+                                               map._socket.sendMessage('uno 
.uno:SidebarShow');
                                        }
                                }, 200);
                        }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to