[Libreoffice-commits] online.git: 3 commits - loleaflet/src
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Thu Oct 17 12:24:41 UTC 2019
loleaflet/src/control/Control.JSDialogBuilder.js | 2
loleaflet/src/control/Control.Menubar.js | 107 ++++++++++++++++-------
loleaflet/src/control/Control.Toolbar.js | 2
3 files changed, 80 insertions(+), 31 deletions(-)
New commits:
commit 24569b5401566c3f1d59b129cea952001a171bfe
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Oct 17 14:13:31 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Oct 17 14:20:38 2019 +0200
mobile-menu: Remove every occurance of mobile / desktop attribute.
Now we have separate menu structur for mobile and desktop.
Change-Id: Ibf690e78a4cf43516a6859eb580dfb52e1f5029b
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index a7137d9e7..8aa500195 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -99,8 +99,7 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:InsertColumnBreak'},
{type: 'separator'},
{name: _UNO('.uno:HyperlinkDialog'), id: 'inserthyperlink', type: 'action'},
- {name: _('Insert Shape'), id: 'insertshape', desktop: false, type: 'action' },
- {uno: '.uno:InsertSymbol', mobile: false},
+ {uno: '.uno:InsertSymbol'},
{name: _UNO('.uno:FormattingMarkMenu', 'text'), type: 'menu', menu: [
{uno: '.uno:InsertNonBreakingSpace'},
{uno: '.uno:InsertHardHyphen'},
@@ -109,9 +108,9 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:InsertZWNBSP'},
{uno: '.uno:InsertLRM'},
{uno: '.uno:InsertRLM'}]},
- {name: _UNO('.uno:IndexesMenu', 'text'), type: 'menu', menu: [
+ {name: _UNO('.uno:IndexesMenu', 'text'), type: 'menu', menu: [
{uno: '.uno:InsertIndexesEntry'},
- {uno: '.uno:InsertAuthoritiesEntry', mobileapp: false},
+ {uno: '.uno:InsertAuthoritiesEntry'},
{uno: '.uno:InsertMultiIndex'}]},
]},
{name: _UNO('.uno:FormatMenu', 'text'), id: 'format', type: 'menu', menu: [
@@ -1322,10 +1321,6 @@ L.Control.Menubar = L.Control.extend({
$(aItem).data('id', menu[i].id);
}
- if (menu[i].desktop == false && window.mode.isDesktop()) {
- $(aItem).css('display', 'none');
- }
-
if (menu[i].tablet == false && window.mode.isTablet()) {
$(aItem).css('display', 'none');
}
@@ -1397,7 +1392,7 @@ L.Control.Menubar = L.Control.extend({
var items = this.options['mobile' + docType];
for (var i = 0; i < items.length; i++) {
- if (items[i].mobile !== false && this._checkItemVisibility(items[i]) === true) {
+ if (this._checkItemVisibility(items[i]) === true) {
topMenu.children.push(this._generateMenuStructure(items[i], docType, false));
}
}
@@ -1417,8 +1412,6 @@ L.Control.Menubar = L.Control.extend({
if (mainMenu) {
itemType = 'mainmenu';
} else {
- if (item.mobile === false)
- return undefined;
if (item.mobileapp == true && !window.ThisIsAMobileApp)
return undefined;
if (!item.menu) {
commit 86f9250b88afb2fa347a8040089e95543b39c910
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Oct 17 14:10:13 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Oct 17 14:20:38 2019 +0200
mobile-menu: Create a separate menu structure also for insert menu
This is the only menu which is still shared.
Change-Id: I6ff15dc64501ad71920edb0ee74b6f8407960dfd
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index a5fd375db..a7137d9e7 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -74,10 +74,9 @@ L.Control.Menubar = L.Control.extend({
{name: _('Local Image...'), id: 'insertgraphic', type: 'action'},
{name: _UNO('.uno:InsertGraphic', 'text'), id: 'insertgraphicremote', type: 'action'},
{name: _UNO('.uno:InsertAnnotation', 'text'), id: 'insertcomment', type: 'action'},
- {uno: '.uno:InsertObjectChart', mobile: false},
- {id: 'inserttable', type: 'action', name: _('Insert table'), desktop: false, tablet: false},
+ {uno: '.uno:InsertObjectChart'},
{type: 'separator'},
- {uno: '.uno:InsertSection', id: 'insertsection', mobile: false},
+ {uno: '.uno:InsertSection', id: 'insertsection'},
{name: _UNO('.uno:InsertField', 'text'), type: 'menu', menu: [
{uno: '.uno:InsertPageNumberField'},
{uno: '.uno:InsertPageCountField'},
@@ -283,15 +282,13 @@ L.Control.Menubar = L.Control.extend({
{name: _('Local Image...'), id: 'insertgraphic', type: 'action'},
{name: _UNO('.uno:InsertGraphic', 'presentation'), id: 'insertgraphicremote', type: 'action'},
{name: _UNO('.uno:InsertAnnotation', 'presentation'), id: 'insertcomment', type: 'action'},
- {uno: '.uno:InsertObjectChart', mobile: false},
- {id: 'inserttable', type: 'action', name: _('Insert table'), desktop: false, tablet: false},
+ {uno: '.uno:InsertObjectChart'},
{type: 'separator'},
{name: _UNO('.uno:HyperlinkDialog'), id: 'inserthyperlink', type: 'action'},
{type: 'separator'},
- {uno: '.uno:InsertSymbol', mobile: false},
+ {uno: '.uno:InsertSymbol'},
{type: 'separator'},
- {name: _('Insert Shape'), id: 'insertshape', desktop: false, type: 'action' },
- {uno: '.uno:HeaderAndFooter', mobile: false}]
+ {uno: '.uno:HeaderAndFooter'}]
},
{name: _UNO('.uno:FormatMenu', 'presentation'), id: 'format', type: 'menu', menu: [
{uno: '.uno:FontDialog'},
@@ -376,9 +373,8 @@ L.Control.Menubar = L.Control.extend({
{name: _UNO('.uno:InsertAnnotation', 'spreadsheet'), id: 'insertcomment', type: 'action'},
{type: 'separator'},
{name: _UNO('.uno:HyperlinkDialog'), id: 'inserthyperlink', type: 'action'},
- {name: _('Insert Shape'), id: 'insertshape', desktop: false, type: 'action' },
- {uno: '.uno:InsertSymbol', mobile: false},
- {uno: '.uno:EditHeaderAndFooter', mobile: false}
+ {uno: '.uno:InsertSymbol'},
+ {uno: '.uno:EditHeaderAndFooter'}
]},
{name: _UNO('.uno:FormatMenu', 'spreadsheet'), id: 'format', type: 'menu', menu: [
{uno: '.uno:ResetAttributes'},
@@ -607,6 +603,70 @@ L.Control.Menubar = L.Control.extend({
{name: _('About'), id: 'about', type: 'action'},
],
+ mobileInsertMenu : {
+ text : {
+ name: _UNO('.uno:InsertMenu', 'text'), id: 'insert', type: 'menu', menu: [
+ {name: _('Local Image...'), id: 'insertgraphic', type: 'action'},
+ {name: _UNO('.uno:InsertGraphic', 'text'), id: 'insertgraphicremote', type: 'action'},
+ {name: _UNO('.uno:InsertAnnotation', 'text'), id: 'insertcomment', type: 'action'},
+ {id: 'inserttable', type: 'action', name: _('Insert table')},
+ {type: 'separator'},
+ {name: _UNO('.uno:InsertField', 'text'), type: 'menu', menu: [
+ {uno: '.uno:InsertPageNumberField'},
+ {uno: '.uno:InsertPageCountField'},
+ {uno: '.uno:InsertDateField'},
+ {uno: '.uno:InsertTimeField'},
+ {uno: '.uno:InsertTitleField'},
+ {uno: '.uno:InsertAuthorField'},
+ {uno: '.uno:InsertTopicField'}
+ ]},
+ {name: _UNO('.uno:InsertHeaderFooterMenu', 'text'), type: 'menu', menu: [
+ {name: _UNO('.uno:InsertPageHeader', 'text'), type: 'menu', menu: [
+ {name: _('All'), disabled: true, id: 'insertheader', tag: '_ALL_', uno: '.uno:InsertPageHeader?'}]},
+ {name: _UNO('.uno:InsertPageFooter', 'text'), type: 'menu', menu: [
+ {name: _('All'), disabled: true, id: 'insertfooter', tag: '_ALL_', uno: '.uno:InsertPageFooter?'}]}
+ ]},
+ {uno: '.uno:InsertFootnote'},
+ {uno: '.uno:InsertEndnote'},
+ {type: 'separator'},
+ {uno: '.uno:InsertPagebreak'},
+ {uno: '.uno:InsertColumnBreak'},
+ {type: 'separator'},
+ {name: _UNO('.uno:HyperlinkDialog'), id: 'inserthyperlink', type: 'action'},
+ {name: _('Insert Shape'), id: 'insertshape', type: 'action' },
+ {name: _UNO('.uno:FormattingMarkMenu', 'text'), type: 'menu', menu: [
+ {uno: '.uno:InsertNonBreakingSpace'},
+ {uno: '.uno:InsertHardHyphen'},
+ {uno: '.uno:InsertSoftHyphen'},
+ {uno: '.uno:InsertZWSP'},
+ {uno: '.uno:InsertZWNBSP'},
+ {uno: '.uno:InsertLRM'},
+ {uno: '.uno:InsertRLM'}]},
+ ]
+ },
+ spreadsheet : {
+ name: _UNO('.uno:InsertMenu', 'spreadsheet'), id: 'insert', type: 'menu', menu: [
+ {name: _('Local Image...'), id: 'insertgraphic', type: 'action'},
+ {name: _UNO('.uno:InsertGraphic', 'spreadsheet'), id: 'insertgraphicremote', type: 'action'},
+ {uno: '.uno:InsertObjectChart'},
+ {name: _UNO('.uno:InsertAnnotation', 'spreadsheet'), id: 'insertcomment', type: 'action'},
+ {type: 'separator'},
+ {name: _UNO('.uno:HyperlinkDialog'), id: 'inserthyperlink', type: 'action'},
+ {name: _('Insert Shape'), id: 'insertshape', type: 'action' },
+ ]
+ },
+ presentation : {
+ name: _UNO('.uno:InsertMenu', 'presentation'), id: 'insert', type: 'menu', menu: [
+ {name: _('Local Image...'), id: 'insertgraphic', type: 'action'},
+ {name: _UNO('.uno:InsertGraphic', 'presentation'), id: 'insertgraphicremote', type: 'action'},
+ {name: _UNO('.uno:InsertAnnotation', 'presentation'), id: 'insertcomment', type: 'action'},
+ {id: 'inserttable', type: 'action', name: _('Insert table')},
+ {name: _UNO('.uno:HyperlinkDialog'), id: 'inserthyperlink', type: 'action'},
+ {name: _('Insert Shape'), id: 'insertshape', type: 'action' },
+ ]
+ }
+ },
+
commandStates: {},
// Only these menu options will be visible in readonly mode
@@ -1344,15 +1404,9 @@ L.Control.Menubar = L.Control.extend({
return topMenu;
},
- generateMenuStructureFor: function(targetId) {
+ generateInsertMenuStructure: function() {
var docType = this._map.getDocType();
- var items = this.options[docType];
- var target = items.find(function(item) { return item.id === targetId; });
-
- if (!target) {
- console.log('Cannot find item ' + targetId);
- return '';
- }
+ var target = this.options['mobileInsertMenu'][docType];
var menuStructure = this._generateMenuStructure(target, docType, true)
return menuStructure
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 70877b498..839a5df86 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -344,7 +344,7 @@ function onClick(e, id, item, subItem) {
if (window.mobileWizard)
this.onClick(null, 'mobile_wizard');
window.insertionMobileWizard = true;
- var menuData = map.menubar.generateMenuStructureFor('insert');
+ var menuData = map.menubar.generateInsertMenuStructure();
map.fire('mobilewizard', menuData);
toolbar.check(id);
}
commit f046f610d401dd50cfb3b809722f2509064d755f
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Oct 17 13:49:41 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Oct 17 14:17:13 2019 +0200
mobile-menu: Hide menu wizard when clicking on a menu item
Change-Id: Ie6235483a35c440569d9b295635ff6ea14a4e80d
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index a4ed49168..d171df0c7 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -704,6 +704,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
}
if (window.insertionMobileWizard)
window.onClick(null, 'insertion_mobile_wizard');
+ else if (window.mobileMenuWizard)
+ $('#main-menu-state').click()
});
} else {
console.debug('Builder used outside of mobile wizard: please implement the click handler');
More information about the Libreoffice-commits
mailing list