diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-03-19 15:23:19 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-03-20 14:31:40 +0100 |
commit | 795407a7591ef924b351711826e0a0e5fff9d16d (patch) | |
tree | 81613840d900bf3ea24c83311c61977bffbbbb43 | |
parent | 8fbfcb6715a69b1e0a959f4df181f484bd0fd63a (diff) |
mobile: better way for identifying submenus.
We actually have commands for submenus too, so
we can use them to generate IDs.
Adjust the icon names, which are now generated from
commands.
Change-Id: I76bb69fb8f83cddfb3d36c3ee74739091bc08f2d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90763
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 7285fad0f9b076b9667b9c254dd2f54a88ea67f9)
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90645
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | loleaflet/images/lc_anchormenu.svg | 55 | ||||
-rw-r--r-- | loleaflet/images/lc_arrangeframemenu.svg (renamed from loleaflet/images/lc_submenu_bringtofront.svg) | 0 | ||||
-rw-r--r-- | loleaflet/images/lc_arrangemenu.svg | 1 | ||||
-rw-r--r-- | loleaflet/images/lc_rotateflipmenu.svg (renamed from loleaflet/images/lc_submenu_rotateright.svg) | 0 | ||||
-rw-r--r-- | loleaflet/images/lc_submenu_setanchoratchar.svg | 53 | ||||
-rw-r--r-- | loleaflet/images/lc_wrapmenu.svg (renamed from loleaflet/images/lc_submenu_wrapoff.svg) | 0 | ||||
-rw-r--r-- | loleaflet/src/control/Control.ContextMenu.js | 1 | ||||
-rw-r--r-- | loleaflet/src/control/Control.JSDialogBuilder.js | 18 |
8 files changed, 59 insertions, 69 deletions
diff --git a/loleaflet/images/lc_anchormenu.svg b/loleaflet/images/lc_anchormenu.svg index 66bcde439..94262ca3d 100644 --- a/loleaflet/images/lc_anchormenu.svg +++ b/loleaflet/images/lc_anchormenu.svg @@ -1,4 +1,53 @@ -<svg version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> - <path d="m8.0488 2-7.0488 20h2.9863c0.32039 0 0.58719-0.09076 0.80078-0.27148 0.2233-0.19076 0.3735-0.3963 0.45117-0.61719l1.209-3.916h5.8047l0.044922-0.03125c0.25925-0.18599 0.57769-0.29488 0.90625-0.29687 0.73878-0.003821 1.2821 0.55054 1.4883 1.123v-1.6133h-0.24414c-0.87923 0-1.623-0.73808-1.623-1.6211 0-0.71181 0.53066-1.2243 1.1797-1.4375-0.34798-0.47875-0.55598-1.0542-0.55664-1.6719v-0.001953c-2.55e-4 -0.90942 0.44146-1.7171 1.1113-2.2441l-2.6074-7.4004h-3.9023zm1.9375 3.6445c0.12621 0.49197 0.25074 0.94941 0.37695 1.3711 0.12621 0.41165 0.24873 0.77274 0.36524 1.084l1.9648 6.3242h-5.3867l1.9648-6.3086c0.1068-0.31124 0.2234-0.67792 0.34961-1.0996 0.12621-0.42169 0.24873-0.87913 0.36523-1.3711z" fill="#696969"/> - <path d="m16.314 9.7778a1.8667 1.8667 0 0 0-1.8667 1.8667 1.8667 1.8667 0 0 0 1.2444 1.7585v0.73036h-1.2444c-0.34471 0-0.62222 0.27751-0.62222 0.62222s0.27751 0.62222 0.62222 0.62222h1.2444v5.5563c-1.0596-0.13504-2.0494-0.60481-2.8207-1.3466l0.66111-0.46302a0.61243 0.67872 0 0 0-0.32326-1.2578 0.61243 0.67872 0 0 0-0.33056 0.11059l-2.4876 1.7379a0.61265 0.67896 0 1 0 0.65383 1.1484l0.79476-0.55538c1.1666 1.213 2.7771 1.9128 4.4746 1.9141 1.698-9.33e-4 3.309-0.70087 4.4759-1.9141l0.79358 0.55538a0.61265 0.67896 0 1 0 0.65383-1.1484l-2.4876-1.7379a0.61243 0.67872 0 0 0-0.33056-0.11059 0.61243 0.67872 0 0 0-0.32326 1.2578l0.66478 0.46545c-0.7723 0.74169-1.7638 1.2114-2.8243 1.3453v-5.5574h1.2444c0.34471 0 0.62222-0.27751 0.62222-0.62222 0-0.34471-0.27751-0.62222-0.62222-0.62222h-1.2444v-0.73161a1.8667 1.8667 0 0 0 1.2444-1.7573 1.8667 1.8667 0 0 0-1.8667-1.8667zm0 1.2444a0.62222 0.62222 0 0 1 0.62222 0.62222 0.62222 0.62222 0 0 1-0.62222 0.62222 0.62222 0.62222 0 0 1-0.62222-0.62222 0.62222 0.62222 0 0 1 0.62222-0.62222z" fill="#4d82b8" stroke-width=".62222"/> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 24 24" + version="1.1" + id="svg4" + sodipodi:docname="lc_submenu_setanchoratchar.svg" + inkscape:version="0.92.4 (unknown)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="748" + inkscape:window-height="480" + id="namedview6" + showgrid="false" + inkscape:zoom="9.8333333" + inkscape:cx="12" + inkscape:cy="12" + inkscape:window-x="0" + inkscape:window-y="30" + inkscape:window-maximized="0" + inkscape:current-layer="svg4" /> + <path + d="m12 2a3 3 0 0 0 -3 3 3 3 0 0 0 2 2.8261719v1.1738281h-2c-.554 0-1 .446-1 1s .446 1 1 1h2v8.929688c-1.7029249-.217027-3.2936626-.97202-4.5332031-2.164063l1.0625-.744141a.9842562 1.0907768 0 0 0 -.5195313-2.021484.9842562 1.0907768 0 0 0 -.53125.177734l-3.9980468 2.792969a.9842562 1.0907768 0 1 0 1.0507812 1.845703l1.2773438-.892578c1.8749123 1.949387 4.4631707 3.074058 7.1914062 3.076172 2.728857-.001543 5.317991-1.126379 7.193359-3.076172l1.275391.892578a.98425669 1.0907768 0 1 0 1.050781-1.845703l-3.998047-2.792969a.98425669 1.0907768 0 0 0 -.53125-.177734.98425669 1.0907768 0 0 0 -.519531 2.021484l1.068359.748047c-1.24124 1.192002-2.8347 1.946875-4.539062 2.16211v-8.931641h2c .554 0 1-.446 1-1s-.446-1-1-1h-2v-1.1757812a3 3 0 0 0 2-2.8242188 3 3 0 0 0 -3-3zm0 2a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1-1 1 1 0 0 1 1-1z" + fill="#4d82b8" + id="path2" /> </svg> diff --git a/loleaflet/images/lc_submenu_bringtofront.svg b/loleaflet/images/lc_arrangeframemenu.svg index 7caa5b828..7caa5b828 100644 --- a/loleaflet/images/lc_submenu_bringtofront.svg +++ b/loleaflet/images/lc_arrangeframemenu.svg diff --git a/loleaflet/images/lc_arrangemenu.svg b/loleaflet/images/lc_arrangemenu.svg new file mode 100644 index 000000000..7caa5b828 --- /dev/null +++ b/loleaflet/images/lc_arrangemenu.svg @@ -0,0 +1 @@ +<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m2.9492188 14c-.5263 0-.9492188.422919-.9492188.949219v6.101562c0 .5263.4229188.949219.9492188.949219h8.1015622c.5263 0 .949219-.422919.949219-.949219v-2.050781h-1v2h-8v-6h1v-1z" fill="#808080"/><path d="m3 15v6h8v-2h-6c-.554 0-1-.446-1-1v-3z" fill="#fff"/><path d="m12.949219 2c-.5263 0-.949219.4229187-.949219.9492188v2.0507812h1v-2h8v6h-1v1h1.050781c.5263 0 .949219-.4229188.949219-.9492188v-6.1015624c0-.5263-.422919-.9492188-.949219-.9492188z" fill="#808080"/><path d="m13 3v2h6c.554 0 1 .446 1 1v3h1v-6z" fill="#fff"/><rect fill="#eac282" height="12" ry="1.254237" width="14" x="5" y="6"/></svg>
\ No newline at end of file diff --git a/loleaflet/images/lc_submenu_rotateright.svg b/loleaflet/images/lc_rotateflipmenu.svg index 40e86d9b3..40e86d9b3 100644 --- a/loleaflet/images/lc_submenu_rotateright.svg +++ b/loleaflet/images/lc_rotateflipmenu.svg diff --git a/loleaflet/images/lc_submenu_setanchoratchar.svg b/loleaflet/images/lc_submenu_setanchoratchar.svg deleted file mode 100644 index 94262ca3d..000000000 --- a/loleaflet/images/lc_submenu_setanchoratchar.svg +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - viewBox="0 0 24 24" - version="1.1" - id="svg4" - sodipodi:docname="lc_submenu_setanchoratchar.svg" - inkscape:version="0.92.4 (unknown)"> - <metadata - id="metadata10"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs8" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="748" - inkscape:window-height="480" - id="namedview6" - showgrid="false" - inkscape:zoom="9.8333333" - inkscape:cx="12" - inkscape:cy="12" - inkscape:window-x="0" - inkscape:window-y="30" - inkscape:window-maximized="0" - inkscape:current-layer="svg4" /> - <path - d="m12 2a3 3 0 0 0 -3 3 3 3 0 0 0 2 2.8261719v1.1738281h-2c-.554 0-1 .446-1 1s .446 1 1 1h2v8.929688c-1.7029249-.217027-3.2936626-.97202-4.5332031-2.164063l1.0625-.744141a.9842562 1.0907768 0 0 0 -.5195313-2.021484.9842562 1.0907768 0 0 0 -.53125.177734l-3.9980468 2.792969a.9842562 1.0907768 0 1 0 1.0507812 1.845703l1.2773438-.892578c1.8749123 1.949387 4.4631707 3.074058 7.1914062 3.076172 2.728857-.001543 5.317991-1.126379 7.193359-3.076172l1.275391.892578a.98425669 1.0907768 0 1 0 1.050781-1.845703l-3.998047-2.792969a.98425669 1.0907768 0 0 0 -.53125-.177734.98425669 1.0907768 0 0 0 -.519531 2.021484l1.068359.748047c-1.24124 1.192002-2.8347 1.946875-4.539062 2.16211v-8.931641h2c .554 0 1-.446 1-1s-.446-1-1-1h-2v-1.1757812a3 3 0 0 0 2-2.8242188 3 3 0 0 0 -3-3zm0 2a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1-1 1 1 0 0 1 1-1z" - fill="#4d82b8" - id="path2" /> -</svg> diff --git a/loleaflet/images/lc_submenu_wrapoff.svg b/loleaflet/images/lc_wrapmenu.svg index b34b507e0..b34b507e0 100644 --- a/loleaflet/images/lc_submenu_wrapoff.svg +++ b/loleaflet/images/lc_wrapmenu.svg diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js index 3a81d430c..1c8dee80a 100644 --- a/loleaflet/src/control/Control.ContextMenu.js +++ b/loleaflet/src/control/Control.ContextMenu.js @@ -280,6 +280,7 @@ L.Control.ContextMenu = L.Control.extend({ contextMenu['submenu' + subMenuIdx++] = { name: _(itemName).replace(/\(~[A-Za-z]\)/, '').replace('~', ''), + command: item.command, items: submenu }; isLastItemText = true; diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 125dbae90..cb0b607ee 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -1658,17 +1658,6 @@ L.Control.JSDialogBuilder = L.Control.extend({ } }); -L.Control.JSDialogBuilder.generateIDForSubMenu = function(menuStructure) { - for (var child = 0; child < menuStructure['children'].length; ++child) { - if (menuStructure['children'][child]['command'] === '.uno:SetAnchorAtChar' || menuStructure['children'][child]['command'] === '.uno:WrapOff' || menuStructure['children'][child]['command'] === '.uno:BringToFront' || menuStructure['children'][child]['command'] === '.uno:RotateRight') { - var tempstring = menuStructure['children'][child]['command']; - tempstring = tempstring.substring(5); - menuStructure['id'] = 'submenu_' + tempstring.toLowerCase(); - break; - } - } -}; - L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainMenu, itemCommand) { if (itemCommand.includes('sep')) return null; @@ -1708,7 +1697,8 @@ L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainM if (mainMenu) { for (var menuItem in menu) { - var element = this.getMenuStructureForMobileWizard(menu[menuItem], false, menuItem); + var subItemCommand = menu[menuItem].command ? menu[menuItem].command : menuItem; + var element = this.getMenuStructureForMobileWizard(menu[menuItem], false, subItemCommand); if (element) menuStructure['children'].push(element); } @@ -1718,7 +1708,9 @@ L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainM if (element) menuStructure['children'].push(element); } - this.generateIDForSubMenu(menuStructure); + if (menu.command) { + menuStructure.id = menu.command.substring(5).toLowerCase(); + } } return menuStructure; |