Commit graph

34 commits

Author SHA1 Message Date
Skyler Grey
f9c3447061 fix(prefs): Use strings for ui_defaults values
Previously we converted some ui_defaults values to booleans.
Unfortunately, when we save similar preferences to LocalStorage, we can
only save them as strings. To make sure code doesn't get booleans when
it's expecting everything to be a string, let's only send strings back
in our ui_defaults json

A nice followup to this might be to continue standardizing ui_defaults
transformation code on the server side so that its use is minimal (e.g.
uiMode, uiTheme variables), however an overhaul of server-side
ui_defaults was deemed to risky for now

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I35ce175bf38da40361efd6f246264d0733e975e9
2024-06-07 09:02:34 +00:00
Michael Meeks
1b6af5e28d killpoco: remove lots of redundant JSON includes.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I976c5b8d6763cbbf0ee5cadfa2f7335ec719fe85
2024-04-25 09:06:13 +02:00
Ashod Nakashian
f034709b69 wsd: include cleanup
Change-Id: I9e63d673b25ac29f8070a81b35e5def96d6a165f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
ccb29243c6 wsd: move stringifyBoolFromConfig to anonymous namespace
This is an internal helper and doesn't need
to pollute widely used headers, especially
that it pulls Poco headers with it.

Change-Id: I67a5aa64589d3f37141aff612f7fb807bb190d6f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
21b0394828 wsd: better empty string operations
Change-Id: Ic14efcaa8a1c345b875c27446b16f51740c55efa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 18:41:49 +00:00
Aron Budea
3b8f3d07f6 Replace Util::startsWith/endsWith w/ C++20 equivalent
Replace a few cases of Util::toString(...), too.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I53c5dbbdf2f60710e94add9dd137aa9becb7bd3e
2024-02-22 08:08:32 +01:00
Ashod Nakashian
f8944385fb wsd: new Substitute helper for PreProcessedFile
And enable the round-trip test.

Change-Id: If9a54959514a31f9459e8596b2a4e3847465f1b9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
d7cbe7488b wsd: improved PreProcessedFile with SegmentType
Change-Id: I34609ae855ebbef395d13c4f77885dd6012685f2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
74a8f61586 wsd: better PreProcessedFile and new disabled test
Change-Id: I30a7698c54913f8eeef9a1e02cabaebd907cb7e3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
78f5b70695 wsd: new PreProcessedFile class
This class will be responsible for faster
variable replacement to serve the templates.

Change-Id: Ic0d75b0a197c0db75c0988c3b6af400a5b1c35a2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Michael Meeks
7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Skyler Grey
ff1e4eeb57 Add a ui_defaults hint for touchscreens
At the moment, we try to detect whether the browser is running with a
touchscreen, however this is very imperfect. It's possible an integrator
may have more information about whether COOL is running on a device with
a touchscreen, so this ui_defaults option allows us to specify. Touch
mode binds inputs for touchscreen devices (long press for menu, pinch to
zoom, etc.) and does not bind the normal inputs (right click for menu,
etc.), so it's crucial to get it on all touch devices and no desktop
devices, as input is severely hampered if they are the wrong way round.

The option is called TouchscreenHint. Setting it to 'true' will enable
touchscreen mode, setting it to 'false' will disable touchscreen mode.
Leaving it undefined will keep our detection active.

This option must be set at page load so we can register the right
events at creation time. Therefore, ui_defaults is perfect as a method
to override this.

This is not a long-term solution. Instead, "The right thing" is to look
specifically for touch events and specifically for mouse events, rather
than using the default hammer.js behavior which is to look for both...
that should be an eventual followup to this. However, this was a lot
faster to implement and helps with the most pressing issue: not being
able to override our detection when it goes wrong.

Change-Id: Id28a156fe352fe6565ce6b472b7aa54d0869c48e
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
2023-11-10 23:20:22 +00:00
Andras Timar
23574cd6b6 missing continue keyword
Caused log ERR on startup:
[ websrv_poll ] ERR  unknown UI default's component UITheme| wsd/FileServerUtil.cpp:99

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I82f036e393cfb271e2dec2c52c5dc512aed265c8
2023-11-09 13:36:45 +01:00
Hubert Figuière
00050a59c2 browser: Add ui_default to hide the toolbar
Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I189224581451c9f5d534593696b060c8efb23414
2023-11-08 23:34:17 +00:00
Skyler Grey
7175c7841b Add a ui_defaults option for onscreen keyboards
The new ui_defaults option OnscreenKeyboardHint is a tristate denoting
whether the device accessing Collabora Online has an onscreen keyboard

If unset, Collabora Online will do its best to guess. At time of
writing, this is the same as checking if the device is a mobile phone
or a tablet (note: only tablets which have the browser registered as a
"mobile" browser will be detected, e.g. the Microsoft Surface tablets
would not be detected)

If "true", Collabora will assume the device has an onscreen keyboard.
This will change when we trigger the keyboard, for example in calc if we
know of an onscreen keyboard we will not automatically focus a cell for
editing when it is selected, as this would pop up the keyboard.

If "false", Collabora will assume the device does not have an onscreen
keyboard, effectively doing the inverse of the "true" option above.

This is a followup to #7580 (0bf054c9a3)
which had Hint_OnscreenKeyboard and Hint_NoOnscreenKeyboard as
postmessage IDs to do the same thing.

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I5deeb87a410c135d4cabda7ed24dc37e791800cd
2023-11-08 16:20:49 +00:00
Hubert Figuière
1114af585a default-ui: Allow skipping the UI state saved in local storage.
Pass SavedUIState=false to the ui_defaults

Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I2cceffed338440d1fee5b0818e072ecc02379468
2023-11-08 10:12:42 -05:00
Michael Meeks
47b89b32ef spdx: improve machine and human readability of headers.
Change-Id: I1b6dcd2ec1fbef6556d70b8af3ccfd5d6a95c59a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-10-31 10:33:07 +00:00
Julius Härtl
752cde163e feat: Add UITheme option for light/dark to ui_defaults
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Change-Id: Ief028dcec0daa2ae448f83df993e0e5ade594a7c
2023-06-01 09:49:08 +02:00
Rash419
6cc2dc2c98 overriding checkfileinfo using hidden input field
wopi host can add following input field to their html to override checkfileinfo, right now only
DownloadAsPostMessage is supported
<input name="checkfileinfo_override" value="DownloadAsPostMessage=true" type="hidden"/>
This can be usefull when same html is used to load collabora online in both desktop browser and mobile webview

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8ff122f2824694d451724a832d992e08161fb448
2022-10-11 11:34:29 +02:00
Mert Tumer
c74ee86262 added option to group save-as
We can provide doctype extensions for save-as much like downloadAs
but this will load the new file in the integration. instead of downloading

To achive this, args: {format: '<extension>' } parameter needs to be
sent inside UI_SaveAs postmessage. Because the integration provides
dialog with filename, there the extension will be set after the
filename. Our save-as work flow already handles the rest.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I6005846047fc0b26ea07e8eeea965965ed1b87e7
2022-09-19 10:56:08 +02:00
Rash419
0945c4d48b config,UI: change classic -> compact and notebookbar -> tabbed
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I633a13927245ee6b4d750cd84c2b4577dca06d68
2022-04-25 13:56:10 +05:30
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Szymon Kłos
f3d2aa4be0 Use correct formatting for string variables
- when reading from config use correct type so SyntaxException
  is thrown when we type non-number into uint field
- handle SyntaxException and send 500 so user will get response
  (previously we left request without response until timeout)
- log about incorrect value in the config
- simplify repeated bool -> string conversion after config read

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I1c50de263ffdb1d97eb9381754bc7cf3bd05dbfa
2021-12-11 21:58:34 +01:00
Julius Härtl
570c31d1a1 wsd: Allow to pass ui defaults for drawings
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Change-Id: Ie311ca6b7578ead6f7c7d61fe993d4ecdc9a4386
2021-10-29 16:30:43 +02:00
Hugo Peixoto
b2abb5e4aa Use tokens.equals() instead of tokens[] ==
This prevents additional strings from being allocated.

Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
Change-Id: I84b1e5cf4d11bf8512febe068b3097770b63dc5c
2021-10-21 13:36:57 +02:00
Hugo Peixoto
7bf0ead625 Optimize startsWith calls on StringVector elements
There was a pattern of calling Util::startsWith on StringVector
elements:

- Util::startsWith(tokens[0], "boo")
- Util::startsWith(tokens.getParam(token), "boo")

These two expressions would cause a new string to be allocated and
immediately released. To optimize this, a StringVector::startsWith
method is introduced.

This method works by calling compare directly on the underlying
StringVector string, avoiding creating a temporary string.

Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
Change-Id: I6f27d5bb13783f39c7d4ce0644a11e57b0071244
2021-10-15 13:58:26 +02:00
Jan Holesovsky
41c0b1add3 Sanitize the css theming.
Change-Id: Id0eb21fc7e7039bf406c074cd210c6c355bd7dbf
Signed-off-by: Andras Timar <andras.timar@collabora.com>

Sanitize the css theming.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ifccb58c2bc9a070409c9a4dd9e9e4034e7338469
2021-07-16 11:57:43 +02:00
Henry Castro
41a7767c86 wsd: revisit log messages FileServerUtil.cpp
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: I1f6708c566fc69edc76e7c0d32625f6b1f4b3af4
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-23 21:35:14 -05:00
Ashod Nakashian
583c627a66 wsd: avoid single-character strings
Change-Id: I709e8e797bc5e68984823d8c46c590e109d23f18
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00
Ashod Nakashian
8298fdb2d6 wsd: cosmetic and consts
Change-Id: Ibb4bb7c527f68786bd6288b407008a3e3a7b2e17
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00
Gabriel Masei
99c9ac1723 wsd: allow different UI mode for different views
Signed-off-by: Gabriel Masei <gabriel.masei@1and1.ro>
Change-Id: Icad28de7a75a6392cafb4fd3385e564616ece499
2020-12-09 15:46:24 +01:00
mert
ffaf53d3ef Make Themeing related CSS vars UI Configurable
Change-Id: If6e4096dc37573ff116f218ceb4ca14135820ff7
Signed-off-by: mert <mert.tumer@collabora.com>
2020-10-30 11:20:00 +01:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Jan Holesovsky
4ad8773821 Make various bits of the UI configurable.
This adds the infrastructure to be able to pass the info which elements
like the statusbar / ruler / sidebar are supposed to be shown or hidden
on startup of the editor.

Change-Id: I188264dec6961074444934ff5fd7088e23b170d4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103169
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
2020-09-28 11:53:16 +02:00