loleaflet/css/toolbar.css | 1 loleaflet/src/control/Control.JSDialogBuilder.js | 14 - loleaflet/src/control/Control.Menubar.js | 185 +++++++++++------------ loleaflet/src/control/Control.MobileWizard.js | 17 +- 4 files changed, 113 insertions(+), 104 deletions(-)
New commits: commit 6b0b1c3d52f6cab6dbcd095ab8a74b2d4e3d1fa5 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Oct 12 16:24:23 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Oct 12 16:44:58 2019 +0200 menu-to-mobile-wizard: Add sub menu arrow for every levels of menus Change-Id: Ie4ea6dfba664a8d39d1e5d7f973426563447f330 diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index a33c9ce31..032c031a3 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -181,16 +181,12 @@ L.Control.JSDialogBuilder = L.Control.extend({ _explorableMenu: function(parentContainer, title, children, builder) { var sectionTitle = L.DomUtil.create('div', 'ui-header level-' + builder._currentDepth + ' mobile-wizard ui-widget', parentContainer); - if (builder._currentDepth === 0) { - $(sectionTitle).css('justify-content', 'space-between'); + $(sectionTitle).css('justify-content', 'space-between'); - var titleSpan = L.DomUtil.create('span', 'sub-menu-title', sectionTitle); - titleSpan.innerHTML = title; - var arrowSpan = L.DomUtil.create('span', 'sub-menu-arrow', sectionTitle); - arrowSpan.innerHTML = '>'; - } else { - sectionTitle.innerHTML = title; - } + var titleSpan = L.DomUtil.create('span', 'sub-menu-title', sectionTitle); + titleSpan.innerHTML = title; + var arrowSpan = L.DomUtil.create('span', 'sub-menu-arrow', sectionTitle); + arrowSpan.innerHTML = '>'; var contentDiv = L.DomUtil.create('div', 'ui-content level-' + builder._currentDepth + ' mobile-wizard', parentContainer); contentDiv.title = title; commit b35920eb83c22f7dd45aa5dbebd8f794926f6d86 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Oct 11 23:59:20 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Oct 12 16:44:58 2019 +0200 menu-to-mobile-wizard: Trigger mobile menu wizard by hamburger menu button Change-Id: I731548722c6b294cd6e2c244ea7abbcad91fdd4a diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index d9ea20489..1d022c22c 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -640,6 +640,7 @@ L.Control.Menubar = L.Control.extend({ // SmartMenus mobile menu toggle button $(function() { var $mainMenuState = $('#main-menu-state'); + $('#main-menu-state').checked = false; if ($mainMenuState.length) { // animate mobile menu $mainMenuState.change(function() { @@ -647,11 +648,20 @@ L.Control.Menubar = L.Control.extend({ var $nav = $menu.parent(); if (this.checked) { self._map.fire('closesidebar'); - $nav.css({height: 'initial', bottom: '38px'}); - $menu.hide().slideDown(250, function() { $menu.css('display', ''); }); - } else { + if (!L.Browser.mobile) { + $nav.css({height: 'initial', bottom: '38px'}); + $menu.hide().slideDown(250, function() { $menu.css('display', ''); }); + } else { + window.mobileMenuWizard = true; + var menuData = self._map.menubar.generateFullMenuStructure(); + self._map.fire('mobilewizard', menuData); + } + } else if (!L.Browser.mobile) { $menu.show().slideUp(250, function() { $menu.css('display', ''); }); $nav.css({height:'', bottom: ''}); + } else { + window.mobileMenuWizard = false; + self._map.fire('closemobilewizard'); } }); // hide mobile menu beforeunload diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js index a7c1c66d4..828dbafeb 100644 --- a/loleaflet/src/control/Control.MobileWizard.js +++ b/loleaflet/src/control/Control.MobileWizard.js @@ -104,6 +104,8 @@ L.Control.MobileWizard = L.Control.extend({ w2ui['actionbar'].click('mobile_wizard') } else if (window.insertionMobileWizard === true) { w2ui['actionbar'].click('insertion_mobile_wizard') + } else if (window.mobileMenuWizard === true) { + $('#main-menu-state').click() } } else { this._currentDepth--; commit 0ce410e16cee1e3ccbde1b1a030cb0b0677fe0cd Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Oct 11 21:57:39 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Oct 12 16:44:58 2019 +0200 menu-to-mobile-wizard: Make the new menu wizard to take full heigh. Up to the top toolbar. Change-Id: I7f35e94bf491e7fd7032b42eefe47e6170cfecf3 diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css index 933e031cc..063a37887 100644 --- a/loleaflet/css/toolbar.css +++ b/loleaflet/css/toolbar.css @@ -996,7 +996,6 @@ tr.useritem > td > img { } #mobile-wizard { - height: 45%; width: 100%; position: fixed; bottom: 0px; diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index d6e96d5c9..d9ea20489 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -1178,9 +1178,9 @@ L.Control.Menubar = L.Control.extend({ generateFullMenuStructure: function() { var topMenu = { - type : 'mainmenu', + type : 'menubar', enabled : true, - text : '', + id : 'menubar', children : [] }; var docType = this._map.getDocType(); diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js index 3d094ce75..a7c1c66d4 100644 --- a/loleaflet/src/control/Control.MobileWizard.js +++ b/loleaflet/src/control/Control.MobileWizard.js @@ -143,14 +143,23 @@ L.Control.MobileWizard = L.Control.extend({ this._hideKeyboard(); // We can change the sidebar as we want here - if (!data.type || data.type !== 'mainmenu') { // sidebar indicator + if (data.id === '') { // sidebar indicator this._modifySidebarLayout(data); } L.control.jsDialogBuilder({mobileWizard: this, map: this.map}).build(this.content.get(0), [data]); - this._mainTitle = data.text ? data.text : ''; - this._setTitle(this._mainTitle); + if (data.id === 'insert') { + this._mainTitle = data.text ? data.text : ''; + this._setTitle(this._mainTitle); + } + + if (data.id === 'menubar') { + var newHeight = $(window).height() - $('#toolbar-wrapper').height() - 2; + $('#mobile-wizard').height(newHeight); + } else { + $('#mobile-wizard').height('45%'); + } } }, commit a85a6354f5fec2d35597725bb536d5cd48acf879 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Oct 11 21:19:59 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Oct 12 16:44:58 2019 +0200 menu-to-mobile-wizard: Hide menu items which are hidden conditionally. Change-Id: I8a56af70c0836a0332f2beab9e2006310dcf17e0 diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 9c49da9cc..d6e96d5c9 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -994,72 +994,76 @@ L.Control.Menubar = L.Control.extend({ }, - _createMenu: function(menu) { - var itemList = []; - var docType = this._map.getDocType(); - for (var i in menu) { - if (menu[i].id === 'about' && (L.DomUtil.get('about-dialog') === null)) { - continue; - } - if (menu[i].id === 'signdocument' && (L.DomUtil.get('document-signing-bar') === null)) { - continue; - } - - if (this._map._permission === 'readonly' && menu[i].type === 'menu') { - var found = false; - for (var j in this.options.allowedReadonlyMenus) { - if (this.options.allowedReadonlyMenus[j] === menu[i].id) { - found = true; - break; - } + _checkItemVisibility: function(menuItem) { + if (menuItem.id === 'about' && (L.DomUtil.get('about-dialog') === null)) { + return false; + } + if (menuItem.id === 'signdocument' && (L.DomUtil.get('document-signing-bar') === null)) { + return false; + } + if (this._map._permission === 'readonly' && menuItem.type === 'menu') { + var found = false; + for (var j in this.options.allowedReadonlyMenus) { + if (this.options.allowedReadonlyMenus[j] === menuItem.id) { + found = true; + break; } - if (!found) - continue; } + if (!found) + return false; + } + if (this._map._permission === 'readonly' && menuItem.id === 'last-mod') { + return false; + } - if (this._map._permission === 'readonly' && menu[i].id === 'last-mod') { - continue; + if (menuItem.type === 'action') { + if ((menuItem.id === 'rev-history' && !revHistoryEnabled) || + (menuItem.id === 'closedocument' && !closebutton)) { + return false; } + } - if (menu[i].type === 'action') { - if ((menu[i].id === 'rev-history' && !revHistoryEnabled) || - (menu[i].id === 'closedocument' && !closebutton)) { - continue; - } - } + if (menuItem.id === 'print' && this._map['wopi'].HidePrintOption) + return false; - if (menu[i].id === 'print' && this._map['wopi'].HidePrintOption) - continue; + if (menuItem.id === 'save' && this._map['wopi'].HideSaveOption) + return false; - if (menu[i].id === 'save' && this._map['wopi'].HideSaveOption) - continue; + if (menuItem.id === 'saveas' && this._map['wopi'].UserCanNotWriteRelative) + return false; - if (menu[i].id === 'saveas' && this._map['wopi'].UserCanNotWriteRelative) - continue; + if (menuItem.id === 'shareas' && !this._map['wopi'].EnableShare) + return false; - if (menu[i].id === 'shareas' && !this._map['wopi'].EnableShare) - continue; + if (menuItem.id === 'insertgraphicremote' && !this._map['wopi'].EnableInsertRemoteImage) + return false; - if (menu[i].id === 'insertgraphicremote' && !this._map['wopi'].EnableInsertRemoteImage) - continue; + if (menuItem.id && menuItem.id.startsWith('fullscreen-presentation') && this._map['wopi'].HideExportOption) + return false; - if (menu[i].id && menu[i].id.startsWith('fullscreen-presentation') && this._map['wopi'].HideExportOption) - continue; + if (menuItem.id === 'changesmenu' && this._map['wopi'].HideChangeTrackingControls) + return false; - if (menu[i].id === 'changesmenu' && this._map['wopi'].HideChangeTrackingControls) - continue; + // Keep track of all 'downloadas-' options and register them as + // export formats with docLayer which can then be publicly accessed unlike + // this Menubar control for which there doesn't seem to be any easy way + // to get access to. + if (menuItem.id && menuItem.id.startsWith('downloadas-')) { + var format = menuItem.id.substring('downloadas-'.length); + this._map._docLayer.registerExportFormat(menuItem.name, format); - // Keep track of all 'downloadas-' options and register them as - // export formats with docLayer which can then be publicly accessed unlike - // this Menubar control for which there doesn't seem to be any easy way - // to get access to. - if (menu[i].id && menu[i].id.startsWith('downloadas-')) { - var format = menu[i].id.substring('downloadas-'.length); - this._map._docLayer.registerExportFormat(menu[i].name, format); + if (this._map['wopi'].HideExportOption) + return false; + } + return true + }, - if (this._map['wopi'].HideExportOption) - continue; - } + _createMenu: function(menu) { + var itemList = []; + var docType = this._map.getDocType(); + for (var i in menu) { + if (this._checkItemVisibility(menu[i]) === false) + continue; var liItem = L.DomUtil.create('li', ''); if (menu[i].id) { @@ -1211,6 +1215,8 @@ L.Control.Menubar = L.Control.extend({ } else { if (item.mobile === false) return undefined; + if (item.mobileapp == true && !window.ThisIsAMobileApp) + return undefined; if (!item.menu) { itemType = 'menuitem'; } else { @@ -1239,9 +1245,11 @@ L.Control.Menubar = L.Control.extend({ if (item.menu) { for (var i = 0; i < item.menu.length; i++) { - var element = this._generateMenuStructure(item.menu[i], docType, false); - if (element) - menuStructure['children'].push(element); + if (this._checkItemVisibility(item.menu[i]) === true) { + var element = this._generateMenuStructure(item.menu[i], docType, false); + if (element) + menuStructure['children'].push(element); + } } } return menuStructure; commit 241ddc8d5c61435a29cfafb88efe39803c77de2d Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Oct 11 20:49:50 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Oct 12 16:44:58 2019 +0200 menu-to-mobile-wizard: Create JSON for the whole menu Change-Id: I93ca728be31f37714bf64665f1f07edb84c33fbd diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index d481c0f3b..9c49da9cc 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -1172,6 +1172,24 @@ L.Control.Menubar = L.Control.extend({ } }, + generateFullMenuStructure: function() { + var topMenu = { + type : 'mainmenu', + enabled : true, + text : '', + children : [] + }; + var docType = this._map.getDocType(); + var items = this.options[docType]; + + for (var i = 0; i < items.length; i++) { + if (items[i].mobile !== false) { + topMenu.children.push(this._generateMenuStructure(items[i], docType, false)); + } + } + return topMenu; + }, + generateMenuStructureFor: function(targetId) { var docType = this._map.getDocType(); var items = this.options[docType]; diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js index b3600cdc6..3d094ce75 100644 --- a/loleaflet/src/control/Control.MobileWizard.js +++ b/loleaflet/src/control/Control.MobileWizard.js @@ -143,7 +143,7 @@ L.Control.MobileWizard = L.Control.extend({ this._hideKeyboard(); // We can change the sidebar as we want here - if (!data.text) { // sidebar indicator + if (!data.type || data.type !== 'mainmenu') { // sidebar indicator this._modifySidebarLayout(data); } commit e34e5d2171e64ffd0c25af5bcde35305262dd0d8 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Oct 11 17:35:54 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Oct 12 16:44:58 2019 +0200 mobile: There is no 'mobile-wizard' menu item any more. Change-Id: I781d37a0d75d39f63fce1cbe572278e8a30895b3 diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index c927e0576..d481c0f3b 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -690,22 +690,6 @@ 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() { @@ -795,18 +779,6 @@ 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'); } @@ -926,11 +898,6 @@ 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({ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits