Commit graph

19815 commits

Author SHA1 Message Date
Tor Lillqvist
4417ec556b The poco-no-special-expat-sauce.diff wants -p0 to apply
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ib0b7227996a7fc9b79ad976cc73b7f8dbbd6ce34
2023-01-30 08:10:17 +02:00
Tor Lillqvist
78b0e82f98 There is no need to call lok_cpp_init() here
LOKit will be initialised in the lok_init_2() call in lokit_main() in
Kit.cpp. This change also puts setting and getting the LOK_OPTIONS
environment variable in the right order.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Iee6f5adcb60bb887083c67666c2d597a15686bf9
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2023-01-29 22:05:20 +02:00
Tor Lillqvist
457c17d7f1 Use COOL log level 'error' instead of 'trace'
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I50285b974403e95f48106950a81a1ea9bbd95b86
2023-01-29 21:23:44 +02:00
Ashod Nakashian
afefa43a58 wsd: better storage attribute handling
Change-Id: I80ee9ddda00769c5ef34f5f3d7265fd6c5f8648e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
fac3f05859 wsd: test: add UnitSaveOnExitUnmodified
This tests the headers when always_save_on_exit
is set.

Change-Id: I1aa2d11db79f525f2d94ced8702514d5b3535fc8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
2e48738dc8 wsd: fix always_save_on_exit
This fixes the handling of the
always_save_on_exit=true setting.

Change-Id: I6993030c2af7fa080c8421c5cb4fa7cb9ea3eb9b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
8e2c238ee9 wsd: test: better UnitWOPISaveOnExit
Improves stability by closing the document
only after uploading has finished.

Change-Id: I20927a5d009998d9d7a25c3309fef02a45077c70
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
dd141f0a4b wsd: merge the storage attributes after uploading
This fixes a corner-case where we modify and
save during uploading, which means that the
next save will not have any modifications,
and we will not merge the attributes until
we get new modifications.

Change-Id: I621e26e04ea3e0d04a9a3d535ff2cfc607d56fef
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
325c27997b wsd: test: add IsExitSave check in UnitWOPIAsyncUpload_Close
Change-Id: I80936316fb172e5a4ef1811a66d061e63ea0bb27
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
cb3f2627d2 wsd: set IsExitSave attribute before uploading
Change-Id: I4828133d83e66654b4151dad896bd9d6edaa0200
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
f2f6deddc5 wsd: move setForced attribute closer to usage
Change-Id: If4dc0e30e63ab5d35d5ceaad26d05fa5947d0cda
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian
58fe9b184a wsd: set IsExitSave header only when unloading
We now capture the flag that controls the
IsExitSave header directly via the result
of IsUnloading(). This makes passing it
via function parameters obsolete.

Change-Id: Idb4df4f96d66b4a9f92ff9a570f48be895e623be
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Paris Oplopoios
aea0ea0582 browser: Add page number wizard to compact insert menu
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Ibb92c17894166276c0e0ef33736522b282fea993
2023-01-29 12:52:33 +01:00
Tor Lillqvist
81c4adb199 Use branding.css also in the EMSCRIPTENAPP case
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I832414864130b9baa1ce7577b3006c7c37dc14eb
2023-01-29 12:45:28 +02:00
Tor Lillqvist
cee9bf493a Change hardcoded sample document name and verify that we get it
You now must pass --with-wasm-additional-files=<path> where path
contains a file called sample.docx.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I21e62feb6282833a5d60b31db26328eda63cdaea
2023-01-29 06:56:08 +02:00
Tor Lillqvist
38171388c8 Make the temporary "WASM app" work
Now I hope things are initialised in the right order and the plumbing
gets set up so that messages are passed as expected. It seems to work
most of the time.

Main changes are:

  - The online WASM executable is built using the -s MODULARIZE -s
    EXPORT_NAME=createOnlineModule options. This means that the WASM
    runtime is not automatically initialized and the main() function
    is not automatically started. Only when the createOnlineModule()
    function is called is that done. Calling exported C/C++ functions
    is a little bit more complicated.

  - Code to actually Base64-encode strings to be executed as
    JavaScript when expected is now present in wasmapp.cpp. (After
    being passed through the Base64ToArrayBuffer function on the JS
    side.) Whether this is actually necessary is not fully clear, but
    to keep the code similar to that in the GTK, iOS, and Android
    apps, this is kept as such for now. It would probably work fine to
    just directly create the ArrayBuffer in the C++ (using the EM_ASM
    magic).

  - The COOLWSD::run() function is now run in a separate thread so
    that main() can return.

  - The FakeWebSocket's onopen() function is now called from
    innerMain(), where the HULLO message is sent. It remains a bit
    unclear if this really is the ideal place.

    In the mobile apps the HULLO message is sent and the onopen()
    function is called in the window.socket.onopen() function in
    global.js.

    But note that despite that the WASM app and the mobile apps are
    largely quite similarly constructed and the FakeSocket and
    FakeWebSocket plumbing is the same, there is an important
    difference. In a mobile app the C++ code is what runs first, and
    that then loads the HTML page into WebKit, in which the JS
    runs. In the WASM app it is the other way around. The web page is
    naturaly the one that is loaded and the JS code then starts
    running the C++ code as WASM.

Finally, note that the whole concept that there is a separate "WASM
app" is temporary.

What we eventually want to achieve is that the COOL webpage upon
loading will connect a COOL server. As it does currently. The COOL
server runs the online and core C++ code to load a document, and
renders document tiles and sends those to the client JS code to
dispay.

The new thing will be that, if enabled, in addition to the HTML and JS
resources, the client will also download the WASM code and data
resources. Also, the document and updates to it will be downloaded
while being edited so that a copy can be kept in client memory. But
the WASM code and the downloaded document will remain unused most of
the time. Only if the connection to the COOL server breaks will the JS
start running the WASM code and the JS will talk to online code
running locally as WASM instead of to a COOL server. Obviously there
are still lots of things hanging in the air here regarding how exactly
this will work.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ib1786a0b485d51797b0f2302d4296aa1ff9df5c1
2023-01-28 22:04:39 +02:00
Tor Lillqvist
fe7daff506 Drop the temporary experimenting with loading a document through the LOKit API
After my shortly upcoming commits the document gets loaded and its
tiles displayed by the code that normally does that. No need to
separately verify that loading a document works.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Id5883f36644b5e9b79c3f80ea2131e9f35823b2f
2023-01-28 20:57:03 +02:00
Tor Lillqvist
68915535c1 Add --with-wasm-additional-files=<path>
Pass the absolute pathname to directory that contains a tree of additional
files you want to be available in the WASM in-memory file system. Relevant
only if you build for WASM with Emscripten, i.e. with
--host=wasm32-local-emscripten.

(This is not usable without my still uncommitted / unpushed WIP
hacking.)

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I97a4651bed89bf35c50b009e04ddaa3e03aa8006
2023-01-28 19:50:37 +02:00
Tor Lillqvist
84963dafd1 Temporarily hardcode the document URL and UI lang for WASM in more places
(Note that the existence of a window.ThisIsTheEmscriptenApp property
is also a temporary hack; the eventual goal is for a one same Online
webpage to be able to switch automatically from server-based to
WASM-based and back based on connectivity to the server.)

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ia5e3f4008eaaf1543c08482418635dca0d3983e5
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2023-01-28 10:30:26 +02:00
Tor Lillqvist
6514e01da2 Hardcode window.userInterfaceMode to notebookbar for EMSCRIPTENAPP for now
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I79611e982de2d49b125d7c887081385c6597a028
2023-01-27 22:56:56 +02:00
Gülşah Köse
83336a491f Keep focus on sheet on empty navbar and notebookbar clicked
When we click empty part of navbar or notebookbar bar, focus
should be on sheet. There are some wide containers
(eg document title) and they looking like empty area. Clicking
there makes lost the focus. Here we add aditional conditions
to check if user cliked that empty looking areas.

Without this patch, focus is on browser itself and CTRL+S
saves the HTML instead of current document.

Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com>
Change-Id: I3a94c2d66dc093475e6674543b36b2c6905df2c0
2023-01-27 15:07:52 +01:00
Ashod Nakashian
048bece8a8 wsd: retry uploading when it fails
When uploading fails, we shouldn't
rely on another save or close to
happen, we should retry as soon as
possible (right after the
min_time_between_uploads_ms elapses).

Change-Id: Ieabe7656583cf391f637986f5403acc87bdc913f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
20332f4078 wsd: only users can force uploading
Forced uploading is used to overwrite the
file in storage. This is useful when there
is a conflict. Only the user can decide to
do (or not do) that. As such, no auto-save
or any other case should force an upload.

The issue is that we can clobber a conflicted
version in storage by accident. Forced upload
was used for always_exit_on_save=true setting,
which wasn't really needed as the feature isn't
to forcefully upload, rather to just save and
upload as necessary.

Change-Id: Ie46f38f76392493fe8f8112f05953899963da99b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
cca0a561ed wsd: never upload using a session that is read-only
Change-Id: Ife0711de46d498e1a9b65c8e0ef7484b37266b32
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
5dfbac3e81 wsd: remove dead code
We never enter the condition in question
if !_documentChangedInStorage, so the
code removed could never execute.

Change-Id: Ia183b63d7a13f6316eb5f24636997b6e6e417a97
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
59172b6b6b wsd: comment typos
Change-Id: I0d75d0bd7a2057bb00d248ccd834381f0565426c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
b862bbc539 wsd: read the always_save_on_exit config once
This is necessary for multi-test scenarios
where the flag might be changed between tests.

Change-Id: I2fd9c21bc7ccdf2c9941ca3a959b578ec226facc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
ecc8bc5bbc wsd: exit code 0 for the exit command to kit
No reason to consider the 'exit' command
unexpected or a cause for error, so the
process exit code needs not be anything
but 0.

Change-Id: I352f706c6f174b66e9a4814fc35bb95b1a3bf3d6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
11eb6885a6 wsd: whitespace formatting
Change-Id: I5d6d61e6b74aabbf8cc3ac8555f40400397b6ff6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
d585ebe02d wsd: simpler canUploadToStorage implementation
Change-Id: I445a68ef1834a7ec43e7885164b092f728607584
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
44a27110e1 wsd: better logging
Change-Id: I98bc45d287c44beb10bfe6fbe02d208f37531515
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian
63ac54a552 wsd: test: better UnitOAuth
There was a race between the closedocument
command and the save command that caused
occassional random failures.

Change-Id: I9e0e71545bab586826273fdb6e160b624be91dbe
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:03:18 -04:00
Ashod Nakashian
57fe2061eb wsd: test: searchable prefix in test-server logs
Change-Id: I83cdb0f43e9681a763b964829179954e6d1b3c8a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:03:18 -04:00
Ashod Nakashian
0adef5dd19 wsd: test: move UnitWOPIAsyncUpload_Close
Another failure-to-upload test that best
belongs to the UnitWOPIFailUpload suite.

Change-Id: I48f34413337f34a959a38402409e7321203dff35
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:03:18 -04:00
Pedro Pinto Silva
610a62be6d Sidebar: Fix to allow ratio to span across columns
There is an element displayed as a column before ratio
and we then hide it which is fine but, when ratio label
becomes to lengthly (Seitenverhältnis beibehalten) it then
gets cropped due to lack of space.
- Make it span across columns
- Do not align to the end
- Remove left margin from checkbox

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I02ec7a608c0b330a52fa70db3b453fe04fefa805
2023-01-27 12:53:26 +01:00
Tor Lillqvist
fce151877e I get "warning: unsupported syscall: __sys_prlimit64" in WASM so avoid that
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Iabcde9bcbfd6f1a966503822c1f72d3d3ecf3571
2023-01-27 11:01:05 +02:00
Tor Lillqvist
1e55de0924 Use -gseparate-dwarf like in core
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ie7814a0f0f02a577f641a7d223fbb0c81ab3b2ab
2023-01-27 10:06:12 +02:00
Tor Lillqvist
48c96e70ca More WASM hacking
Apparently handle_cool_message() gets called from a web worker thread
and then using emscripten_run_script() in wasmapp.cpp to run a JS
snippet that refers to the 'window' variable will not work. That
variable exists only in the main thread. So use MAIN_THREAD_EM_ASM()
instead.

Hardcode the document URL for now also in wasmapp.cpp.

Try to send the HULLO message from COOLWSD::innerMain().

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ic48042c6d0c6239a3b82e74f0565056a15f3d98d
2023-01-26 22:01:14 +02:00
Szymon Kłos
ae06a2db8b Add export to PDF & EPUB in menubar
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I4364dae88fa6943381137a554d3bde12be8a376a
2023-01-26 18:23:18 +01:00
Szymon Kłos
6510e42f8e Include PDF and EPUB in Get_Export_Formats_Resp
After rework to grouped download as and also export
entry fro PDF and EPUB - these formats were not included.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I91e5b25823017a3164fef2b63b2552e9893cf0b0
2023-01-26 13:06:57 +00:00
Szymon Kłos
3285ea6cae Don't show pdf export for readonly templates
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I0f67eb0ccd31f135da7f416b038cd7ca547fb290
2023-01-26 13:06:57 +00:00
Szymon Kłos
502c3de01d Add export as epub
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I49c152b3dda6d156b65221cfac2a06f7b79b0547
2023-01-26 13:06:57 +00:00
Szymon Kłos
b0dd943089 Add export as pdf
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I61853fb2213e57acd02d7a3eee53e86f43cb36b5
2023-01-26 13:06:57 +00:00
Szymon Kłos
93e0641fd0 Use dispatch for downloadas and saveas
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I7f75e4a632dcce0c5c086ab570d2f3877f717f52
2023-01-26 13:06:57 +00:00
Tor Lillqvist
9e81cdefde Stop using Qt
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Icb7c280c20ed02ef5840272a0e979e1446af2b56
2023-01-26 10:02:29 +02:00
Tor Lillqvist
b1bb133e52 Bump PTHREAD_POOL_SIZE to 15
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I9c6c7075fff9d67c921d0c525eb8c0fe474b847c
2023-01-26 09:12:06 +02:00
Tor Lillqvist
b1d43c395a Leave ThreadPool max concurrency at 2 for Emscripten
The default would be std:🧵:hardware_concurrency() which can be
ridiculously high for the WASM case.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I77902a58b96248d7afe638a039886712516fe905
2023-01-26 00:13:07 +02:00
Tor Lillqvist
a841686c79 Avoid misleading wording in log
If we are not caching tiles, it is misleading to log "Saved cache tile".

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I0e0ec446d5edf266ea4acb42883c49d5f7063763
2023-01-25 23:20:12 +02:00
Pranam Lashkari
f626f9b723 zotero: zotero: handle section deletion
this also helps in case of undo

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ib14b1772a7bfd2f9de0c0bb065c5f596c48c94b0
2023-01-25 16:56:35 +01:00
Pranam Lashkari
bcf1f0fbc7 zotero: handle bookmark deletion
this also helps in case of undo

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I51cf51cab25569a43761fe81a068e608fa8d9601
2023-01-25 16:56:35 +01:00