[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri May 24 07:14:06 UTC 2019
loleaflet/src/control/Control.Menubar.js | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
New commits:
commit b178d09ade88e913dac7a026e39d3a27b113e41a
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri May 24 09:38:20 2019 +0300
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 24 09:13:49 2019 +0200
tdf#124752: Do post the UNO clipboard commands in a mobile app
No reason to show the warn-copy-paste message in a mobile app. The
native code of the app has access to the system clipboard just fine.
This does not at such make the Edit>Copy etc menu entries work in the
iOS app (the LibreOffice core code does not yet have system clipboard
functionality for iOS, I am working on that), but this is one
necessary step.
This is a bit complicated, I don't like how the 'mobileappuno'
properties have to be "manually" propagated from one data structure to
another in the _createMenu function, but OTOH it's the same for the
'id' properties.
Change-Id: I0ebe964e6eb6e4a902118714c1779451004c751f
Reviewed-on: https://gerrit.libreoffice.org/72888
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index a8c3dd50f..35e0e1d97 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -36,9 +36,9 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:Redo'},
{name: _('Repair'), id: 'repair', type: 'action'},
{type: 'separator'},
- {name: _UNO('.uno:Cut'), id: 'warn-copy-paste', type: 'action'},
- {name: _UNO('.uno:Copy'), id: 'warn-copy-paste', type: 'action'},
- {name: _UNO('.uno:Paste'), id: 'warn-copy-paste', type: 'action'},
+ {name: _UNO('.uno:Cut'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Cut'},
+ {name: _UNO('.uno:Copy'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Copy'},
+ {name: _UNO('.uno:Paste'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Paste'},
{uno: '.uno:SelectAll'},
{type: 'separator'},
{uno: '.uno:SearchDialog'},
@@ -255,9 +255,9 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:Redo'},
{name: _('Repair'), id: 'repair', type: 'action'},
{type: 'separator'},
- {name: _UNO('.uno:Cut'), id: 'warn-copy-paste', type: 'action'},
- {name: _UNO('.uno:Copy'), id: 'warn-copy-paste', type: 'action'},
- {name: _UNO('.uno:Paste'), id: 'warn-copy-paste', type: 'action'},
+ {name: _UNO('.uno:Cut'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Cut'},
+ {name: _UNO('.uno:Copy'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Copy'},
+ {name: _UNO('.uno:Paste'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Paste'},
{uno: '.uno:SelectAll'},
{type: 'separator'},
{uno: '.uno:SearchDialog'}
@@ -343,9 +343,9 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:Redo'},
{name: _('Repair'), id: 'repair', type: 'action'},
{type: 'separator'},
- {name: _UNO('.uno:Cut'), id: 'warn-copy-paste', type: 'action'},
- {name: _UNO('.uno:Copy'), id: 'warn-copy-paste', type: 'action'},
- {name: _UNO('.uno:Paste'), id: 'warn-copy-paste', type: 'action'},
+ {name: _UNO('.uno:Cut'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Cut'},
+ {name: _UNO('.uno:Copy'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Copy'},
+ {name: _UNO('.uno:Paste'), id: 'warn-copy-paste', type: 'action', mobileappuno: '.uno:Paste'},
{uno: '.uno:SelectAll'},
{type: 'separator'},
{uno: '.uno:SearchDialog'}
@@ -793,7 +793,7 @@ L.Control.Menubar = L.Control.extend({
this._map.remove();
} else if (id === 'repair') {
this._map._socket.sendMessage('commandvalues command=.uno:DocumentRepair');
- } else if (id === 'warn-copy-paste') {
+ } else if (!window.ThisIsAMobileApp && id === 'warn-copy-paste') {
var self = this;
vex.dialog.alert({
message: _('<p>Your browser has very limited access to the clipboard, so use these keyboard shortcuts:<ul><li><b>Ctrl+C</b>: For copying.</li><li><b>Ctrl+X</b>: For cutting.</li><li><b>Ctrl+V</b>: For pasting.</li></ul></p>'),
@@ -802,6 +802,8 @@ L.Control.Menubar = L.Control.extend({
}
});
+ } else if (window.ThisIsAMobileApp && $(item).data('mobileappuno')) {
+ this._map.sendUnoCommand($(item).data('mobileappuno'));
}
// Inform the host if asked
if ($(item).data('postmessage') === 'true') {
@@ -985,6 +987,9 @@ L.Control.Menubar = L.Control.extend({
} else if (menu[i].type === 'action') {
$(aItem).data('type', 'action');
$(aItem).data('id', menu[i].id);
+ if (window.ThisIsAMobileApp && menu[i].mobileappuno) {
+ $(aItem).data('mobileappuno', menu[i].mobileappuno);
+ }
}
if (menu[i].tablet == false && window.mode.isTablet()) {
More information about the Libreoffice-commits
mailing list