loleaflet/src/control/Control.Menubar.js | 38 +++++++++++++++++++++++--- loleaflet/src/map/handler/Map.StateChanges.js | 4 +- 2 files changed, 37 insertions(+), 5 deletions(-)
New commits: commit 05f8befe1c90a0dd3a2c730ee95ecd6e57a3313e Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sun Dec 22 13:54:40 2019 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sun Dec 22 15:33:53 2019 +0100 Header and Footer menu options only show All in Android Add styles to the insertion mobile wizard. Change-Id: I7086a04b58999b7fe29cdb61f7488e34c241801f Reviewed-on: https://gerrit.libreoffice.org/85694 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index e27e24efd..ede42fcfa 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -816,8 +816,25 @@ L.Control.Menubar = L.Control.extend({ var pageStyles = e.commandValues['HeaderFooter']; for (var iterator in pageStyles) { style = pageStyles[iterator]; - $menuHeader.append(this._createUnoMenuItem(_(style), constHeader + encodeURIComponent(style) + constArg, style)); - $menuFooter.append(this._createUnoMenuItem(_(style), constFooter + encodeURIComponent(style) + constArg, style)); + if (!L.Browser.mobile) { + $menuHeader.append(this._createUnoMenuItem(_(style), constHeader + encodeURIComponent(style) + constArg, style)); + $menuFooter.append(this._createUnoMenuItem(_(style), constFooter + encodeURIComponent(style) + constArg, style)); + } else { + var docType = this._map.getDocType(); + var target = this.options['mobileInsertMenu'][docType]; + + var findFunction = function(item) { + return item.name === _(style); + }; + + var foundMenu = this._findSubMenuByName(target, _UNO('.uno:InsertPageHeader', 'text')) + if (foundMenu && foundMenu.menu.find(findFunction) === undefined) + foundMenu.menu.push({name: _(style), tag: style, uno: constHeader + encodeURIComponent(style) + constArg}); + + foundMenu = this._findSubMenuByName(target, _UNO('.uno:InsertPageFooter', 'text')) + if (foundMenu && foundMenu.menu.find(findFunction) === undefined) + foundMenu.menu.push({name: _(style), tag: style, uno: constFooter + encodeURIComponent(style) + constArg}); + } } } }, @@ -1492,7 +1509,22 @@ L.Control.Menubar = L.Control.extend({ } } return menuStructure; - } + }, + + _findSubMenuByName: function(menuTarget, nameString) { + if (menuTarget.name === nameString) + return menuTarget; + + if (menuTarget.menu) + { + for (var i = 0; i < menuTarget.menu.length; i++) { + var foundItem = this._findSubMenuByName(menuTarget.menu[i], nameString); + if (foundItem) + return foundItem; + } + } + return null; + }, }); L.control.menubar = function (options) { commit 544b5ffe41f9a2ceca81ef91e91417bc3f394bbc Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Dec 20 17:49:27 2019 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sun Dec 22 15:33:46 2019 +0100 Fix state of InsertPageHeader / InsertPageFooter Change-Id: Iee359cdd8d4706d4cf8f7d5cc3363808c3fdb066 Reviewed-on: https://gerrit.libreoffice.org/85693 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/loleaflet/src/map/handler/Map.StateChanges.js b/loleaflet/src/map/handler/Map.StateChanges.js index 6afcd642c..a6b5d3f81 100644 --- a/loleaflet/src/map/handler/Map.StateChanges.js +++ b/loleaflet/src/map/handler/Map.StateChanges.js @@ -30,9 +30,9 @@ L.Map.StateChangeHandler = L.Handler.extend({ var slideMasterPageItem = this._map['stateChangeHandler'].getItemValue('.uno:SlideMasterPage'); var state; - if (typeof(e.state == 'object')) { + if (typeof(e.state) == 'object') { state = e.state; - } else if (typeof(e.state == 'string')) { + } else if (typeof(e.state) == 'string') { var index = e.state.indexOf('{'); state = index !== -1 ? JSON.parse(e.state.substring(index)) : e.state; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits