coolwsd.xml.in: Add possibility to disable overwrite mode

It seems large groups of people don't have a use for overwrite mode
- Would like to avoid enable it by default

This is just the first step on improving the user experience here.

------

The whole plan would be to:
- 1st Follow up PR
  - Where we disable the overwrite mode when enableExperimental is true
  this we will be able to see if community likes that change or not before making it everywhere
- Other possible improvements
  - Triger a snackbar for the first time the user press the Insert key
    - If the feature is disabled we would show snackbar with timeout
      "Overwrite is disabled. Please contact admin."[Dismiss]
    - If the feature is enabled we would show snackbar with timeout
      "Overwrite mode is now enabled" [Disable] (Disable here means the same action as pressing again the **Insert** does)

Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com>
Change-Id: I060b3d2d9d1e7e29a18f5ea1d619c9349eae67c3
Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
pull/7497/head
Gülşah Köse 2023-10-12 11:03:26 +03:00 committed by pedropintosilva
parent 7d37ba6a41
commit 81c2f16302
3 changed files with 13 additions and 0 deletions

View File

@ -304,4 +304,8 @@
<help_url desc="The Help root URL, or empty for no help (hides the Help buttons)" type="string" default="@HELP_URL@">@HELP_URL@</help_url>
<overwrite_mode>
<enable desc="Enable overwrite mode (user can use insert key)" type="bool" default="true">true</enable>
</overwrite_mode>
</config>

View File

@ -1485,6 +1485,7 @@ bool ChildSession::keyEvent(const StringVector& tokens,
// Don't close LO window!
constexpr int KEY_CTRL = 0x2000;
constexpr int KEY_W = 0x0216;
constexpr int KEY_INSERT = 0x0505;
if (keycode == (KEY_CTRL | KEY_W))
{
return true;
@ -1500,7 +1501,14 @@ bool ChildSession::keyEvent(const StringVector& tokens,
getLOKitDocument()->setView(_viewId);
if (target == LokEventTargetEnum::Document)
{
// Check if override mode is disabled.
if (type == LOK_KEYEVENT_KEYINPUT && charcode == 0 && keycode == KEY_INSERT &&
!config::getBool("overwrite_mode.enable", true))
return true;
getLOKitDocument()->postKeyEvent(type, charcode, keycode);
}
else if (winId != 0)
getLOKitDocument()->postWindowKeyEvent(winId, type, charcode, keycode);

View File

@ -2166,6 +2166,7 @@ void COOLWSD::innerInitialize(Application& self)
{ "welcome.enable", "false" },
{ "home_mode.enable", "false" },
{ "feedback.show", "true" },
{ "overwrite_mode.enable", "true" },
#if ENABLE_FEATURE_LOCK
{ "feature_lock.locked_hosts[@allow]", "false" },
{ "feature_lock.locked_hosts.fallback[@read_only]", "false" },