[Libreoffice-commits] online.git: loleaflet/src
Pranam Lashkari (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 22 09:13:15 UTC 2020
loleaflet/src/control/Control.ContextMenu.js | 2
loleaflet/src/control/Control.JSDialogBuilder.js | 52 +++++++++++++++++++++++
loleaflet/src/control/Control.Tabs.js | 4 -
loleaflet/src/map/Map.js | 52 -----------------------
4 files changed, 54 insertions(+), 56 deletions(-)
New commits:
commit 8add3d1274fccbd6c46ca941585396d276460e4d
Author: Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Wed Jan 22 04:29:52 2020 +0530
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Jan 22 10:12:56 2020 +0100
Moved: getMenuStructureForMobileWizard
moved the getMenuStructureForMobileWizard from map
to more appropriate place in JSDialogBuilder.js
Change-Id: I366b8317c6469652ee9469746ae7b78c2c3a1f7f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87169
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js
index 692bd8a41..c00434629 100644
--- a/loleaflet/src/control/Control.ContextMenu.js
+++ b/loleaflet/src/control/Control.ContextMenu.js
@@ -114,7 +114,7 @@ L.Control.ContextMenu = L.Control.extend({
}
if (window.mode.isMobile()) {
window.contextMenuWizard = true;
- var menuData = this._map.getMenuStructureForMobileWizard(contextMenu, true, '');
+ var menuData = L.Control.JSDialogBuilder.getMenuStructureForMobileWizard(contextMenu, true, '');
if (spellingContextMenu === true) {
vex.timer = setInterval(function() {
map.fire('mobilewizard', menuData);
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 4308b1651..e5c48f53e 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -1549,6 +1549,58 @@ L.Control.JSDialogBuilder = L.Control.extend({
}
});
+L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainMenu, itemCommand) {
+ if (itemCommand.includes('sep'))
+ return null;
+
+ var itemText = '';
+ if (menu.name)
+ itemText = menu.name;
+
+ var itemType = 'submenu';
+ var executionType = 'menu';
+ if (mainMenu) {
+ itemType = 'mainmenu';
+ executionType = 'menu';
+ } else if (menu.callback) {
+ itemType = 'menuitem';
+ executionType = 'callback';
+ } else if (!menu.items) {
+ itemType = 'menuitem';
+ executionType = 'command';
+ }
+
+ var menuStructure = {
+ type : itemType,
+ enabled : true,
+ text : itemText,
+ executionType : executionType,
+ children : []
+ };
+ if (itemCommand)
+ menuStructure['command'] = itemCommand;
+ if (menu.icon)
+ menuStructure['checked'] = true;
+ if (menu.callback)
+ menuStructure['callback'] = menu.callback;
+
+ if (mainMenu) {
+ for (var menuItem in menu) {
+ var element = this.getMenuStructureForMobileWizard(menu[menuItem], false, menuItem);
+ if (element)
+ menuStructure['children'].push(element);
+ }
+ } else if (itemType == 'submenu') {
+ for (menuItem in menu.items) {
+ element = this.getMenuStructureForMobileWizard(menu.items[menuItem], false, menuItem);
+ if (element)
+ menuStructure['children'].push(element);
+ }
+ }
+
+ return menuStructure;
+};
+
L.control.jsDialogBuilder = function (options) {
var builder = new L.Control.JSDialogBuilder(options);
builder._setup(options);
diff --git a/loleaflet/src/control/Control.Tabs.js b/loleaflet/src/control/Control.Tabs.js
index 14546117c..555a141b1 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -82,7 +82,6 @@ L.Control.Tabs = L.Control.extend({
var parts = e.parts;
var selectedPart = e.selectedPart;
var docType = e.docType;
- var map = this._map;
if (docType === 'text') {
return;
@@ -107,7 +106,7 @@ L.Control.Tabs = L.Control.extend({
ssTabScroll.id = 'spreadsheet-tab-scroll';
if (window.mode.isMobile()) {
- var menuData = map.getMenuStructureForMobileWizard(this._menuItem, true, '');
+ var menuData = L.Control.JSDialogBuilder.getMenuStructureForMobileWizard(this._menuItem, true, '');
}
for (var i = 0; i < parts; i++) {
@@ -198,7 +197,6 @@ L.Control.Tabs = L.Control.extend({
_hideSheet: function() {
this._map.hidePage();
}
-
});
L.control.tabs = function (options) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 19ff81155..58eff38eb 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1755,58 +1755,6 @@ L.Map = L.Evented.extend({
this.removeLayer(this.focusLayer);
this.focusLayer = null;
}
- },
-
- getMenuStructureForMobileWizard: function(menu, mainMenu, itemCommand) {
- if (itemCommand.includes('sep'))
- return null;
-
- var itemText = '';
- if (menu.name)
- itemText = menu.name;
-
- var itemType = 'submenu';
- var executionType = 'menu';
- if (mainMenu) {
- itemType = 'mainmenu';
- executionType = 'menu';
- } else if (menu.callback) {
- itemType = 'menuitem';
- executionType = 'callback';
- } else if (!menu.items) {
- itemType = 'menuitem';
- executionType = 'command';
- }
-
- var menuStructure = {
- type : itemType,
- enabled : true,
- text : itemText,
- executionType : executionType,
- children : []
- };
- if (itemCommand)
- menuStructure['command'] = itemCommand;
- if (menu.icon)
- menuStructure['checked'] = true;
- if (menu.callback)
- menuStructure['callback'] = menu.callback;
-
- if (mainMenu) {
- for (var menuItem in menu) {
- var element = this.getMenuStructureForMobileWizard(menu[menuItem], false, menuItem);
- if (element)
- menuStructure['children'].push(element);
- }
- } else if (itemType == 'submenu') {
- for (menuItem in menu.items) {
- element = this.getMenuStructureForMobileWizard(menu.items[menuItem], false, menuItem);
- if (element)
- menuStructure['children'].push(element);
- }
- }
-
- return menuStructure;
}
});
More information about the Libreoffice-commits
mailing list