loleaflet/src/control/Control.LokDialog.js | 2 - loleaflet/src/control/Control.Menubar.js | 43 +++++++++++++++++++++++++++-- loleaflet/src/layer/tile/TileLayer.js | 2 - 3 files changed, 43 insertions(+), 4 deletions(-)
New commits: commit 5ac78e5a29339b524bf37437aa070820fd10561d Author: Szymon Kłos <[email protected]> AuthorDate: Thu Oct 3 13:58:52 2019 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Thu Oct 3 14:09:17 2019 +0200 jsdialogs: add switch for sidebar and mobile wizard Change-Id: I9b0b0ce239217d063886937f00435f4b7427b1ba Reviewed-on: https://gerrit.libreoffice.org/80126 Reviewed-by: Szymon Kłos <[email protected]> Tested-by: Szymon Kłos <[email protected]> diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index 7f7815848..2d49294e3 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -280,7 +280,7 @@ L.Control.LokDialog = L.Control.extend({ // When left/top are invalid, the dialog shows in the center. this._launchDialog(e.id, left, top, width, height, e.title); } else if (e.winType === 'deck') { - if (!window.mode.isMobile()) { + if (window.mobileWizard !== true) { this._launchSidebar(e.id, width, height); } } else if (e.winType === 'child') { diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index b1f08a722..2e2250f99 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -73,7 +73,8 @@ L.Control.Menubar = L.Control.extend({ {type: 'separator'}, {name: _UNO('.uno:ShowResolvedAnnotations', 'text'), id: 'showresolved', type: 'action'}, {type: 'separator'}, - {uno: '.uno:Sidebar'} + {uno: '.uno:Sidebar'}, + {id: 'mobile-wizard', type: 'action', name: _('Mobile Wizard'), mobile: true, desktop: false} ] }, {name: _UNO('.uno:InsertMenu', 'text'), type: 'menu', menu: [ @@ -378,7 +379,8 @@ L.Control.Menubar = L.Control.extend({ {name: _UNO('.uno:ViewMenu', 'spreadsheet'), id: 'view', type: 'menu', menu: [ {name: _UNO('.uno:FullScreen', 'spreadsheet'), id: 'fullscreen', type: 'action', mobileapp: false}, {type: 'separator', mobileapp: false}, - {uno: '.uno:Sidebar'} + {uno: '.uno:Sidebar'}, + {id: 'mobile-wizard', type: 'action', name: _('Mobile Wizard'), mobile: true, desktop: false} ]}, {name: _UNO('.uno:InsertMenu', 'spreadsheet'), type: 'menu', menu: [ {name: _('Local Image...'), id: 'insertgraphic', type: 'action'}, @@ -686,6 +688,22 @@ L.Control.Menubar = L.Control.extend({ }, _beforeShow: function(e, menu) { + var findUnoItemInMenu = function(items, unocommand) { + var returnItem = null; + $(items).each(function() { + var aItem = this; + var type = $(aItem).data('type'); + if (type === 'unocommand') { + var unoCommand = $(aItem).data('uno'); + if (unoCommand.startsWith(unocommand)) { + returnItem = aItem; + } + } + }); + + return returnItem; + }; + var self = e.data.self; var items = $(menu).children().children('a').not('.has-submenu'); $(items).each(function() { @@ -775,6 +793,18 @@ L.Control.Menubar = L.Control.extend({ $(aItem).removeClass('disabled'); $(aItem).removeClass(constChecked); } + } else if (id === 'mobile-wizard') { + if (window.mobileWizard === true) + $(aItem).addClass(constChecked); + else + $(aItem).removeClass(constChecked); + + var sidebarItem = findUnoItemInMenu(items, '.uno:Sidebar'); + + if (window.mobileWizard === true) + $(sidebarItem).addClass('disabled'); + else + $(sidebarItem).removeClass('disabled'); } else { $(aItem).removeClass('disabled'); } @@ -879,6 +909,11 @@ L.Control.Menubar = L.Control.extend({ } } else if (id === 'repair') { this._map._socket.sendMessage('commandvalues command=.uno:DocumentRepair'); + } else if (id === 'mobile-wizard') { + window.mobileWizard = window.mobileWizard ? false : true; + this._map.sendUnoCommand('.uno:Sidebar'); + if (!window.mobileWizard) + this._map.fire('closemobilewizard'); } else if (!window.ThisIsAMobileApp && id === 'warn-copy-paste') { var self = this; vex.dialog.alert({ @@ -1088,6 +1123,10 @@ L.Control.Menubar = L.Control.extend({ } } + if (menu[i].desktop == false && window.mode.isDesktop()) { + $(aItem).css('display', 'none'); + } + if (menu[i].tablet == false && window.mode.isTablet()) { $(aItem).css('display', 'none'); } diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index c6d5a71af..1f409a59e 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -757,7 +757,7 @@ L.TileLayer = L.GridLayer.extend({ }, _onJSDialogMsg: function (textMsg) { - if (window.mode.isMobile()) { + if (window.mode.isMobile() && window.mobileWizard === true) { var msgData = JSON.parse(textMsg.substring('jsdialog:'.length + 1)); this._openMobileWizard(msgData); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
