loleaflet/src/control/Control.Menubar.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
New commits: commit a494b4f8d50c179c19fa87cce87cdfc2eafdf14e Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Fri May 24 09:38:20 2019 +0300 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Tue May 28 08:59:59 2019 +0300 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 <t...@collabora.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 5b728654d..4da0b7d51 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'}, @@ -251,9 +251,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'} @@ -339,9 +339,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'} @@ -786,8 +786,10 @@ 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') { vex.dialog.alert({unsafeMessage: _('<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>')}); + } else if (window.ThisIsAMobileApp && $(item).data('mobileappuno')) { + this._map.sendUnoCommand($(item).data('mobileappuno')); } // Inform the host if asked if ($(item).data('postmessage') === 'true') { @@ -971,6 +973,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()) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits