[Libreoffice-commits] online.git: cypress_test/integration_tests loleaflet/src
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 30 13:57:17 UTC 2020
cypress_test/integration_tests/mobile/writer/spellchecking_spec.js | 8 -
loleaflet/src/control/Control.JSDialogBuilder.js | 42 ++++++++--
loleaflet/src/core/LOUtil.js | 18 +++-
3 files changed, 55 insertions(+), 13 deletions(-)
New commits:
commit f57fb8a91df8ce3f9f158b45eb2fb861be3e5c30
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Mar 27 14:33:43 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Mar 30 15:56:57 2020 +0200
mobile: add special icon names for spelling context menu items.
Change-Id: I9f5388a57f3f2079a0accbd8f43fc884a618af1f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91276
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
index 6bd70282d..36df0e2c3 100644
--- a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
@@ -93,7 +93,7 @@ describe('Spell checking menu.', function() {
it('Check language status for selection.', function() {
openContextMenu();
- cy.get('.sub-menu-title')
+ cy.get('.menu-entry-with-icon')
.contains('Set Language for Selection')
.click();
@@ -105,7 +105,7 @@ describe('Spell checking menu.', function() {
it('Set None Language for selection.', function() {
openContextMenu();
- cy.get('.sub-menu-title')
+ cy.get('.menu-entry-with-icon')
.contains('Set Language for Selection')
.click();
@@ -123,7 +123,7 @@ describe('Spell checking menu.', function() {
it('Check language status for paragraph.', function() {
openContextMenu();
- cy.get('.sub-menu-title')
+ cy.get('.menu-entry-with-icon')
.contains('Set Language for Paragraph')
.click();
@@ -135,7 +135,7 @@ describe('Spell checking menu.', function() {
it('Set None Language for paragraph.', function() {
openContextMenu();
- cy.get('.sub-menu-title')
+ cy.get('.menu-entry-with-icon')
.contains('Set Language for Paragraph')
.click();
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 1854e8e57..a7394813f 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -352,6 +352,32 @@ L.Control.JSDialogBuilder = L.Control.extend({
}
},
+ _generateMenuIconName: function(commandName) {
+ // command has no parameter
+ if (commandName.indexOf('?') === -1)
+ return commandName.toLowerCase();
+
+ if (commandName.indexOf('SpellCheckIgnoreAll') !== -1)
+ return 'spellcheckignoreall';
+ if (commandName.indexOf('SpellCheckIgnore') !== -1)
+ return 'spellcheckignore';
+ if (commandName === 'LanguageStatus?Language:string=Current_LANGUAGE_NONE')
+ return 'selectionlanugagenone';
+ if (commandName === 'LanguageStatus?Language:string=Current_RESET_LANGUAGES')
+ return 'selectionlanugagedefault';
+ if (commandName === 'LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE')
+ return 'paragraphlanugagenone';
+ if (commandName === 'LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES')
+ return 'paragraphlanugagedefault';
+ if ((this.map.getDocType() === 'spreadsheet' || this.map.getDocType() === 'presentation') &&
+ commandName.indexOf('LanguageStatus?Language:string=Paragraph_') !== -1)
+ return 'paragraphlanugagesuggestion';
+ if ((this.map.getDocType() === 'spreadsheet' || this.map.getDocType() === 'presentation') &&
+ commandName.indexOf('LanguageStatus?Language:string=Current_') !== -1)
+ return 'selectionlanugagesuggestion';
+ return commandName.toLowerCase();
+ },
+
_explorableMenu: function(parentContainer, title, children, builder, customContent, dataid) {
dataid = dataid || 0;
var icon = null;
@@ -359,9 +385,10 @@ L.Control.JSDialogBuilder = L.Control.extend({
$(sectionTitle).css('justify-content', 'space-between');
var commandName = dataid;
- if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName)) {
- var iconSpan = L.DomUtil.create('span', 'menu-entry-icon ' + commandName.toLowerCase(), sectionTitle);
- var iconPath = 'images/lc_' + commandName.toLowerCase() + '.svg';
+ if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName, builder.map.getDocType())) {
+ var iconName = builder._generateMenuIconName(commandName);
+ var iconSpan = L.DomUtil.create('span', 'menu-entry-icon ' + iconName, sectionTitle);
+ var iconPath = 'images/lc_' + iconName + '.svg';
icon = L.DomUtil.create('img', '', iconSpan);
icon.src = iconPath;
icon.alt = '';
@@ -937,7 +964,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
div.id = data.id;
var commandName = data.id ? data.id.substring('.uno:'.length) : data.id;
- if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName)) {
+ if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName, builder.map.getDocType())) {
var image = L.DomUtil.create('img', 'spinfieldimage', div);
var icon = builder._createIconPath(data.id);
image.src = icon;
@@ -1487,9 +1514,10 @@ L.Control.JSDialogBuilder = L.Control.extend({
var icon = null;
var commandName = data.command && data.command.substring(0, '.uno:'.length) === '.uno:' ? data.command.substring('.uno:'.length) : data.id;
- if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName)) {
- var iconSpan = L.DomUtil.create('span', 'menu-entry-icon ' + commandName.toLowerCase(), menuEntry);
- var iconPath = 'images/lc_' + commandName.toLowerCase() + '.svg';
+ if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName, builder.map.getDocType())) {
+ var iconName = builder._generateMenuIconName(commandName);
+ var iconSpan = L.DomUtil.create('span', 'menu-entry-icon ' + iconName, menuEntry);
+ var iconPath = 'images/lc_' + iconName + '.svg';
icon = L.DomUtil.create('img', '', iconSpan);
icon.src = iconPath;
icon.alt = '';
diff --git a/loleaflet/src/core/LOUtil.js b/loleaflet/src/core/LOUtil.js
index d66090d71..4d144cfc0 100644
--- a/loleaflet/src/core/LOUtil.js
+++ b/loleaflet/src/core/LOUtil.js
@@ -95,13 +95,27 @@ L.LOUtil = {
'None'
],
- existsIconForCommand: function(command) {
+ existsIconForCommand: function(command, docType) {
var commandName = command.startsWith('.uno:') ? command.substring('.uno:'.length) : command;
var res = !this.commandWithoutIcon.find(function (el) {
return el.startsWith(commandName);
});
- if (commandName.indexOf('?')!== -1)
+ if (commandName.indexOf('?')!== -1) {
+ if (commandName.indexOf('SpellCheckIgnore') !== -1 || commandName.indexOf('SpellCheckIgnoreAll') !== -1)
+ return true;
+
+ if ((docType === 'spreadsheet' || docType === 'presentation') &&
+ commandName.indexOf('LanguageStatus') !== -1)
+ return true;
+
+ if (commandName === 'LanguageStatus?Language:string=Current_LANGUAGE_NONE' ||
+ commandName === 'LanguageStatus?Language:string=Current_RESET_LANGUAGES' ||
+ commandName === 'LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE' ||
+ commandName === 'LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES')
+ return true;
+
return false;
+ }
return res;
},
More information about the Libreoffice-commits
mailing list