.gitignore | 3 bundled/include/LibreOfficeKit/LibreOfficeKit.h | 3 bundled/include/LibreOfficeKit/LibreOfficeKit.hxx | 10 configure.ac | 13 - debian/changelog | 6 debian/control | 2 ios/Mobile.xcodeproj/project.pbxproj | 92 +++++++ ios/Mobile/AppDelegate.h | 6 ios/Mobile/AppDelegate.mm | 164 ++++++++++++- ios/Mobile/Document.mm | 24 + ios/Mobile/DocumentBrowserViewController.mm | 4 ios/Mobile/DocumentViewController.h | 3 ios/Mobile/DocumentViewController.mm | 82 ++++++ ios/Mobile/Info.plist.in | 2 ios/Mobile/L10n.h | 13 + ios/Mobile/L10n.mm | 28 ++ ios/Mobile/Resources/Settings.bundle/Root.plist | 49 +++ ios/Mobile/Resources/Settings.bundle/en.lproj/Root.strings |binary ios/Mobile/TemplateCollectionViewController.h | 4 ios/Mobile/TemplateCollectionViewController.mm | 56 +++- ios/README | 4 ios/config.h.in | 3 ios/ios.h | 4 ios/ios.mm | 5 kit/ChildSession.cpp | 4 kit/Kit.cpp | 18 - loleaflet/css/loleaflet.css | 8 loleaflet/css/toolbar.css | 20 - loleaflet/js/toolbar.js | 21 - loleaflet/plugins/path-transform/src/Path.Drag.js | 9 loleaflet/src/control/Control.LokDialog.js | 17 - loleaflet/src/control/Control.Menubar.js | 4 loleaflet/src/control/Control.PartsPreview.js | 51 +++- loleaflet/src/control/Control.Tabs.js | 2 loleaflet/src/control/Permission.js | 3 loleaflet/src/control/Ruler.js | 24 + loleaflet/src/control/Toolbar.js | 8 loleaflet/src/layer/tile/TileLayer.js | 35 +- loleaflet/src/layer/vector/SVGGroup.js | 26 +- loleaflet/src/map/Map.js | 6 loleaflet/src/map/handler/Map.FileInserter.js | 8 loleaflet/src/map/handler/Map.SlideShow.js | 4 loolkitconfig.xcu | 5 loolwsd.spec.in | 2 wsd/ClientSession.cpp | 5 wsd/DocumentBroker.cpp | 23 + wsd/DocumentBroker.hpp | 21 + wsd/LOOLWSD.cpp | 32 +- 48 files changed, 779 insertions(+), 157 deletions(-)
New commits: commit 9dd2e908f4df5789be26ab46ba23d1a030076225 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Tue Mar 12 22:31:02 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:31:02 2019 +0100 Bump package version to 4.0.2-1 Change-Id: I58d47d1449622750d223b53254492720e2cae4fb diff --git a/configure.ac b/configure.ac index 111f54e92..5fa429d4d 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.63]) -AC_INIT([loolwsd], [4.0.1], [libreoffice@lists.freedesktop.org]) +AC_INIT([loolwsd], [4.0.2], [libreoffice@lists.freedesktop.org]) LT_INIT([shared, disable-static, dlopen]) AM_INIT_AUTOMAKE([1.10 subdir-objects tar-pax -Wno-portability]) diff --git a/debian/changelog b/debian/changelog index c0f0b04b4..0e04a583e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +loolwsd (4.0.2-1) unstable; urgency=medium + + * see the git log: http://col.la/coolcd4 + + -- Andras Timar <andras.ti...@collabora.com> Tue, 12 Mar 2019 22:30:00 +0100 + loolwsd (4.0.1-1) unstable; urgency=medium * see the git log: http://col.la/coolcd4 diff --git a/debian/control b/debian/control index 5d0adf17f..dea19d390 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.9.7 Package: loolwsd Section: web Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libcurl3-gnutls, libexpat1, libicu55, libjpeg-turbo8, libnss3, libpng12-0, libxml2, libxslt1.1, libsm6, libxinerama1, libxrender1, libgl1-mesa-glx, libcups2, libxcb-render0, libxcb-shm0, locales-all, adduser, expat, fontconfig, cpio, libcap2-bin, collaboraofficebasis6.0-calc (>= 6.0.10.25), collaboraofficebasis6.0-core (>= 6.0.10.25), collaboraofficebasis6.0-graphicfilter (>= 6.0.10.25), collaboraofficebasis6.0-images (>= 6.0.10.25), collaboraofficebasis6.0-impress (>= 6.0.10.25), collaboraofficebasis6.0-ooofonts (>= 6.0.10.25), collaboraofficebasis6.0-writer (>= 6.0.10.25), collaboraoffice6.0 (>= 6.0.10.25), collaboraoffice6.0-ure (>= 6.0.10.25), collaboraofficebasis6.0-en-us (>= 6.0.10.25), collaboraofficebasis6.0-draw (>= 6.0.10.25), collaboraofficebasis6.0-extension-pdf-import (>= 6.0.10.25), collaboraofficebasis6.0-ooolinguistic (>= 6.0.10.25) +Depends: ${shlibs:Depends}, ${misc:Depends}, libcurl3-gnutls, libexpat1, libicu55, libjpeg-turbo8, libnss3, libpng12-0, libxml2, libxslt1.1, libsm6, libxinerama1, libxrender1, libgl1-mesa-glx, libcups2, libxcb-render0, libxcb-shm0, locales-all, adduser, expat, fontconfig, cpio, libcap2-bin, collaboraofficebasis6.0-calc (>= 6.0.10.26), collaboraofficebasis6.0-core (>= 6.0.10.26), collaboraofficebasis6.0-graphicfilter (>= 6.0.10.26), collaboraofficebasis6.0-images (>= 6.0.10.26), collaboraofficebasis6.0-impress (>= 6.0.10.26), collaboraofficebasis6.0-ooofonts (>= 6.0.10.26), collaboraofficebasis6.0-writer (>= 6.0.10.26), collaboraoffice6.0 (>= 6.0.10.26), collaboraoffice6.0-ure (>= 6.0.10.26), collaboraofficebasis6.0-en-us (>= 6.0.10.26), collaboraofficebasis6.0-draw (>= 6.0.10.26), collaboraofficebasis6.0-extension-pdf-import (>= 6.0.10.26), collaboraofficebasis6.0-ooolinguistic (>= 6.0.10.26) Conflicts: collaboraofficebasis6.0-gnome-integration, collaboraofficebasis6.0-kde-integration Description: LibreOffice Online WebSocket Daemon LOOLWSD is a daemon that talks to web browser clients and provides LibreOffice diff --git a/loolwsd.spec.in b/loolwsd.spec.in index b55e25904..9e0a2af24 100644 --- a/loolwsd.spec.in +++ b/loolwsd.spec.in @@ -38,7 +38,7 @@ BuildRequires: libcap-progs linux-glibc-devel systemd-rpm-macros python-polib BuildRequires: libcap-progs %endif -Requires: collaboraoffice6.0 >= 6.0.10.25 collaboraoffice6.0-ure >= 6.0.10.25 collaboraofficebasis6.0-core >= 6.0.10.25 collaboraofficebasis6.0-writer >= 6.0.10.25 collaboraofficebasis6.0-impress >= 6.0.10.25 collaboraofficebasis6.0-graphicfilter >= 6.0.10.25 collaboraofficebasis6.0-en-US >= 6.0.10.25 collaboraofficebasis6.0-calc >= 6.0.10.25 collaboraofficebasis6.0-ooofonts >= 6.0.10.25 collaboraofficebasis6.0-images >= 6.0.10.25 collaboraofficebasis6.0-draw >= 6.0.10.25 collaboraofficebasis6.0-extension-pdf-import >= 6.0.10.25 collaboraofficebasis6.0-ooolinguistic >= 6.0.10.25 +Requires: collaboraoffice6.0 >= 6.0.10.26 collaboraoffice6.0-ure >= 6.0.10.26 collaboraofficebasis6.0-core >= 6.0.10.26 collaboraofficebasis6.0-writer >= 6.0.10.26 collaboraofficebasis6.0-impress >= 6.0.10.26 collaboraofficebasis6.0-graphicfilter >= 6.0.10.26 collaboraofficebasis6.0-en-US >= 6.0.10.26 collaboraofficebasis6.0-calc >= 6.0.10.26 collaboraofficebasis6.0-ooofonts >= 6.0.10.26 collaboraofficebasis6.0-images >= 6.0.10.26 collaboraofficebasis6.0-draw >= 6.0.10.26 collaboraofficebasis6.0-extension-pdf-import >= 6.0.10.26 collaboraofficebasis6.0-ooolinguistic >= 6.0.10.26 Conflicts: collaboraofficebasis6.0-kde-integration collaboraofficebasis6.0-gnome-integration Requires(post): coreutils grep sed %if 0%{?rhel} == 6 commit e2e1b32f1a2c252bb46bb35e4673d13d50181253 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Tue Mar 12 11:55:43 2019 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:28:01 2019 +0100 leaflet: do not disable the Close Document menu for read-only docs Change-Id: I6a52b0bd807ae68ea6bf59e103c004375afae50b Reviewed-on: https://gerrit.libreoffice.org/69110 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit dabeea7a74a9c9a5215735f7c88a31c8b49bd2ee) diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index ad5388b92..be6148a6c 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -425,7 +425,7 @@ L.Control.Menubar = L.Control.extend({ allowedViewModeActions: [ 'downloadas-pdf', 'downloadas-odt', 'downloadas-doc', 'downloadas-docx', 'downloadas-rtf', // file menu 'downloadas-odp', 'downloadas-ppt', 'downloadas-pptx', 'print', // file menu - 'downloadas-ods', 'downloadas-xls', 'downloadas-xlsx', // file menu + 'downloadas-ods', 'downloadas-xls', 'downloadas-xlsx', 'closedocument', // file menu 'fullscreen', 'zoomin', 'zoomout', 'zoomreset', // view menu 'about', 'keyboard-shortcuts' // help menu ] commit d7d03a6cff55bbd358e127f06592b7d7d197357c Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue Mar 12 17:04:50 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:27:54 2019 +0100 Send the UI_FileVersions only when the revision history is enabled. Change-Id: I03a1a27c6a09ff34a6ff828b4903785ae342abc8 Reviewed-on: https://gerrit.libreoffice.org/69112 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 3640adeae109119b4013035b2a1b27935693b0b5) diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index f97772ca8..ad5388b92 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -769,7 +769,7 @@ L.Control.Menubar = L.Control.extend({ this._map.showLOAboutDialog(); } else if (id === 'keyboard-shortcuts') { this._map.showLOKeyboardHelp(); - } else if (id === 'rev-history' || id === 'last-mod') { + } else if (revHistoryEnabled && (id === 'rev-history' || id === 'last-mod')) { // if we are being loaded inside an iframe, ask // our host to show revision history mode this._map.fire('postMessage', {msgId: 'rev-history', args: {Deprecated: true}}); commit f36a1d89fe494b06569c0f098415b5812efbb2f6 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Tue Mar 12 11:06:49 2019 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:27:38 2019 +0100 Move the Help URL to a new config path Change-Id: I76468d1c032689099b371449aedc0e5583f0ae2d Reviewed-on: https://gerrit.libreoffice.org/69107 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 0c9b621653c40bc83364c187523e647da4b88d8c) diff --git a/loolkitconfig.xcu b/loolkitconfig.xcu index 5aa26babc..392ed42b4 100644 --- a/loolkitconfig.xcu +++ b/loolkitconfig.xcu @@ -8,7 +8,7 @@ <item oor:path="/org.openoffice.Office.Common/Accessibility"><prop oor:name="ListBoxMaximumLineCount" oor:op="fuse"><value>11</value></prop></item> <!-- The Help root URL, or empty for no help (hides the help buttons) --> -<item oor:path="/org.openoffice.Office.Common/Accessibility"><prop oor:name="HelpURL" oor:op="fuse"><value></value></prop></item> +<item oor:path="/org.openoffice.Office.Common/Help"><prop oor:name="HelpRootURL" oor:op="fuse"><value></value></prop></item> <!-- Enable spell-checking by default --> <item oor:path="/org.openoffice.Office.Linguistic/SpellChecking"><prop oor:name="IsSpellAuto" oor:op="fuse"><value>true</value></prop></item> commit 450279196939ba35a0c13e2620004259a66f5e35 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Mon Mar 11 22:14:20 2019 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:26:47 2019 +0100 Add help URL to loolkitconfig.xcu When blank the help button is hidden from all dialogs. Change-Id: Ibd43411bed496bfd3bc81056ebc8657fb77fb8fe Reviewed-on: https://gerrit.libreoffice.org/69072 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit efacee21ffb42d61bfa117bbefaa21afb8f09406) diff --git a/loolkitconfig.xcu b/loolkitconfig.xcu index 8e00eabcc..5aa26babc 100644 --- a/loolkitconfig.xcu +++ b/loolkitconfig.xcu @@ -5,7 +5,10 @@ <item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="UseLocking" oor:op="fuse"><value>false</value></prop></item> <!-- Dialogs have limited real estate, limit drop-down height --> -<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="ListBoxMaximumLineCount" oor:op="fuse"><value>11</value></prop></item> +<item oor:path="/org.openoffice.Office.Common/Accessibility"><prop oor:name="ListBoxMaximumLineCount" oor:op="fuse"><value>11</value></prop></item> + +<!-- The Help root URL, or empty for no help (hides the help buttons) --> +<item oor:path="/org.openoffice.Office.Common/Accessibility"><prop oor:name="HelpURL" oor:op="fuse"><value></value></prop></item> <!-- Enable spell-checking by default --> <item oor:path="/org.openoffice.Office.Linguistic/SpellChecking"><prop oor:name="IsSpellAuto" oor:op="fuse"><value>true</value></prop></item> commit 9a879eb5b9b15d77534fcff9f944b660afe6ffc9 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Tue Mar 12 12:28:27 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:25:53 2019 +0100 dictionary is no longer a dependency Change-Id: If02a1e6a8add90905309764978d1cba42a3a698a (cherry picked from commit 94a9231d121478beb411d43bfb13014d6ee613f2) diff --git a/debian/control b/debian/control index cb3e03b15..5d0adf17f 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.9.7 Package: loolwsd Section: web Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libcurl3-gnutls, libexpat1, libicu55, libjpeg-turbo8, libnss3, libpng12-0, libxml2, libxslt1.1, libsm6, libxinerama1, libxrender1, libgl1-mesa-glx, libcups2, libxcb-render0, libxcb-shm0, locales-all, adduser, expat, fontconfig, cpio, libcap2-bin, collaboraofficebasis6.0-calc (>= 6.0.10.25), collaboraofficebasis6.0-core (>= 6.0.10.25), collaboraofficebasis6.0-graphicfilter (>= 6.0.10.25), collaboraofficebasis6.0-images (>= 6.0.10.25), collaboraofficebasis6.0-impress (>= 6.0.10.25), collaboraofficebasis6.0-ooofonts (>= 6.0.10.25), collaboraofficebasis6.0-writer (>= 6.0.10.25), collaboraoffice6.0 (>= 6.0.10.25), collaboraoffice6.0-ure (>= 6.0.10.25), collaboraofficebasis6.0-en-us (>= 6.0.10.25), collaboraofficebasis6.0-draw (>= 6.0.10.25), collaboraofficebasis6.0-extension-pdf-import (>= 6.0.10.25), collaboraofficebasis6.0-ooolinguistic (>= 6.0.10.25), collaboraoffice6.0-dict-en (>= 6.0.10.25) +Depends: ${shlibs:Depends}, ${misc:Depends}, libcurl3-gnutls, libexpat1, libicu55, libjpeg-turbo8, libnss3, libpng12-0, libxml2, libxslt1.1, libsm6, libxinerama1, libxrender1, libgl1-mesa-glx, libcups2, libxcb-render0, libxcb-shm0, locales-all, adduser, expat, fontconfig, cpio, libcap2-bin, collaboraofficebasis6.0-calc (>= 6.0.10.25), collaboraofficebasis6.0-core (>= 6.0.10.25), collaboraofficebasis6.0-graphicfilter (>= 6.0.10.25), collaboraofficebasis6.0-images (>= 6.0.10.25), collaboraofficebasis6.0-impress (>= 6.0.10.25), collaboraofficebasis6.0-ooofonts (>= 6.0.10.25), collaboraofficebasis6.0-writer (>= 6.0.10.25), collaboraoffice6.0 (>= 6.0.10.25), collaboraoffice6.0-ure (>= 6.0.10.25), collaboraofficebasis6.0-en-us (>= 6.0.10.25), collaboraofficebasis6.0-draw (>= 6.0.10.25), collaboraofficebasis6.0-extension-pdf-import (>= 6.0.10.25), collaboraofficebasis6.0-ooolinguistic (>= 6.0.10.25) Conflicts: collaboraofficebasis6.0-gnome-integration, collaboraofficebasis6.0-kde-integration Description: LibreOffice Online WebSocket Daemon LOOLWSD is a daemon that talks to web browser clients and provides LibreOffice diff --git a/loolwsd.spec.in b/loolwsd.spec.in index 89c193c53..b55e25904 100644 --- a/loolwsd.spec.in +++ b/loolwsd.spec.in @@ -38,7 +38,7 @@ BuildRequires: libcap-progs linux-glibc-devel systemd-rpm-macros python-polib BuildRequires: libcap-progs %endif -Requires: collaboraoffice6.0 >= 6.0.10.25 collaboraoffice6.0-ure >= 6.0.10.25 collaboraofficebasis6.0-core >= 6.0.10.25 collaboraofficebasis6.0-writer >= 6.0.10.25 collaboraofficebasis6.0-impress >= 6.0.10.25 collaboraofficebasis6.0-graphicfilter >= 6.0.10.25 collaboraofficebasis6.0-en-US >= 6.0.10.25 collaboraofficebasis6.0-calc >= 6.0.10.25 collaboraofficebasis6.0-ooofonts >= 6.0.10.25 collaboraofficebasis6.0-images >= 6.0.10.25 collaboraofficebasis6.0-draw >= 6.0.10.25 collaboraofficebasis6.0-extension-pdf-import >= 6.0.10.25 collaboraofficebasis6.0-ooolinguistic >= 6.0.10.25 collaboraoffice6.0-dict-en >= 6.0.10.25 +Requires: collaboraoffice6.0 >= 6.0.10.25 collaboraoffice6.0-ure >= 6.0.10.25 collaboraofficebasis6.0-core >= 6.0.10.25 collaboraofficebasis6.0-writer >= 6.0.10.25 collaboraofficebasis6.0-impress >= 6.0.10.25 collaboraofficebasis6.0-graphicfilter >= 6.0.10.25 collaboraofficebasis6.0-en-US >= 6.0.10.25 collaboraofficebasis6.0-calc >= 6.0.10.25 collaboraofficebasis6.0-ooofonts >= 6.0.10.25 collaboraofficebasis6.0-images >= 6.0.10.25 collaboraofficebasis6.0-draw >= 6.0.10.25 collaboraofficebasis6.0-extension-pdf-import >= 6.0.10.25 collaboraofficebasis6.0-ooolinguistic >= 6.0.10.25 Conflicts: collaboraofficebasis6.0-kde-integration collaboraofficebasis6.0-gnome-integration Requires(post): coreutils grep sed %if 0%{?rhel} == 6 commit 60c28ffefd8f679fb3606f2fae22c713e90163e3 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Mar 12 11:49:21 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:25:01 2019 +0100 Show normal statusbar in narrow window (cherry picked from commit 6bcc2898f01c97f52605fd79967a87b909bd8a26) diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index b6c13c35e..348e0063f 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -1154,7 +1154,7 @@ function initNormalToolbar(toolItems) { }); toolbar = $('#toolbar-down'); - if ($('#main-menu').css('display') !== 'none') { + if (!window.mode.isMobile()) { toolbar.w2toolbar({ name: 'actionbar', tooltip: 'top', commit 29481fd0c22fcae61fb443c45f1b1d4b66a3ab79 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Mar 12 10:24:13 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:55 2019 +0100 Send init commands after mobile is switched to edit mode (cherry picked from commit cee52939e56d1899560bee02fb8eca04aa7246b7) diff --git a/loleaflet/src/control/Permission.js b/loleaflet/src/control/Permission.js index 76c1ff7b2..37ad81a05 100644 --- a/loleaflet/src/control/Permission.js +++ b/loleaflet/src/control/Permission.js @@ -36,6 +36,9 @@ L.Map.include({ }, _enterEditMode: function (perm) { + if (this._permission == 'readonly' && L.Browser.mobile) { + this.sendInitUNOCommands(); + } this._permission = perm; this._socket.sendMessage('requestloksession'); commit dabfd86099f10131e4aadbbf0d6325b3cffb3032 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Mar 11 20:00:31 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:50 2019 +0100 Show user colors when no avatar is available (cherry picked from commit abde785af0e56ed22cb6019024a616a704c6b501) diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css index a6aefc2b2..b79b56a53 100644 --- a/loleaflet/css/loleaflet.css +++ b/loleaflet/css/loleaflet.css @@ -307,6 +307,14 @@ body { border-radius: 50%; } +.user-info { + border-radius: 50%; + width: 24px; + height: 24px; + overflow: auto; + margin: auto; +} + .loleaflet-annotation-author { padding-left: 10px; padding-right: 10px; diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css index 33f9c3a99..2ef829052 100644 --- a/loleaflet/css/toolbar.css +++ b/loleaflet/css/toolbar.css @@ -714,27 +714,11 @@ tr.useritem > td { tr.useritem > td.usercolor { display: inline-block; - top: 5px; + top: 0px; left: 3px; position: relative; } -tr.useritem-avatar:hover { - cursor: default; - background-color: rgba(67, 172, 232, 0.25); -} - -tr.useritem-avatar > td { - padding: 7px; -} - -tr.useritem-avatar > td > img { +tr.useritem > td > img { border-radius: 100px; } - -tr.useritem-avatar > td.usercolor { - display: inline-block; - top: 0px; - left: 3px; - position: relative; -} diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 23c26faf8..b6c13c35e 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -2322,15 +2322,12 @@ function deselectUser(e) { } function getUserItem(viewId, userName, extraInfo, color) { - var className = 'useritem'; - if (extraInfo !== undefined && extraInfo.avatar !== undefined) { - className = 'useritem-avatar'; - } - - var html = '<tr class="' + className + '" id="user-' + viewId + '" onclick="onUseritemClicked(event)">' + + var html = '<tr class="useritem" id="user-' + viewId + '" onclick="onUseritemClicked(event)">' + '<td class=usercolor>'; if (extraInfo !== undefined && extraInfo.avatar !== undefined) { html += '<img class="avatar-img" src="' + extraInfo.avatar + '" style="border-color: ' + color + ';" />'; + } else { + html += '<div class="user-info" style="background-color: ' + color + ';" />'; } // TODO: Add mail and other links as sub-menu. commit 979e76afde8dd3214803a342589c6b5f731badc3 Author: Szymon Kłos <eszka...@gmail.com> AuthorDate: Mon Mar 11 15:57:24 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:45 2019 +0100 Always show cursor header (cherry picked from commit 6c3db87af104fda1c985d807cba1f660fa7d862f) diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 6932cc4f2..643a9ba06 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -1710,6 +1710,8 @@ L.TileLayer = L.GridLayer.extend({ else if (viewCursorMarker) { this._viewLayerGroup.removeLayer(viewCursorMarker); } + + this._viewCursors[viewId].marker.showCursorHeader(); }, updateAllViewCursors : function() { commit bd3c25c177b8109ef8755d26204921b3d6bd6cc6 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Mar 1 22:25:44 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:41 2019 +0100 tdf#123482 - cleanup convert-to folder more reliably. Change-Id: I029bb4136984e05485e462c92da80b92b00fdebc Reviewed-on: https://gerrit.libreoffice.org/68601 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 0f2e3641fcd27e7f6bbbdc13eb24462568eacec6) diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 3c53fdb53..f3afc4efc 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -867,11 +867,6 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt // Now terminate. docBroker->stop("Finished saveas handler."); - - // Remove file and directory - Poco::Path path = docBroker->getDocKey(); - Poco::File(path).remove(); - Poco::File(path.makeParent()).remove(); } return true; diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index aba041044..d9b205801 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -37,6 +37,7 @@ #include <common/Message.hpp> #include <common/Protocol.hpp> #include <common/Unit.hpp> +#include <common/FileUtil.hpp> #include <sys/types.h> #include <sys/wait.h> @@ -1887,6 +1888,18 @@ void DocumentBroker::getIOStats(uint64_t &sent, uint64_t &recv) } } +ConvertToBroker::~ConvertToBroker() +{ + if (!_uriOrig.empty()) + { + // Remove source file and directory + Poco::Path path = _uriOrig; + Poco::File(path).remove(); + Poco::File(path.makeParent()).remove(); + FileUtil::removeFile(_uriOrig); + } +} + void DocumentBroker::dumpState(std::ostream& os) { std::unique_lock<std::mutex> lock(_mutex); diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index a27442014..6d5a3e63b 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -223,7 +223,7 @@ public: const Poco::URI& uriPublic, const std::string& docKey); - ~DocumentBroker(); + virtual ~DocumentBroker(); /// Start processing events void startThread(); @@ -402,8 +402,9 @@ private: /// Sum the I/O stats from all connected sessions void getIOStats(uint64_t &sent, uint64_t &recv); -private: +protected: const std::string _uriOrig; +private: const Poco::URI _uriPublic; /// URL-based key. May be repeated during the lifetime of WSD. const std::string _docKey; @@ -472,6 +473,19 @@ private: static std::atomic<unsigned> DocBrokerId; }; +class ConvertToBroker : public DocumentBroker +{ +public: + /// Construct DocumentBroker with URI and docKey + ConvertToBroker(const std::string& uri, + const Poco::URI& uriPublic, + const std::string& docKey) + : DocumentBroker(uri, uriPublic, docKey) + { + } + virtual ~ConvertToBroker(); +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index a0c9e31c2..9227f6f3f 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -593,6 +593,7 @@ public: if (!params.has("filename")) return; + // FIXME: needs wrapping - until then - keep in sync with ~ConvertToBroker Path tempPath = _convertTo? Path::forDirectory(Poco::TemporaryFile::tempName("/tmp/convert-to") + "/") : Path::forDirectory(Poco::TemporaryFile::tempName() + "/"); File(tempPath).createDirectories(); @@ -2369,7 +2370,7 @@ private: std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex); LOG_DBG("New DocumentBroker for docKey [" << docKey << "]."); - auto docBroker = std::make_shared<DocumentBroker>(fromPath, uriPublic, docKey); + auto docBroker = std::make_shared<ConvertToBroker>(fromPath, uriPublic, docKey); cleanupDocBrokers(); commit 99fbd8fe21c14d345b7cecb133b3043f27296482 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Mar 1 22:03:35 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:37 2019 +0100 Simpify DocumentBroker constructor. Change-Id: I0bf29df9316b129d34862c7464bb6636d42a850d Reviewed-on: https://gerrit.libreoffice.org/68600 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit b79002b3ce57d9016cd6704fd70d5487e51297c0) diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index b0052142e..aba041044 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -160,13 +160,11 @@ std::atomic<unsigned> DocumentBroker::DocBrokerId(1); DocumentBroker::DocumentBroker(const std::string& uri, const Poco::URI& uriPublic, - const std::string& docKey, - const std::string& childRoot) : + const std::string& docKey) : _uriOrig(uri), _uriPublic(uriPublic), _docKey(docKey), _docId(Util::encodeId(DocBrokerId++, 3)), - _childRoot(childRoot), _cacheRoot(getCachePath(uriPublic.toString())), _documentChangedInStorage(false), _lastSaveTime(std::chrono::steady_clock::now()), @@ -186,10 +184,10 @@ DocumentBroker::DocumentBroker(const std::string& uri, _debugRenderedTileCount(0) { assert(!_docKey.empty()); - assert(!_childRoot.empty()); + assert(!LOOLWSD::ChildRoot.empty()); LOG_INF("DocumentBroker [" << LOOLWSD::anonymizeUrl(_uriPublic.toString()) << - "] created with docKey [" << _docKey << "] and root [" << _childRoot << "]"); + "] created with docKey [" << _docKey << "]"); } void DocumentBroker::startThread() @@ -1077,7 +1075,7 @@ bool DocumentBroker::sendUnoSave(const std::string& sessionId, bool dontTerminat std::string DocumentBroker::getJailRoot() const { assert(!_jailId.empty()); - return Poco::Path(_childRoot, _jailId).toString(); + return Poco::Path(LOOLWSD::ChildRoot, _jailId).toString(); } size_t DocumentBroker::addSession(const std::shared_ptr<ClientSession>& session) diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index 3d47c722d..a27442014 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -221,8 +221,7 @@ public: /// Construct DocumentBroker with URI, docKey, and root path. DocumentBroker(const std::string& uri, const Poco::URI& uriPublic, - const std::string& docKey, - const std::string& childRoot); + const std::string& docKey); ~DocumentBroker(); diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index ff81f6719..a0c9e31c2 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -1707,7 +1707,7 @@ static std::shared_ptr<DocumentBroker> findOrCreateDocBroker(WebSocketHandler& w // Set the one we just created. LOG_DBG("New DocumentBroker for docKey [" << docKey << "]."); - docBroker = std::make_shared<DocumentBroker>(uri, uriPublic, docKey, LOOLWSD::ChildRoot); + docBroker = std::make_shared<DocumentBroker>(uri, uriPublic, docKey); DocBrokers.emplace(docKey, docBroker); LOG_TRC("Have " << DocBrokers.size() << " DocBrokers after inserting [" << docKey << "]."); } @@ -2369,7 +2369,7 @@ private: std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex); LOG_DBG("New DocumentBroker for docKey [" << docKey << "]."); - auto docBroker = std::make_shared<DocumentBroker>(fromPath, uriPublic, docKey, LOOLWSD::ChildRoot); + auto docBroker = std::make_shared<DocumentBroker>(fromPath, uriPublic, docKey); cleanupDocBrokers(); commit ecd88059c8fca74afd85e4fca57c54f88128c969 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Mar 1 18:59:40 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:34 2019 +0100 Avoid using un-necessary reference. Change-Id: Id5a9fed8fb790f2af8facac119e9e0da476b1e47 Reviewed-on: https://gerrit.libreoffice.org/68599 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 8878989794b4aa064810f48c565f050896c9ae9c) diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index f43aca9c5..ff81f6719 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -558,18 +558,24 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks( #ifndef MOBILEAPP -/// Handles the filename part of the convert-to POST request payload. +/// Handles the filename part of the convert-to POST request payload, +/// Also owns the file - cleaning it up when destroyed. class ConvertToPartHandler : public PartHandler { - std::string& _filename; + std::string _filename; /// Is it really a convert-to, ie. use an especially formed path? bool _convertTo; public: - ConvertToPartHandler(std::string& filename, bool convertTo = false) - : _filename(filename) - , _convertTo(convertTo) + std::string getFilename() const { return _filename; } + + ConvertToPartHandler(bool convertTo = false) + : _convertTo(convertTo) + { + } + + virtual ~ConvertToPartHandler() { } @@ -2327,8 +2333,7 @@ private: StringTokenizer tokens(request.getURI(), "/?"); if (tokens.count() > 2 && tokens[2] == "convert-to") { - std::string fromPath; - ConvertToPartHandler handler(fromPath, /*convertTo =*/ true); + ConvertToPartHandler handler(/*convertTo =*/ true); HTMLForm form(request, message, handler); std::string format = (form.has("format") ? form.get("format") : ""); @@ -2352,6 +2357,7 @@ private: format = tokens[3]; bool sent = false; + std::string fromPath = handler.getFilename(); LOG_INF("Conversion request for URI [" << fromPath << "] format [" << format << "]."); if (!fromPath.empty() && !format.empty()) { @@ -2437,8 +2443,7 @@ private: { LOG_INF("Insert file request."); - std::string tmpPath; - ConvertToPartHandler handler(tmpPath); + ConvertToPartHandler handler; HTMLForm form(request, message, handler); if (form.has("childid") && form.has("name")) @@ -2468,7 +2473,7 @@ private: + JAILED_DOCUMENT_ROOT + "insertfile"; File(dirPath).createDirectories(); std::string fileName = dirPath + "/" + form.get("name"); - File(tmpPath).moveTo(fileName); + File(handler.getFilename()).moveTo(fileName); response.setContentLength(0); socket->send(response); return; commit 255d91061891cb4b49b1497d0a0f90e9962083e5 Author: merttumer <mert.tu...@collabora.com> AuthorDate: Fri Mar 1 18:11:59 2019 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:30 2019 +0100 Ability to switch slides by arrow up/down keys in edit mode Change-Id: Ic465636df8a1960364074149a41ea7d0209dbdab Signed-off-by: merttumer <mert.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/68585 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> (cherry picked from commit f3ea0a6ffe03425c557297c53768cb927727b4af) diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js index d5a7a65bf..eae8149d3 100644 --- a/loleaflet/src/control/Control.PartsPreview.js +++ b/loleaflet/src/control/Control.PartsPreview.js @@ -8,6 +8,7 @@ L.Control.PartsPreview = L.Control.extend({ options: { autoUpdate: true }, + partsFocused: false, onAdd: function (map) { this._previewInitialized = false; @@ -60,6 +61,24 @@ L.Control.PartsPreview = L.Control.extend({ } } }); + + this._map.on('click', function() { + this.partsFocused = false; + }, this); + + this._map.on('keydown', function(e) { + if (this.partsFocused === true) { + switch (e.originalEvent.keyCode) { + case 38: + this._setPart('prev'); + break; + case 40: + this._setPart('next'); + break; + } + } + }, this); + this._scrollContainer = $('#slide-sorter .mCSB_container').get(0); // Create the preview parts @@ -97,7 +116,10 @@ L.Control.PartsPreview = L.Control.extend({ .on(img, 'click', L.DomEvent.stopPropagation) .on(img, 'click', L.DomEvent.stop) .on(img, 'click', this._setPart, this) - .on(img, 'click', this._map.focus, this._map); + .on(img, 'click', this._map.focus, this._map) + .on(img, 'click', function() { + this.partsFocused = true; + }, this); var topBound = this._previewContTop; var previewFrameTop = 0; @@ -137,6 +159,33 @@ L.Control.PartsPreview = L.Control.extend({ }, _setPart: function (e) { + //helper function to check if the view is in the scrollview visible area + function isVisible(el) { + var elemRect = el.getBoundingClientRect(); + var elemTop = elemRect.top; + var elemBottom = elemRect.bottom; + var isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight); + return isVisible; + } + if (e === 'prev' || e === 'next') { + this._map.setPart(e); + var node = $('#slide-sorter .mCSB_container .preview-frame')[this._map.getCurrentPartNumber()]; + if (!isVisible(node)) { + if (e === 'prev') { + setTimeout(function () { + $('#slide-sorter').mCustomScrollbar('scrollTo', node); + }, 50); + } else { + var nodeHeight = $(node).height(); + var sliderHeight= $('#slide-sorter').height(); + var nodePos = $(node).position().top; + setTimeout(function () { + $('#slide-sorter').mCustomScrollbar('scrollTo', nodePos-(sliderHeight-nodeHeight-nodeHeight/2)); + }, 50); + } + } + return; + } var part = $('#slide-sorter .mCSB_container .preview-frame').index(e.target.parentNode); if (part !== null) { this._map.setPart(parseInt(part)); commit df9226dfcdcc22830c45be5ff089b7cb861cb4b0 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Thu Mar 7 13:26:22 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:25 2019 +0100 tdf#123874: Don't do the SVG preview thing in the iOS app as it crashes WebKit Sure, this is just a stopgap solution, it would be good to figure out a way to have the functionality working. (cherry picked from commit 3645a9ce314f5bfafa78f2182084aa43e5e4f34e) diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index b4ab51f21..6932cc4f2 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -657,7 +657,12 @@ L.TileLayer = L.GridLayer.extend({ this._twipsToLatLng(topLeftTwips, this._map.getZoom()), this._twipsToLatLng(bottomRightTwips, this._map.getZoom())); this._graphicSelectionAngle = (strTwips.length === 5) ? parseInt(strTwips[4]) : 0; - this._map._socket.sendMessage('rendershapeselection mimetype=image/svg+xml'); + // Workaround for tdf#123874. For some reason the handling of the + // shapeselectioncontent messages that we get back causes the WebKit process + // to crash on iOS. + if (!window.ThisIsTheiOSApp) { + this._map._socket.sendMessage('rendershapeselection mimetype=image/svg+xml'); + } } this._onUpdateGraphicSelection(); commit ad9bf6a7c2dc57ae7ba58cf4fa38e3d8f9c67ff8 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Fri Mar 1 10:32:01 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:17 2019 +0100 Add sal/rtl/bootstrap.cxx for breakpointing convenience Change-Id: I915b714aec4212cff563832772111b804af2bbd3 (cherry picked from commit 8cb54ad2b1a863398147ce9d64b9b0fc29f99de0) diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj index d722c5282..eada2b66d 100644 --- a/ios/Mobile.xcodeproj/project.pbxproj +++ b/ios/Mobile.xcodeproj/project.pbxproj @@ -304,6 +304,7 @@ BE34D1FF219076CF00815297 /* formatsh.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = formatsh.cxx; path = "../../ios-device/sc/source/ui/view/formatsh.cxx"; sourceTree = "<group>"; }; BE34D200219076CF00815297 /* dbfunc3.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dbfunc3.cxx; path = "../../ios-device/sc/source/ui/view/dbfunc3.cxx"; sourceTree = "<group>"; }; BE43FD39222693F200376855 /* zcodec.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = zcodec.cxx; path = "../../ios-device/tools/source/zcodec/zcodec.cxx"; sourceTree = "<group>"; }; + BE43FD4222286B0700376855 /* bootstrap.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = bootstrap.cxx; path = "../../ios-device/sal/rtl/bootstrap.cxx"; sourceTree = "<group>"; }; BE58E129217F295B00249358 /* Log.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Log.hpp; sourceTree = "<group>"; }; BE58E12A217F295B00249358 /* Png.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Png.hpp; sourceTree = "<group>"; }; BE58E12B217F295B00249358 /* SigUtil.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SigUtil.hpp; sourceTree = "<group>"; }; @@ -949,6 +950,14 @@ name = zcodec; sourceTree = "<group>"; }; + BE43FD4122286AEC00376855 /* rtl */ = { + isa = PBXGroup; + children = ( + BE43FD4222286B0700376855 /* bootstrap.cxx */, + ); + name = rtl; + sourceTree = "<group>"; + }; BE58E1312187938700249358 /* headless */ = { isa = PBXGroup; children = ( @@ -1352,6 +1361,7 @@ BEB6521A216F5D4600B8C09A /* sal */ = { isa = PBXGroup; children = ( + BE43FD4122286AEC00376855 /* rtl */, BEB6521B216F5D4C00B8C09A /* unx */, ); name = sal; commit bea9be4c787eeca487b66ff12bcac12eeed29fa5 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Wed Feb 27 20:34:07 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:14 2019 +0100 Add zcodec.cxx from tools Change-Id: I6666f08b0bddab02277595190a7127d6f0c3f6f0 (cherry picked from commit 4405ea399d3156cdcfdce051259f92bc6428332b) diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj index 001a71bbd..d722c5282 100644 --- a/ios/Mobile.xcodeproj/project.pbxproj +++ b/ios/Mobile.xcodeproj/project.pbxproj @@ -303,6 +303,7 @@ BE34D1FE219076CF00815297 /* output2.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = output2.cxx; path = "../../ios-device/sc/source/ui/view/output2.cxx"; sourceTree = "<group>"; }; BE34D1FF219076CF00815297 /* formatsh.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = formatsh.cxx; path = "../../ios-device/sc/source/ui/view/formatsh.cxx"; sourceTree = "<group>"; }; BE34D200219076CF00815297 /* dbfunc3.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dbfunc3.cxx; path = "../../ios-device/sc/source/ui/view/dbfunc3.cxx"; sourceTree = "<group>"; }; + BE43FD39222693F200376855 /* zcodec.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = zcodec.cxx; path = "../../ios-device/tools/source/zcodec/zcodec.cxx"; sourceTree = "<group>"; }; BE58E129217F295B00249358 /* Log.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Log.hpp; sourceTree = "<group>"; }; BE58E12A217F295B00249358 /* Png.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Png.hpp; sourceTree = "<group>"; }; BE58E12B217F295B00249358 /* SigUtil.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SigUtil.hpp; sourceTree = "<group>"; }; @@ -940,6 +941,14 @@ name = view; sourceTree = "<group>"; }; + BE43FD38222693CC00376855 /* zcodec */ = { + isa = PBXGroup; + children = ( + BE43FD39222693F200376855 /* zcodec.cxx */, + ); + name = zcodec; + sourceTree = "<group>"; + }; BE58E1312187938700249358 /* headless */ = { isa = PBXGroup; children = ( @@ -1406,6 +1415,7 @@ isa = PBXGroup; children = ( BEB6524C216FD0AA00B8C09A /* stream */, + BE43FD38222693CC00376855 /* zcodec */, ); name = tools; sourceTree = "<group>"; commit 78eae0dc5b55c23f2383e8cccbfb6f27a3706d56 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Feb 26 17:52:58 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:10 2019 +0100 Remove superfluous empty line at end of file Change-Id: Ibdb25392622a12cedc1923c2d88ffe6b6e4f798c (cherry picked from commit a98c00149360b746ca3d93f3d9f7ced10307a72b) diff --git a/ios/Mobile/DocumentViewController.mm b/ios/Mobile/DocumentViewController.mm index b6c128b56..9a4503b41 100644 --- a/ios/Mobile/DocumentViewController.mm +++ b/ios/Mobile/DocumentViewController.mm @@ -335,4 +335,3 @@ @end // vim:set shiftwidth=4 softtabstop=4 expandtab: - commit f2907512c7bac41d648a9d56a2470ec54739a5de Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Feb 26 17:44:00 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:05 2019 +0100 tdf#122584: Implement printing in the iOS app I don't have an AirPrint printer so I couldn't verify that it actually prints, but the system print dialog is displayed and shows a preview correctly, so I am fairly sure it works. Change-Id: I5e8a704386cd5053b8689dc63f26e545df323193 (cherry picked from commit f1508239b3f71e36e53aa305be5dfa7498dfec45) diff --git a/ios/Mobile/DocumentViewController.mm b/ios/Mobile/DocumentViewController.mm index fa3d77648..b6c128b56 100644 --- a/ios/Mobile/DocumentViewController.mm +++ b/ios/Mobile/DocumentViewController.mm @@ -294,6 +294,32 @@ self.webView.hidden = false; return; + } else if ([message.body isEqualToString:@"PRINT"]) { + + // Create the PDF to print. + + std::string printFile = Util::createRandomTmpDir() + "/print.pdf"; + NSURL *printURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:printFile.c_str()] isDirectory:NO]; + lok_document->saveAs([[printURL absoluteString] UTF8String], "pdf", nullptr); + + UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; + UIPrintInfo *printInfo = [UIPrintInfo printInfo]; + printInfo.outputType = UIPrintInfoOutputGeneral; + printInfo.orientation = UIPrintInfoOrientationPortrait; // FIXME Check the document? + printInfo.jobName = @"Document"; // FIXME + + pic.printInfo = printInfo; + pic.printingItem = printURL; + + [pic presentFromRect:CGRectZero + inView:self.webView + animated:YES + completionHandler:^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { + LOG_TRC("print completion handler gets " << (completed?"YES":"NO")); + std::remove(printFile.c_str()); + }]; + + return; } const char *buf = [message.body UTF8String]; @@ -309,3 +335,4 @@ @end // vim:set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js index 7e871a0db..8f3820431 100644 --- a/loleaflet/src/control/Toolbar.js +++ b/loleaflet/src/control/Toolbar.js @@ -81,8 +81,12 @@ L.Map.include({ }, print: function () { - this.showBusy(_('Downloading...'), false); - this.downloadAs('print.pdf', 'pdf', null, 'print'); + if (window.ThisIsTheiOSApp) { + window.webkit.messageHandlers.lool.postMessage('PRINT', '*'); + } else { + this.showBusy(_('Downloading...'), false); + this.downloadAs('print.pdf', 'pdf', null, 'print'); + } }, saveAs: function (url, format, options) { commit 39e790e0c0cbff5cdc6111cd9f66f0bfbcf90bc4 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Feb 26 14:02:26 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:24:01 2019 +0100 Fix crash in iOS app: Just use a raw pointer as the lok_document hack The lok_document pointer will only be used when it is valid anyway. Fixes a crash when you open a second document after closing the first. Change-Id: I362db282e4eccf419b56bf790ea58181594ab0fe (cherry picked from commit cff49659b0971cd2541eb2bee277bda388a2be43) diff --git a/ios/ios.h b/ios/ios.h index 0be3d6343..8bf7e147d 100644 --- a/ios/ios.h +++ b/ios/ios.h @@ -7,14 +7,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <memory> - #include <LibreOfficeKit/LibreOfficeKit.hxx> extern const char *lo_ios_app_getCacheDir(); extern int loolwsd_server_socket_fd; -extern std::shared_ptr<lok::Document> lok_document; +extern lok::Document *lok_document; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ios/ios.mm b/ios/ios.mm index 9d9e87e7a..c49e30fc5 100644 --- a/ios/ios.mm +++ b/ios/ios.mm @@ -18,7 +18,7 @@ extern "C" { } int loolwsd_server_socket_fd = -1; -std::shared_ptr<lok::Document> lok_document; +lok::Document *lok_document; const char* lo_ios_app_getCacheDir() { diff --git a/kit/Kit.cpp b/kit/Kit.cpp index a41283ed2..228af098e 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1678,7 +1678,7 @@ private: #ifdef IOS // The iOS app (and the Android one) has max one document open at a time, so we can keep // a pointer to it in a global. - lok_document = _loKitDocument; + lok_document = _loKitDocument.get(); #endif if (!_loKitDocument || !_loKitDocument->get()) { commit 55ec6b22803129310e07bd9cf7a60bc4411471eb Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Mon Feb 25 14:09:11 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:57 2019 +0100 Add BUNDLE-VERSION Change-Id: I1b518f9e4fbd7663c91d2109163c6c80a720a7ff (cherry picked from commit 111278ab6b614c7906a9b2490aa53cf231820480) diff --git a/.gitignore b/.gitignore index 4b2ac0ade..14c2e5c00 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,6 @@ pocoinclude-symlink pocolib-symlink ICU.dat ios/Mobile/Assets.xcassets/AppIcon.appiconset + +# iOS app build number +BUNDLE-VERSION commit 624a03143c44ef8919950d9b92be914edc2985a9 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Mon Feb 25 09:07:44 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:53 2019 +0100 Bin some boilerplate comments Change-Id: Ida0a8279f081d5b9c5d963d7d721e4c7c01f3a9e Reviewed-on: https://gerrit.libreoffice.org/68337 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 6c7f200f61c90e9692cf19f9d9f06e2340fffa0c) diff --git a/ios/Mobile/AppDelegate.mm b/ios/Mobile/AppDelegate.mm index 787a8a140..001f0f5c7 100644 --- a/ios/Mobile/AppDelegate.mm +++ b/ios/Mobile/AppDelegate.mm @@ -212,25 +212,18 @@ static void updateTemplates(NSData *data, NSURLResponse *response) } - (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - (BOOL)application:(UIApplication *)app openURL:(NSURL *)inputURL options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options { @@ -243,7 +236,6 @@ static void updateTemplates(NSData *data, NSURLResponse *response) DocumentBrowserViewController *documentBrowserViewController = (DocumentBrowserViewController *)self.window.rootViewController; [documentBrowserViewController revealDocumentAtURL:inputURL importIfNeeded:YES completion:^(NSURL * _Nullable revealedDocumentURL, NSError * _Nullable error) { if (error) { - // Handle the error appropriately LOG_ERR("Failed to reveal the document at URL " << [[inputURL description] UTF8String] << " with error: " << [[error description] UTF8String]); return; } @@ -254,8 +246,6 @@ static void updateTemplates(NSData *data, NSURLResponse *response) return YES; } -// NSURLSessionDataDelegate methods - @end // vim:set shiftwidth=4 softtabstop=4 expandtab: commit e201916a32bba921eae543901df62c0ba1aafeb0 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Fri Feb 22 20:50:07 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:50 2019 +0100 tdf#122582: Add slideshow functionality Requires a couple of corresponding commits in core to its filter subdirectory. Change-Id: I3e6353752dd93e021fb6058fff5096f1d648d17e Reviewed-on: https://gerrit.libreoffice.org/68336 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 8d1e926919bb6d38d933c6a685e2ea7ca80cd9af) diff --git a/ios/Mobile/DocumentViewController.h b/ios/Mobile/DocumentViewController.h index 61e317176..8f4d97b43 100644 --- a/ios/Mobile/DocumentViewController.h +++ b/ios/Mobile/DocumentViewController.h @@ -15,6 +15,9 @@ @property (strong) Document *document; @property (strong) WKWebView *webView; +@property (strong) WKWebView *slideshowWebView; +@property std::string slideshowFile; +@property (strong) NSURL *slideshowURL; @end diff --git a/ios/Mobile/DocumentViewController.mm b/ios/Mobile/DocumentViewController.mm index 2c07e2448..fa3d77648 100644 --- a/ios/Mobile/DocumentViewController.mm +++ b/ios/Mobile/DocumentViewController.mm @@ -8,6 +8,7 @@ #import "config.h" +#import <cstdio> #import <string> #import <vector> @@ -238,6 +239,61 @@ [self dismissDocumentViewController]; return; + } else if ([message.body isEqualToString:@"SLIDESHOW"]) { + + // Create the SVG for the slideshow. + + self.slideshowFile = Util::createRandomTmpDir() + "/slideshow.svg"; + self.slideshowURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:self.slideshowFile.c_str()] isDirectory:NO]; + + lok_document->saveAs([[self.slideshowURL absoluteString] UTF8String], "svg", nullptr); + + // Add a new full-screen WebView displaying the slideshow. + + WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; + WKUserContentController *userContentController = [[WKUserContentController alloc] init]; + + [userContentController addScriptMessageHandler:self name:@"lool"]; + + configuration.userContentController = userContentController; + + self.slideshowWebView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration]; + + [self.slideshowWebView becomeFirstResponder]; + + self.slideshowWebView.contentMode = UIViewContentModeScaleAspectFit; + self.slideshowWebView.translatesAutoresizingMaskIntoConstraints = NO; + self.slideshowWebView.navigationDelegate = self; + self.slideshowWebView.UIDelegate = self; + + self.webView.hidden = true; + + [self.view addSubview:self.slideshowWebView]; + [self.view bringSubviewToFront:self.slideshowWebView]; + + + WKWebView *slideshowWebViewP = self.slideshowWebView; + NSDictionary *views = NSDictionaryOfVariableBindings(slideshowWebViewP); + [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[slideshowWebViewP(>=0)]-0-|" + options:0 + metrics:nil + views:views]]; + [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[slideshowWebViewP(>=0)]-0-|" + options:0 + metrics:nil + views:views]]; + [self.slideshowWebView loadRequest:[NSURLRequest requestWithURL:self.slideshowURL]]; + + return; + } else if ([message.body isEqualToString:@"EXITSLIDESHOW"]) { + + std::remove(self.slideshowFile.c_str()); + + [self.slideshowWebView removeFromSuperview]; + self.slideshowWebView = nil; + self.webView.hidden = false; + + return; } const char *buf = [message.body UTF8String]; diff --git a/ios/ios.h b/ios/ios.h index 0109b0eda..0be3d6343 100644 --- a/ios/ios.h +++ b/ios/ios.h @@ -7,8 +7,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <memory> + +#include <LibreOfficeKit/LibreOfficeKit.hxx> + extern const char *lo_ios_app_getCacheDir(); extern int loolwsd_server_socket_fd; +extern std::shared_ptr<lok::Document> lok_document; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ios/ios.mm b/ios/ios.mm index 08ebb15cd..9d9e87e7a 100644 --- a/ios/ios.mm +++ b/ios/ios.mm @@ -8,6 +8,8 @@ #include <cstring> +#include "ios.h" + #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> @@ -16,6 +18,7 @@ extern "C" { } int loolwsd_server_socket_fd = -1; +std::shared_ptr<lok::Document> lok_document; const char* lo_ios_app_getCacheDir() { diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 23df2bc9e..a41283ed2 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1675,7 +1675,11 @@ private: Timestamp timestamp; _loKitDocument.reset(_loKit->documentLoad(uri.c_str(), options.c_str())); LOG_DBG("Returned lokit::documentLoad(" << uriAnonym << ") in " << (timestamp.elapsed() / 1000.) << "ms."); - +#ifdef IOS + // The iOS app (and the Android one) has max one document open at a time, so we can keep + // a pointer to it in a global. + lok_document = _loKitDocument; +#endif if (!_loKitDocument || !_loKitDocument->get()) { LOG_ERR("Failed to load: " << uriAnonym << ", error: " << _loKit->getError()); diff --git a/loleaflet/src/map/handler/Map.SlideShow.js b/loleaflet/src/map/handler/Map.SlideShow.js index 9390299ec..bb9488fb5 100644 --- a/loleaflet/src/map/handler/Map.SlideShow.js +++ b/loleaflet/src/map/handler/Map.SlideShow.js @@ -24,6 +24,10 @@ L.Map.SlideShow = L.Handler.extend({ }, _onFullScreen: function () { + if (window.ThisIsTheiOSApp) { + window.webkit.messageHandlers.lool.postMessage('SLIDESHOW', '*'); + return; + } this._slideShow = L.DomUtil.create('iframe', 'leaflet-slideshow', this._map._container); this._slideShow.src = this._map.options.webserver + this._map.options.serviceRoot + '/loleaflet/dist/loading.html'; if (this._slideShow.requestFullscreen) { commit 79e43dae179c9670e0a3751e7d864d044cf4b169 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Feb 12 11:31:36 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:46 2019 +0100 Unbreak running in Responsive Design Mode in Safari on macOS When "emulating" an iPad in Responsive Design Mode on macOS, L.Browser.touch is false so the code at the end of Map.Tap.js that calls L.Map.addInitHook() to add the 'tap' thing is not executed. But L.Browser.mobile is true, so the code in Map.js that tried to access this.tap was still executed and caused a 'TypeError: undefined is not an object'. Possibly this also helps in similar modes in other browsers. Change-Id: I5dbc1e6b9f80a8f691d400516d95ee950060ae18 Reviewed-on: https://gerrit.libreoffice.org/68335 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 819eb2a93926cc744918cb86b59176645c756071) diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 79ef7d54d..9f7f35af3 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -112,7 +112,9 @@ L.Map = L.Evented.extend({ if (L.Browser.mobile) { this._clipboardContainer = L.control.mobileInput().addTo(this); - this._clipboardContainer._cursorHandler.on('up', this.tap._onCursorClick, this.tap); + if (this.tap !== undefined) { + this._clipboardContainer._cursorHandler.on('up', this.tap._onCursorClick, this.tap); + } } else { this._clipboardContainer = L.clipboardContainer(); this.addLayer(this._clipboardContainer); commit 361d6789bc230a5c229c451e06f923505280424d Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Mon Feb 11 13:55:06 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:42 2019 +0100 Hack to make it easier to drag selection handles vertically on touch devices Change-Id: I33d03d1378ff5bbce094d5de30ab8d51d38efe0d Reviewed-on: https://gerrit.libreoffice.org/67685 Reviewed-by: Tor Lillqvist <t...@collabora.com> Tested-by: Tor Lillqvist <t...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/68334 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 7cdb5300fb6d7dd2b31877d21bbf3e28df9b0832) diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 6ac7ad501..b4ab51f21 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -1996,18 +1996,21 @@ L.TileLayer = L.GridLayer.extend({ var expectedPos = L.point(e.originalEvent.pageX, e.originalEvent.pageY).subtract(e.target.dragging._draggable.startOffset); - // If the map has been scrolled, but the cursor hasn't been updated yet, then - // the current mouse position differs. - if (!expectedPos.equals(cursorPos)) { - var correction = expectedPos.subtract(cursorPos); - - e.target.dragging._draggable._startPoint = e.target.dragging._draggable._startPoint.add(correction); - e.target.dragging._draggable._startPos = e.target.dragging._draggable._startPos.add(correction); - e.target.dragging._draggable._newPos = e.target.dragging._draggable._newPos.add(correction); - - e.target.dragging._draggable._updatePosition(); + // Dragging the selection handles vertically more than one line on a touch + // device is more or less impossible without this hack. + if (!(typeof e.originalEvent.type === 'string' && e.originalEvent.type === 'touchmove')) { + // If the map has been scrolled, but the cursor hasn't been updated yet, then + // the current mouse position differs. + if (!expectedPos.equals(cursorPos)) { + var correction = expectedPos.subtract(cursorPos); + + e.target.dragging._draggable._startPoint = e.target.dragging._draggable._startPoint.add(correction); + e.target.dragging._draggable._startPos = e.target.dragging._draggable._startPos.add(correction); + e.target.dragging._draggable._newPos = e.target.dragging._draggable._newPos.add(correction); + + e.target.dragging._draggable._updatePosition(); + } } - var containerPos = new L.Point(expectedPos.x - this._map._container.getBoundingClientRect().left, expectedPos.y - this._map._container.getBoundingClientRect().top); commit f44b4cfb8bd1687afa129017f982cafceb0fdc3b Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Fri Jan 25 12:02:45 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:38 2019 +0100 Fix a couple of typos Change-Id: Icfaca47c14ad1c76ed45d2ccb362f5f7405c4ca4 Reviewed-on: https://gerrit.libreoffice.org/68333 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 89cc5e4e2b4517e7179aecf37bae22800679f252) diff --git a/ios/README b/ios/README index dbd802339..e6db4fe0d 100644 --- a/ios/README +++ b/ios/README @@ -33,7 +33,7 @@ from step 2. This is what I do: make clean && make && tar cf - loleaflet/dist | ssh misan.local 'cd lo/online-ios-device && tar xvf -' where misan.local is the macOS machine where I build the app, in the -~lo/online-ios-device folder. +~/lo/online-ios-device folder. 4) In the online folder form step 2, edit the ios/Mobile.xcodeproj/project.pbxproj file in your favourite text @@ -52,7 +52,7 @@ and The configure script puts the app name as the CFBundleDisplayName property into the ios/Mobile/Info.plist file, and set up some -symbolic links that point to the LIbreOffice core source and build +symbolic links that point to the LibreOffice core source and build directories (which can be the same, of course). 4) Now you can open the Mobile Xcode project, build it, and run it. commit 10bf052a52bc4dc522b9de433108d316b03afb8a Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Jan 22 23:49:47 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:20 2019 +0100 Create the ios/Mobile/Fonts directory even if we won't copy any fonts there It is referenced unconditionally in the Xcode project file. Change-Id: I1f6713b5327740f76e90ea88dfb19a4933d0bce3 Reviewed-on: https://gerrit.libreoffice.org/68332 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 3fe322db2963aa9bdca3b8500d457e168af27ba0) diff --git a/configure.ac b/configure.ac index 37186b182..111f54e92 100644 --- a/configure.ac +++ b/configure.ac @@ -628,9 +628,9 @@ AS_IF([test "$ENABLE_IOSAPP" = "true"], [ if test `uname -s` = "Darwin"; then IOSAPP_FONTS='' + mkdir -p ios/Mobile/Fonts if test "$with_iosapp_fonts" != no -a -d "$with_iosapp_fonts"; then AC_MSG_NOTICE([copying fonts to be bundled]) - mkdir -p ios/Mobile/Fonts IOSAPP_FONTS=`find "$with_iosapp_fonts" -type f | while read fname; do cp "$fname" ios/Mobile/Fonts commit 21416e66c66a7ca935b3f95c569fcfe85c44afc3 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Jan 22 15:50:13 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:14 2019 +0100 exportSignAndUploadDocument() is not used on MOBILEAPP (and does not compile for iOS at least) Change-Id: I23bdd461c8dffb407e6aee2a378c47dc38239618 Reviewed-on: https://gerrit.libreoffice.org/68331 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 0c8e72604b28809d3fe8e7c58b2f30f06f28f00f) diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index f681fb1fc..662b0a664 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -1404,6 +1404,8 @@ bool ChildSession::signDocumentContent(const char* buffer, int length, const std return bResult; } +#ifndef MOBILEAPP + bool ChildSession::exportSignAndUploadDocument(const char* buffer, int length, const std::vector<std::string>& /*tokens*/) { bool bResult = false; @@ -1569,6 +1571,8 @@ bool ChildSession::exportSignAndUploadDocument(const char* buffer, int length, c return true; } +#endif + bool ChildSession::askSignatureStatus(const char* buffer, int length, const std::vector<std::string>& /*tokens*/) { std::unique_lock<std::mutex> lock(_docManager.getDocumentMutex()); commit 5f7c7565e2edd47b60333ce2f678f6244f29747e Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Mon Jan 7 12:26:05 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:07 2019 +0100 Add some more core source files for easier breakpointing Change-Id: I1b958c0fa9ec23aef963c0fc72e9991efe5e51b5 Reviewed-on: https://gerrit.libreoffice.org/68330 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 062064c2127d6f9d89fccd04555d0456e8cc44a5) diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj index d6f1fdf3b..001a71bbd 100644 --- a/ios/Mobile.xcodeproj/project.pbxproj +++ b/ios/Mobile.xcodeproj/project.pbxproj @@ -505,6 +505,15 @@ BEA8CDC62199E621009FE17E /* languagetag.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = languagetag.cxx; path = "../../ios-device/i18nlangtag/source/languagetag/languagetag.cxx"; sourceTree = "<group>"; }; BEB0E5D821C7CA800085A0CF /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; }; BEB0E5DB21CA7C780085A0CF /* graphicfilter.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = graphicfilter.cxx; path = "../../ios-device/vcl/source/filter/graphicfilter.cxx"; sourceTree = "<group>"; }; + BEB0E5DE21CA93D80085A0CF /* svdograf.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = svdograf.cxx; path = "../../ios-device/svx/source/svdraw/svdograf.cxx"; sourceTree = "<group>"; }; + BEB0E5E021CA9DC00085A0CF /* salbmp.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = salbmp.cxx; path = "../../ios-device/vcl/quartz/salbmp.cxx"; sourceTree = "<group>"; }; + BEB0E5E121CA9DDC0085A0CF /* salgdi.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = salgdi.cxx; path = "../../ios-device/vcl/quartz/salgdi.cxx"; sourceTree = "<group>"; }; + BEB0E5E221CA9DDC0085A0CF /* salvd.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = salvd.cxx; path = "../../ios-device/vcl/quartz/salvd.cxx"; sourceTree = "<group>"; }; + BEB0E5E321CA9DDC0085A0CF /* ctfonts.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ctfonts.cxx; path = "../../ios-device/vcl/quartz/ctfonts.cxx"; sourceTree = "<group>"; }; + BEB0E5E421CA9DDD0085A0CF /* salgdicommon.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = salgdicommon.cxx; path = "../../ios-device/vcl/quartz/salgdicommon.cxx"; sourceTree = "<group>"; }; + BEB0E5E521CA9DDD0085A0CF /* utils.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = utils.cxx; path = "../../ios-device/vcl/quartz/utils.cxx"; sourceTree = "<group>"; }; + BEB0E5E621CA9DDD0085A0CF /* salgdiutils.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = salgdiutils.cxx; path = "../../ios-device/vcl/quartz/salgdiutils.cxx"; sourceTree = "<group>"; }; + BEB0E5E821D6426B0085A0CF /* bitmap.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = bitmap.cxx; path = "../../ios-device/vcl/source/outdev/bitmap.cxx"; sourceTree = "<group>"; }; BEB6521C216F5D8B00B8C09A /* file_path_helper.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = file_path_helper.hxx; path = "../../ios-device/sal/osl/unx/file_path_helper.hxx"; sourceTree = "<group>"; }; BEB6521D216F5D8B00B8C09A /* file_error_transl.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = file_error_transl.hxx; path = "../../ios-device/sal/osl/unx/file_error_transl.hxx"; sourceTree = "<group>"; }; BEB6521E216F5D8B00B8C09A /* nlsupport.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = nlsupport.hxx; path = "../../ios-device/sal/osl/unx/nlsupport.hxx"; sourceTree = "<group>"; }; @@ -1009,6 +1018,7 @@ BEB6521A216F5D4600B8C09A /* sal */, BE93D43C216D555C007A39F4 /* sfx2 */, BE34D1892190712C00815297 /* sc */, + BEB0E5DC21CA93950085A0CF /* svx */, BE34D10C218B667400815297 /* sw */, BEB6524B216FD09400B8C09A /* tools */, BEA8CD7221959315009FE17E /* unotools */, @@ -1109,6 +1119,8 @@ BE93D421216CAA59007A39F4 /* app */, BEB0E5DA21CA7C330085A0CF /* filter */, BE58E1312187938700249358 /* headless */, + BEB0E5E721D642420085A0CF /* outdev */, + BEB0E5DF21CA9DA20085A0CF /* quartz */, BE34D140218CF87D00815297 /* window */, ); name = vcl; @@ -1290,6 +1302,44 @@ name = filter; sourceTree = "<group>"; }; + BEB0E5DC21CA93950085A0CF /* svx */ = { + isa = PBXGroup; + children = ( + BEB0E5DD21CA93A50085A0CF /* svdraw */, + ); + name = svx; + sourceTree = "<group>"; + }; + BEB0E5DD21CA93A50085A0CF /* svdraw */ = { + isa = PBXGroup; + children = ( + BEB0E5DE21CA93D80085A0CF /* svdograf.cxx */, + ); + name = svdraw; + sourceTree = "<group>"; + }; + BEB0E5DF21CA9DA20085A0CF /* quartz */ = { + isa = PBXGroup; + children = ( + BEB0E5E321CA9DDC0085A0CF /* ctfonts.cxx */, + BEB0E5E021CA9DC00085A0CF /* salbmp.cxx */, + BEB0E5E121CA9DDC0085A0CF /* salgdi.cxx */, + BEB0E5E421CA9DDD0085A0CF /* salgdicommon.cxx */, + BEB0E5E621CA9DDD0085A0CF /* salgdiutils.cxx */, + BEB0E5E221CA9DDC0085A0CF /* salvd.cxx */, + BEB0E5E521CA9DDD0085A0CF /* utils.cxx */, + ); + name = quartz; + sourceTree = "<group>"; + }; + BEB0E5E721D642420085A0CF /* outdev */ = { + isa = PBXGroup; + children = ( + BEB0E5E821D6426B0085A0CF /* bitmap.cxx */, + ); + name = outdev; + sourceTree = "<group>"; + }; BEB6521A216F5D4600B8C09A /* sal */ = { isa = PBXGroup; children = ( commit 4e283c56bb8fca03ed097c09727b1c81e09ba25f Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Wed Dec 19 16:56:01 2018 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:23:00 2019 +0100 Add some source files from vcl/source/filter Change-Id: Id6065ebc4ec40eeeb9f75db619df139d147b3f6f Reviewed-on: https://gerrit.libreoffice.org/68329 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit ab64797dd8dfa34d34bff62c7865a4c21ec22163) diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj index b9922e572..d6f1fdf3b 100644 --- a/ios/Mobile.xcodeproj/project.pbxproj +++ b/ios/Mobile.xcodeproj/project.pbxproj @@ -504,6 +504,7 @@ BEA8CDC52199E621009FE17E /* languagetagicu.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = languagetagicu.cxx; path = "../../ios-device/i18nlangtag/source/languagetag/languagetagicu.cxx"; sourceTree = "<group>"; }; BEA8CDC62199E621009FE17E /* languagetag.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = languagetag.cxx; path = "../../ios-device/i18nlangtag/source/languagetag/languagetag.cxx"; sourceTree = "<group>"; }; BEB0E5D821C7CA800085A0CF /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; }; + BEB0E5DB21CA7C780085A0CF /* graphicfilter.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = graphicfilter.cxx; path = "../../ios-device/vcl/source/filter/graphicfilter.cxx"; sourceTree = "<group>"; }; BEB6521C216F5D8B00B8C09A /* file_path_helper.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = file_path_helper.hxx; path = "../../ios-device/sal/osl/unx/file_path_helper.hxx"; sourceTree = "<group>"; }; BEB6521D216F5D8B00B8C09A /* file_error_transl.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = file_error_transl.hxx; path = "../../ios-device/sal/osl/unx/file_error_transl.hxx"; sourceTree = "<group>"; }; BEB6521E216F5D8B00B8C09A /* nlsupport.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = nlsupport.hxx; path = "../../ios-device/sal/osl/unx/nlsupport.hxx"; sourceTree = "<group>"; }; @@ -1106,6 +1107,7 @@ isa = PBXGroup; children = ( BE93D421216CAA59007A39F4 /* app */, + BEB0E5DA21CA7C330085A0CF /* filter */, BE58E1312187938700249358 /* headless */, BE34D140218CF87D00815297 /* window */, ); @@ -1280,6 +1282,14 @@ name = i18nlangtag; sourceTree = "<group>"; }; + BEB0E5DA21CA7C330085A0CF /* filter */ = { + isa = PBXGroup; + children = ( + BEB0E5DB21CA7C780085A0CF /* graphicfilter.cxx */, + ); + name = filter; + sourceTree = "<group>"; + }; BEB6521A216F5D4600B8C09A /* sal */ = { isa = PBXGroup; children = ( commit b68223c42bab08318c36d9974b4fc3b47f05c91c Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Wed Dec 19 13:36:44 2018 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:22:54 2019 +0100 Be less fragile in case of missing resources when downloading templates It is not enough ot look at the NSError* parameter. Need to check the HTTP status code, too. Change-Id: I8db146c77626d4080ef6606999d27e6bb845876c Reviewed-on: https://gerrit.libreoffice.org/68328 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 7257e9ff317180d27115707a657840d289bec3ea) diff --git a/ios/Mobile/AppDelegate.mm b/ios/Mobile/AppDelegate.mm index eadcda6a1..787a8a140 100644 --- a/ios/Mobile/AppDelegate.mm +++ b/ios/Mobile/AppDelegate.mm @@ -32,7 +32,7 @@ LibreOfficeKit *lo_kit; static void download(NSURL *source, NSURL *destination) { [[[NSURLSession sharedSession] downloadTaskWithURL:source completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) { - if (error == nil && [(NSHTTPURLResponse*)response statusCode] == 200) { + if (error == nil && [response isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse*)response statusCode] == 200) { NSError *error = nil; NSURL *resultingItem = nil; if ([[NSFileManager defaultManager] replaceItemAtURL:destination @@ -114,7 +114,7 @@ static void updateTemplates(NSData *data, NSURLResponse *response) [req setHTTPMethod:@"HEAD"]; [[[NSURLSession sharedSession] dataTaskWithRequest:req completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - if (error == nil && [(NSHTTPURLResponse*)response statusCode] == 200) { + if (error == nil && [response isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse*)response statusCode] == 200) { NSString *lastModified = [[(NSHTTPURLResponse*)response allHeaderFields] objectForKey:@"Last-Modified"]; NSDateFormatter *df = [[NSDateFormatter alloc] init]; df.dateFormat = @"EEE, dd MMM yyyy HH:mm:ss z"; @@ -178,7 +178,7 @@ static void updateTemplates(NSData *data, NSURLResponse *response) if (url != nil) { [[[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - if (error == nil) + if (error == nil && [response isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse*)response statusCode] == 200) updateTemplates(data, response); }] resume]; } commit bf7c6c989bee37bc17a8d725388b791728996b6e Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Wed Dec 19 13:06:16 2018 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:22:50 2019 +0100 Make the 'closemobile' button (at left, looks like '<') work in the mobile app We now have two places, the handler for the 'closemobile' button and the handler for the 'closedocument' menu entry, where we have an if statement that checks window.ThisIsAMobileApp and if so posts the "BYE" message to the webkit message handler in the app. Possibly we could move that conditional code into just one place, down into the 'close' function in L.Socket instead? Change-Id: Ib8c6adf621945b266fa4ea5f6d66b0022c2ca373 Reviewed-on: https://gerrit.libreoffice.org/68327 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit b101dc4553e2ddb52c654fe021332da94d551216) diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 04fb0a972..23c26faf8 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -290,8 +290,12 @@ function onClick(e, id, item, subItem) { L.toggleFullScreen(); } else if (id === 'close' || id === 'closemobile') { - map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}}); - map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}}); + if (window.ThisIsAMobileApp) { + window.webkit.messageHandlers.lool.postMessage('BYE', '*'); + } else { + map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}}); + map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}}); + } map.remove(); } else { commit 5576c0ea35acac8abe75013173ccfc2845e28848 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Dec 18 20:39:18 2018 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:22:46 2019 +0100 Don't crash if there is no WKJavaScriptExceptionMessage Change-Id: I90b99ba13e06c511334bc085d43d85126808f42f Reviewed-on: https://gerrit.libreoffice.org/68326 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit dfb30386090c8d1334bd6951d497d08fb3ab3a5b) diff --git a/ios/Mobile/Document.mm b/ios/Mobile/Document.mm index 285e660d9..af4ae0a75 100644 --- a/ios/Mobile/Document.mm +++ b/ios/Mobile/Document.mm @@ -133,7 +133,10 @@ completionHandler:^(id _Nullable obj, NSError * _Nullable error) { if (error) { - LOG_ERR("Error after " << [js UTF8String] << ": " << [error.userInfo[@"WKJavaScriptExceptionMessage"] UTF8String]); + LOG_ERR("Error after " << [js UTF8String] << ": " << [[error localizedDescription] UTF8String]); + NSString *jsException = error.userInfo[@"WKJavaScriptExceptionMessage"]; + if (jsException != nil) + LOG_ERR("JavaScript exception: " << [jsException UTF8String]); } } ]; commit 71a9472d0ddfaca7132cd3610e861c6faf116148 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Dec 18 17:01:18 2018 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:22:42 2019 +0100 Need offapi headers, too, when building against a 6.0 branch or core Change-Id: I4bce152cd286f66aaed1f8354a21c76a27e771b0 Reviewed-on: https://gerrit.libreoffice.org/68325 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit e27fff3181d6db1c134bef1477f2836d5ba80726) diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj index cdb1af4b8..b9922e572 100644 --- a/ios/Mobile.xcodeproj/project.pbxproj +++ b/ios/Mobile.xcodeproj/project.pbxproj @@ -1653,6 +1653,7 @@ "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/CustomTarget/ios", "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/UnpackedTarball/libpng", "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/UnoApiHeadersTarget/udkapi/comprehensive", + "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/UnoApiHeadersTarget/offapi/comprehensive", "$(SOURCE_ROOT)/../pocoinclude-symlink", ); INFOPLIST_FILE = Mobile/Info.plist; @@ -1711,6 +1712,7 @@ "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/CustomTarget/ios", "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/UnpackedTarball/libpng", "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/UnoApiHeadersTarget/udkapi/comprehensive", + "$(SOURCE_ROOT)/../lobuilddir-symlink/workdir/UnoApiHeadersTarget/offapi/comprehensive", "$(SOURCE_ROOT)/../pocoinclude-symlink", ); INFOPLIST_FILE = Mobile/Info.plist; commit dbb642a1f475715d81ad9fb88e73a0706d4630bc Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Mon Dec 17 22:18:49 2018 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 12 22:22:38 2019 +0100 Add a way to have templates specific to a customer deployment Add two settings: One setting "Template list URL" is a string that should either be empty (the typical case for a random user of the app), or contain a https: URL. If this setting is empty, only the templates bundled in the app are provided. If the "Template list URL" is non-empty, it should be a https: URL pointing to a text file (or dynamically generated text resource). That file is downloaded and read when the app starts. Each line in the file should either be a comment (starting with a hash '#'), or a https: URL pointing to a template document, that is of type .ott, .ots, or .otp. That document is downloaded if it hasn't been downloaded already, or if its time stamp is newer than that of the already downloaded copy. Also a thumbnail image for the template, formed by appending ".png" to its URL, is downloaded, if available. Any previously downloaded templates that aren't mentioned in the list file are removed. The intent is that in some managed mass deployment environment, the mobile device management software would set up this setting, so that the end-user devices would see the same templates. Obviously, this URL does not have to point to a static file on a web server, but could point to some dynamically generated resource on a web server, that enumerates the templates available on the server and returns their URLs as a text document. Another setting is "Empty tile cache next time". This is a toggle. If toggled on, the next time a document is opened in the app, the tile cache is emptied (and the toggle is reset off). This is mostly for potential problem solving, and might be removd later. Various refactoring to support the new functionality. Change-Id: Ie2ebf032acb9e43bb1c6f7ae4d0c449ae66eaa05 Reviewed-on: https://gerrit.libreoffice.org/68324 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit dabb0986e3fbee4949ccf210e724c0b19204d7a0) diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj index 7fcce4ae4..cdb1af4b8 100644 --- a/ios/Mobile.xcodeproj/project.pbxproj +++ b/ios/Mobile.xcodeproj/project.pbxproj @@ -63,6 +63,7 @@ BEA2835D21498AD400848631 /* Socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA2835C21498AD400848631 /* Socket.cpp */; }; BEA28360214ACA8500848631 /* FakeSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA2835F214ACA8500848631 /* FakeSocket.cpp */; }; BEA28377214FFD8C00848631 /* Unit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA28376214FFD8C00848631 /* Unit.cpp */; }; + BEB0E5D921C7CA800085A0CF /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BEB0E5D821C7CA800085A0CF /* Settings.bundle */; }; BEFB1EE121C29CC70081D757 /* L10n.mm in Sources */ = {isa = PBXBuildFile; fileRef = BEFB1EE021C29CC70081D757 /* L10n.mm */; }; /* End PBXBuildFile section */ @@ -502,6 +503,7 @@ BEA8CDC32199AC9D009FE17E /* lok.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = lok.cxx; path = "../../ios-device/comphelper/source/misc/lok.cxx"; sourceTree = "<group>"; }; BEA8CDC52199E621009FE17E /* languagetagicu.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = languagetagicu.cxx; path = "../../ios-device/i18nlangtag/source/languagetag/languagetagicu.cxx"; sourceTree = "<group>"; }; BEA8CDC62199E621009FE17E /* languagetag.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = languagetag.cxx; path = "../../ios-device/i18nlangtag/source/languagetag/languagetag.cxx"; sourceTree = "<group>"; }; + BEB0E5D821C7CA800085A0CF /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; }; BEB6521C216F5D8B00B8C09A /* file_path_helper.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = file_path_helper.hxx; path = "../../ios-device/sal/osl/unx/file_path_helper.hxx"; sourceTree = "<group>"; }; BEB6521D216F5D8B00B8C09A /* file_error_transl.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = file_error_transl.hxx; path = "../../ios-device/sal/osl/unx/file_error_transl.hxx"; sourceTree = "<group>"; }; BEB6521E216F5D8B00B8C09A /* nlsupport.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = nlsupport.hxx; path = "../../ios-device/sal/osl/unx/nlsupport.hxx"; sourceTree = "<group>"; }; @@ -575,6 +577,7 @@ BE00F8922139494E001CE2D4 /* Resources */ = { isa = PBXGroup; children = ( + BEB0E5D821C7CA800085A0CF /* Settings.bundle */, BE80E46721B7066C00859C97 /* Templates */, BE80E43121AD92F600859C97 /* Fonts */, BE8D85BE214055F2009F1860 /* config */, @@ -1445,6 +1448,7 @@ BE8D85D2214055F3009F1860 /* program in Resources */, BE8D85CB214055F3009F1860 /* share in Resources */, BE80E46821B7066D00859C97 /* Templates in Resources */, + BEB0E5D921C7CA800085A0CF /* Settings.bundle in Resources */, BE00F8A621396585001CE2D4 /* loading.html in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ios/Mobile/AppDelegate.h b/ios/Mobile/AppDelegate.h index cc6d4a629..d9c6c00cc 100644 --- a/ios/Mobile/AppDelegate.h +++ b/ios/Mobile/AppDelegate.h @@ -8,6 +8,8 @@ #import <UIKit/UIKit.h> +#import <LibreOfficeKit/LibreOfficeKit.h> + @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @@ -15,6 +17,7 @@ @end extern NSString *app_locale; +extern LibreOfficeKit *lo_kit; // vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/Mobile/AppDelegate.mm b/ios/Mobile/AppDelegate.mm index 99cf64d5c..eadcda6a1 100644 --- a/ios/Mobile/AppDelegate.mm +++ b/ios/Mobile/AppDelegate.mm @@ -12,6 +12,8 @@ #import <cstdlib> #import <cstring> +#import <LibreOfficeKit/LibreOfficeKitInit.h> + #import "AppDelegate.h" #import "DocumentBrowserViewController.h" #import "DocumentViewController.h" @@ -25,6 +27,127 @@ static LOOLWSD *loolwsd = nullptr; NSString *app_locale; +LibreOfficeKit *lo_kit; + +static void download(NSURL *source, NSURL *destination) { + [[[NSURLSession sharedSession] downloadTaskWithURL:source + completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) { + if (error == nil && [(NSHTTPURLResponse*)response statusCode] == 200) { + NSError *error = nil; + NSURL *resultingItem = nil; + if ([[NSFileManager defaultManager] replaceItemAtURL:destination + withItemAtURL:location + backupItemName:nil + options:NSFileManagerItemReplacementUsingNewMetadataOnly + resultingItemURL:&resultingItem + error:&error]) { + LOG_INF("Downloaded " << + [[source absoluteString] UTF8String] << + " as " << [[destination absoluteString] UTF8String]); + } else { + LOG_ERR("Failed to replace " << + [[destination absoluteString] UTF8String] << + " with " << [[location absoluteString] UTF8String] << + ": " << [[error description] UTF8String]); + } + } else if (error != nil) { + LOG_ERR("Failed to download " << + [[source absoluteString] UTF8String] << + ": " << [[error description] UTF8String]); + } else { + LOG_ERR("Failed to download " << + [[source absoluteString] UTF8String]); + } + }] resume]; +} + +static void downloadTemplate(NSURL *source, NSURL *destination) { + download(source, destination); + // Download also a thumbnail + download([NSURL URLWithString:[[source absoluteString] stringByAppendingString:@".png"]], + [NSURL URLWithString:[[destination absoluteString] stringByAppendingString:@".png"]]); +} + +static void updateTemplates(NSData *data, NSURLResponse *response) +{ + static NSString *downloadedTemplates = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingString:@"/downloadedTemplates/"]; + + // The data downloaded is a template list file, and should have one URL per line, corresponding + // to a template document. For each URL, we check whether we have the corresponding template + // document, and whether it is the same version (timestamp is older or the same). If not, we + // download the new version. Finally we remove any earlier downloaded templates not mentioned in the list + // file. + + NSMutableSet<NSString *> *urlHashes = [NSMutableSet setWithCapacity:10]; + + const char *p = static_cast<const char*>([data bytes]); + const char *endOfData = p + [data length]; + while (p < endOfData) { + const char *endOfLine = static_cast<const char*>(std::memchr(p, '\n', [data length])); + if (endOfLine == NULL) + endOfLine = endOfData; + + // Allow comment lines staring with a hash sign. + if (*p != '#') { + const int length = endOfLine - p; + std::vector<char> buf(length+1); + std::memcpy(buf.data(), p, length); + buf[length] = 0; + + NSString *line = [NSString stringWithUTF8String:buf.data()]; + + NSURL *url = [NSURL URLWithString:line]; + NSString *baseName = [url lastPathComponent]; + + NSString *hash = [[NSData dataWithBytes:buf.data() length:length] base64EncodedStringWithOptions:0]; + [urlHashes addObject:hash]; + + NSString *directoryForTemplate = [downloadedTemplates stringByAppendingString:hash]; + + NSURL *fileForTemplate = [NSURL fileURLWithPath:[directoryForTemplate stringByAppendingString:[@"/" stringByAppendingString:baseName]]]; + + // If we have that template, check whether it is up-to-date + BOOL isDirectory; + if ([[NSFileManager defaultManager] fileExistsAtPath:directoryForTemplate isDirectory:&isDirectory] && + isDirectory) { + NSMutableURLRequest *req = [[NSURLRequest requestWithURL:url] mutableCopy]; + [req setHTTPMethod:@"HEAD"]; + [[[NSURLSession sharedSession] dataTaskWithRequest:req + completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + if (error == nil && [(NSHTTPURLResponse*)response statusCode] == 200) { + NSString *lastModified = [[(NSHTTPURLResponse*)response allHeaderFields] objectForKey:@"Last-Modified"]; + NSDateFormatter *df = [[NSDateFormatter alloc] init]; + df.dateFormat = @"EEE, dd MMM yyyy HH:mm:ss z"; + NSDate *templateDate = [df dateFromString:lastModified]; + + NSDate *cachedTemplateDate = [[[NSFileManager defaultManager] attributesOfItemAtPath:[fileForTemplate path] error:nil] objectForKey:NSFileModificationDate]; + + if ([templateDate compare:cachedTemplateDate] == NSOrderedDescending) { + downloadTemplate(url, fileForTemplate); + } + } + }] resume]; + } else { + // Else download it. + [[NSFileManager defaultManager] createDirectoryAtPath:directoryForTemplate withIntermediateDirectories:YES attributes:nil error:nil]; + downloadTemplate(url, fileForTemplate); + } + } + if (endOfLine < endOfData) + p = endOfLine + 1; + else + p = endOfData; + } + + // Remove templates that are no longer mentioned in the list file. + NSArray<NSString *> *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:downloadedTemplates error:nil]; + for (int i = 0; i < [dirContents count]; i++) { + if (![urlHashes containsObject:[dirContents objectAtIndex:i]]) { + [[NSFileManager defaultManager] removeItemAtPath:[downloadedTemplates stringByAppendingString:[@"/" stringByAppendingString:[dirContents objectAtIndex:i]]] + error:nil]; + } + } +} @implementation AppDelegate @@ -33,6 +156,9 @@ NSString *app_locale; if (!trace) trace = strdup("warning"); + Log::initialize("Mobile", trace, false, false, {}); + Util::setThreadName("main"); + // Having LANG in the environment is expected to happen only when debugging from Xcode. When // testing some language one doesn't know it might be risky to simply set one's iPad to that // language, as it might be hard to find the way to set it back to a known language. @@ -43,8 +169,26 @@ NSString *app_locale; else app_locale = [[NSLocale preferredLanguages] firstObject]; - Log::initialize("Mobile", trace, false, false, {}); - Util::setThreadName("main"); + // Look for the setting indicating the URL for a file containing a list of URLs for template + // documents to download. If set, start a task to download it, and then to download the listed + // templates. + NSString *templateListURL = [[NSUserDefaults standardUserDefaults] stringForKey:@"templateListURL"]; + if (templateListURL != nil) { + NSURL *url = [NSURL URLWithString:templateListURL]; + if (url != nil) { + [[[NSURLSession sharedSession] dataTaskWithURL:url + completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + if (error == nil) + updateTemplates(data, response); + }] resume]; + } + } + + // Initialize LibreOfficeKit. + + lo_kit = lok_init_2(nullptr, nullptr); + lo_kit->pClass->registerCallback(lo_kit, [](int, const char *, void*){}, nullptr); + fakeSocketSetLoggingCallback([](const std::string& line) { LOG_TRC_NOFILE(line); @@ -110,6 +254,8 @@ NSString *app_locale; return YES; } +// NSURLSessionDataDelegate methods + @end // vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/Mobile/Document.mm b/ios/Mobile/Document.mm index 1a0ccdcde..285e660d9 100644 --- a/ios/Mobile/Document.mm +++ b/ios/Mobile/Document.mm @@ -48,6 +48,13 @@ } - (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError **)errorPtr { + + // If we are asked to empty the tile cache, do that now. + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"emptyTileCache"]) { + [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithUTF8String:LOOLWSD_CACHEDIR] error:nil]; + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"emptyTileCache"]; + } + fakeClientFd = fakeSocketSocket(); NSString *uri = [[self fileURL] absoluteString]; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits