Commit graph

301 commits

Author SHA1 Message Date
mert
5418b4b19b Make AutoSpellChecking option state remembered on first start
Change-Id: I25823025e35ba6f580b03834979fb0bea616bcc1
Signed-off-by: mert <mert.tumer@collabora.com>
2020-11-17 14:55:31 +03:00
Ashod Nakashian
cb4beaca34 wsd: avoid the using keyword and use C++ size_t
size_t in C and in C++ are not necessarily the same
type. The C++ size_t is in the std namespace. Since
we do include many C headers, and indeed some C++
runtime headers do define size_t for backwards
compatibility, it's easy to mix and match the two
types.

Also, 'using std::size_t;' isn't a great practice,
so removed.

This is not exhaustive, just some low-hanging cases.

Change-Id: I85a36b6fd1acd204274b1869de9bcb94c8b3cf13
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-11-15 15:41:41 -05:00
Michael Meeks
0d10c2cae8 Set normalized view id for broadcast (ie. slide preview) thumbnails.
Change-Id: Ica5312ae9c7147c8dc969523e28d460348ba2e76
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2020-11-14 19:54:56 +03:00
Andras Timar
f786244a0b Revert "wsd: temporarily avoid race-conditions when creating documents"
This reverts commit 4410c51b3879c9291b465dea3a59c2e65e94c361.
Reason: this issue should be fixed in the integration that caused the
problem in the first place.

Change-Id: Id41eb66979e4c08dd3b9fd6499e01b4690526541
2020-10-30 11:21:43 +01:00
Jan Dageförde
d7656402d3 Migrate code to use generic sendError
Signed-off-by: Jan Dageförde <jan.dagefoerde@googlemail.com>
Change-Id: I0a00ea1220f19479eb021538f67b6bda0c59f7ef
2020-10-28 13:12:27 +03:00
Ashod Nakashian
2785b13a13 wsd: temporarily avoid race-conditions when creating documents
As the comment describes, this is a temporary workaround.
The issue happens when nocaps is enabled, no doubt due
to the timing difference from the more common (and default)
caps-enabled case.

Change-Id: I742d7b9fd63f0babe8e1d45b968e09026d78debc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-10-25 12:20:58 +01:00
Ashod Nakashian
c71998438d wsd: document forced storage saving and remove default args
Change-Id: Ic7fde18f07dfe848e219b4ebba30426277ae1287
2020-10-22 14:40:40 +02:00
Tor Lillqvist
5642e89ccf Add handling of a "DEBUG" message that is just printed to stderr
This is useful in situations where you can't get at console.log()
output from the JavaScript, like when you are using the Nextcloud iOS
app installed from the App Store and want to debug the loleaflet
offered by a Collabora Online server you are using. You can add code
like

    this._map._socket.sendMessage('DEBUG Foo bar=' + bar);

temporarily to the JavaScript and will see those then in the terminal
where you run 'make run.'

Change-Id: I04c78d86faa283e135dbcb86dac0cabd7b6a0724
2020-10-16 12:28:49 +03:00
Miklos Vajna
11897f2db7 Introduce Util::make_unique()
In the old code, if the evaluation first allocates the memory for the
raw pointer, then calls firstLine() and an exception is thrown before
the std::unique_ptr construction, then the memory is leaked. Using
make_unique() has the benefit of avoiding this problem.

Convert only a single usage, so the remaining places can be done as easy
hacks.

Change-Id: Iaf3d8051a8a0627a57fdf1196bde7d5f8612fcff
2020-10-08 09:53:37 +02:00
Henry Castro
5a401b1405 wsd: explicit decode URI
is it a POCO bug?
The implicit decode URI is not working
if a file is "test___á.pdf" <=> "test___%C3%A1.pdf"
getPath() returns "test___%C3%A1.pdf"

Change-Id: I79e2ec13cd5500d188a1657e47af03d29b151824
2020-10-06 16:38:44 -04:00
Henry Castro
af70d3c21a wsd: do not encode to send file when the API is "convert-to"
if a file is "test__á.pdf" and if it is encoded "test___%C3%A1.pdf"
then stat("test___%C3%A1.pdf") is false

Change-Id: I28a5ed90c599b7244f0c3a3d2259d83b25be762f
2020-10-05 10:52:29 -04:00
Henry Castro
d541429ec9 wsd: do not encode the URI if the API is "convert-to"
If it is encoded again, the result file does
not exist.

If a file is "test___á.pdf" and encode again
"test___%C3%A1.pdf"

fileExists("test___%C3%A1.pdf") false

Change-Id: I9fa1b8b52ebf0993158eb6ebe383da53921f640a
2020-10-05 10:48:43 -04:00
Miklos Vajna
7c0d0c35fc ClientSession: simplify by using std::any_of()
Change-Id: I92b284883a633ebe3bf47ea8001f8c18692275a1
2020-10-02 09:28:39 +02:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Miklos Vajna
e080b8af04 ClientSession: clean up copy&paste
dialogevent and formfieldevent has the same handler, do that at a single
place.

Change-Id: I4e0f7b36484f6ef65539616c0fe81a331c9caa98
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103529
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-09-28 09:33:18 +02:00
mert
115bb1b652 Fix unable to open password protected documents on mobile
Change-Id: Ifd67cb6f3640784176abfe483f0364c1dfe4b5d9
Signed-off-by: mert <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102388
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102729
2020-09-15 15:14:40 +02:00
Samuel Mehrbrodt
8c602e179e Revert "Revert "Don't update modified status after saving to storage fails""
This reverts commit e83e36bd9b.

Unit test failure was fixed

Change-Id: I2176368278725c1711df3b23eef95de6526c68d5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100859
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-08-24 14:34:10 +02:00
Ashod Nakashian
3cf27ee2c2 wsd: minor cosmetics
Change-Id: I9e67cf870c92197a5c53d45f479d8c9f70818049
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100833
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ash@collabora.com>
2020-08-17 14:15:37 +02:00
Tamás Zolnai
e83e36bd9b Revert "Don't update modified status after saving to storage fails"
The reverted change breaks unit-wopi-documentconflict test.

This reverts commit 494a5221f5.

Change-Id: I3e89a6e6526e9388e4dc6a1ea8f8d8832e8cb169
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100678
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2020-08-13 17:35:02 +02:00
Samuel Mehrbrodt
494a5221f5 Don't update modified status after saving to storage fails
Otherwise client gets a notification that document is unmodified.
This should not happen, as the document in the storage has not been updated
and so it should be considered as modified until saving to storage succeeds.

Change-Id: I6918f97d96a546ce086f622854f4cbeed48d54ae
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100162
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-08-13 09:39:30 +02:00
Michael Meeks
1061ac90ce TileCache: cleanup debug, propagate now more helpfully & fix staleness.
Stale tiles were still being counted, unhelpfully. Avoid doing lots
of ::now() calls, and yet detect this.

Change-Id: Ib1e4b2f1968c1994849bb23ec54e28f6706230ee
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100347
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-08-07 20:01:30 +02:00
Tomaž Vajngerl
ca00470722 allow saving a PDF, add "view_comment" state
This adds a "view_comment" in addition to "view" and "edit" state
into discovery.xml. In case it is enabled, the filters let the
comment commands through to core.

In addition add "Save Comment" menu action to allow saving the
comments, which is enabled when in "read-only" with "view_comment"
mode.

Change-Id: I3ab3dbee93ee2167ae96adea7025fc0b385f8201
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99473
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-07-27 16:40:12 +02:00
Tomaž Vajngerl
241f134473 Enable comments inserting and deleting when in read-only mode
Change-Id: I5aa3be061a6ef65bbf5d4cb879c4dde97ed31dd5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99017
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-07-20 22:47:00 +02:00
Mike Kaganski
a1fafe27f4 Allow user to try to lock the document for edit
Use mobile-edit-button for that is permitted.

Change-Id: I4d4c3f21d574abae033bacc69def96aaf6b51567
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98786
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-07-20 15:49:09 +02:00
Mike Kaganski
e9c4c0286a Handle failed locking as (temporarily) read-only session
E.g., opening a checked-out document in SharePoint

Change-Id: Ifd5225d8450d7f2f5ba9661f158551c5c16f9b09
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97596
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-07-20 15:47:33 +02:00
Mike Kaganski
2752141867 Restructure ClientSession::_handleInput to check tokens once
This allows to avoid redundancy, and makes it explicit which token
is handled where.

Change-Id: Ibc7ed7617f7f511cb8346e2e82281c3a3fdac9a7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98821
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-15 14:53:16 +02:00
Ashod Nakashian
aba09e165b wsd: improved TileCache
* Excised TileCacheDesc to improve performance and simplify code.
* clang-tidy suggestions and auto-rewrite fixes.
* Const-correctness.
* Inlined and improved a couple of trivial functions (that are called
often).
* Reduced some logs from INF to DBG as they are only meaningful to devs.

Change-Id: I1c4eb8c63da49aa061afbf3eb68cae23d4d5e7f3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98661
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-07-14 15:35:20 +02:00
Tomaž Vajngerl
08d81615e7 add .uno:EditAnnotation as exception when in read-only mode
Change-Id: Ic6cd15973a96d20895a1e0dc47fc33692b09ec92
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98589
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-07-12 19:11:06 +02:00
Dennis Francis
d1b3f4c6af wsd/kit: use splitx/splity in clientvisiblearea message...
to filter tile-invalidation messages, so that the client gets
invalidations/new tiles for all split panes.

Change-Id: Ifacc452ed6bb43dfd36ff16386fb4a547ec8302b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98362
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
2020-07-08 17:18:33 +02:00
Tor Lillqvist
d0672cd2b9 Slight refactoring to make planned re-plumbing of iOS app easier
Change-Id: I274cf167c6593de6f073301f7071f2173b40cbab
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97760
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-03 08:41:02 +02:00
Samuel Mehrbrodt
9f8fdb7bd7 tdf#131123 Report back real save result
665b1629de was not correct, as it reported back
the save result of the internal save (which usually succeeds).
Instead we want to know the save result of the remote storage (WOPI/Webdav).
So report that back instead.

Change-Id: Iaaa42b8c817a19c2c77935a6f81c1951fdf2216c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97637
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-07-01 17:57:53 +02:00
Ashod Nakashian
a77208ddfb wsd: prefer emplace_back where possible
emplace_back avoids copy-construction when
the argument is a temporary instance created
at call-site.

Change-Id: I127fddd308d710af9ea65a86db1b03347e9c3d87
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96829
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 07:40:54 +02:00
Ashod Nakashian
fa96934861 wsd: Authorization parsing and creation improvements
Authorization class now handles the parsing and creation
of its instances, which makes it centralized.

We also avoid repeatedly constructing Authorization objects
in ClientSession and instead do it once at construction
and cache it.

A bunch of new unit-tests added.

Change-Id: I9b5939be51a5957214d07ed8f1096efd179686c6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96825
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 07:33:57 +02:00
Ashod Nakashian
4a57654d88 wsd: avoid unnecessary string ops
Change-Id: Ia5a6f2d7a260edaf8bb294693be12a434a2c30fe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96376
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-23 06:41:58 +02:00
Michael Meeks
714640993b Remember to shutdown the socket after serving files.
re-factor to make it hard not to.

Change-Id: I26ebc48b4660276ede64a22167ac4779cebf5cd4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95440
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-06-03 18:15:33 +02:00
Ashod Nakashian
4a8937d0d1 wsd: performance improvements
Change-Id: I137dc67b4231df1cd23a9dce72e6b12dc1bf364e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95343
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 20:01:39 +02:00
Ashod Nakashian
d2d0492245 wsd: move LOOLProtocol::tokenize to Util::tokenize
The tokenizer(s) are more generic than the protocol
logic, and are used from contexts that don't involve
the protocol as such.

Change-Id: Ie8c256bf11a91e466bff794021f41603c9596a7f
2020-06-02 18:03:36 +01:00
Ashod Nakashian
784b7dc39d wsd: optimize StringVector
StringVector is heavily used for tokenization
and benefits from inlining of small functions.

Also, cat doesn't need to be slower than necessary.

Change-Id: I4ab2ff1b1f1a81092049d2cde64b6df10b34b5f7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95287
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
2020-06-02 01:39:37 +02:00
Ashod Nakashian
224ef08c7f wsd: single-char string literals -> char
More readable and typically more efficient.

Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-06-02 01:31:26 +02:00
Samuel Mehrbrodt
665b1629de tdf#131123 Report back save result
Change-Id: Ie3dee5d344bc65c325b95f2746c9734bdd9e2f9d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94490
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-05-29 08:39:46 +02:00
Michael Meeks
87d039e00a IO stats - handle convert-to case, and initiailize all temporaries.
Change-Id: I16c60c89745a7cc2f369a010c77cffbb08759f7b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94775
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-25 12:37:40 +02:00
Michael Meeks
e600721abe Proxy: use much more obscure session IDs.
Change-Id: I1220216b88aaa3c9a0bc58ed5bf4b20b4214d997
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94090
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-13 02:01:59 +02:00
Michael Meeks
34fc7fb6b7 Proxy: move requestDetails closer to ProxyProtocol.
Change-Id: I07c00ea1dad15fd70b658a04f722cbd516fd5c18
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94088
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-13 00:53:24 +02:00
Tamás Zolnai
75dc61da7e MSForms: send item selection event to core.
Change-Id: I10fceb66a4f8cd777c43411ddace3456a315b5a2
2020-05-09 09:54:08 +02:00
Jan Holesovsky
3cd1e0d439 function bar: Index the function by name, not by index.
Depends on a core change that changes the ABI of the completeFunction().

Change-Id: I27daf31d49347c4a308518e14a9b8b97f3b48991
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93667
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 870a7ec5620eb742bd8fb2a9680ff67101a37dd7)
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93541
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-05-08 12:03:11 +02:00
Michael Meeks
18c4301a1f Proxy: re-factor proxy handling into ServerURL and cleanup copy/paste.
Also adds ServiceRoot handling for clipboard.

Change-Id: I7bc6591130fcc7d693e59ab8561fb9e99f4e93d5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93578
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-06 23:12:12 +02:00
Jan Holesovsky
8325deaf22 nocaps: Make the convert-to work too.
And also compile out ConvertToBroker in mobile apps, it is not
needed there, otherwise it wouldn't compile due to the added check for
nocaps.

Change-Id: I20fe7e3b702e4a1782640a2d0e71a40b1517beb6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93510
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-05-05 22:56:55 +02:00
Marco Cecchetti
255d24ba8f forward the device form factor of the client on a new view request
This patch allows the lok core to know about the device form facor of
the client requesting the creation of a new view, immediately instead
of a later time.
When a request for a new view is sent a 'deviceFormFactor' parameter
is appended to the message.
This parameter can have one of the following values: 'desktop',
'tablet','mobile' and is forwarded to the lok core.

Change-Id: I21739ddb8c43c960164b3c625e4cf0a80f4616a4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92691
Tested-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
2020-04-29 13:18:49 +02:00
Ashod Nakashian
df6d942d08 wsd: harden socket weakptr
Weak pointers can be null and must be
checked before using. This fixes at least
one segfault and prevents a number of others.

Also, minimizes locking of weak pointers
in the message handlers.

Change-Id: I306501c26c3441d7bd6812d51fa17e7356126f32
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92828
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-04-24 15:39:17 +02:00
gokaysatir
9e0594ee2d add pretty name - Android patch
Change-Id: If0de49884954cde26bfbe8ba1dce8844af5b30bf
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91831
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-11 13:43:31 +02:00