diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2023-10-12 11:03:26 +0300 |
---|---|---|
committer | pedropintosilva <65948705+pedropintosilva@users.noreply.github.com> | 2023-10-20 06:39:18 +0200 |
commit | 81c2f163028552f7ef1f0be0c8b13242992da507 (patch) | |
tree | fba2cd1138ebffefd0ca0d9b4f9e3cc200a636b3 | |
parent | we can remove this unconditional wait by conditionally waiting for enabled state (diff) | |
download | online-81c2f163028552f7ef1f0be0c8b13242992da507.tar.gz online-81c2f163028552f7ef1f0be0c8b13242992da507.zip |
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>
-rw-r--r-- | coolwsd.xml.in | 4 | ||||
-rw-r--r-- | kit/ChildSession.cpp | 8 | ||||
-rw-r--r-- | wsd/COOLWSD.cpp | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/coolwsd.xml.in b/coolwsd.xml.in index 936e233c5e..4851488f65 100644 --- a/coolwsd.xml.in +++ b/coolwsd.xml.in @@ -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> diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index af24c16d7f..67f9cab644 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -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); diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index 043ec03d29..01ef078604 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -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" }, |