leaflet: improved sidebar control using new uno commands

Change-Id: I90e0833e1bc4e71719c91afe971fe7180c743676
Reviewed-on: https://gerrit.libreoffice.org/85193
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
Ashod Nakashian 2019-12-15 21:20:18 -05:00 committed by Michael Meeks
parent 4f7958dcc1
commit b4de4d77d0
4 changed files with 5 additions and 29 deletions

View file

@ -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') {

View file

@ -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;

View file

@ -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);
}

View file

@ -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);
}