[Libreoffice-commits] online.git: configure.ac loleaflet/html loleaflet/src loolwsd.xml.in wsd/FileServer.cpp wsd/LOOLWSD.cpp

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 30 06:16:45 UTC 2020


 configure.ac                               |    4 ++++
 loleaflet/html/loleaflet.html.m4           |    1 +
 loleaflet/src/control/Control.UIManager.js |    9 ++++++---
 loolwsd.xml.in                             |    4 ++++
 wsd/FileServer.cpp                         |    3 +++
 wsd/LOOLWSD.cpp                            |    3 ++-
 6 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 3141bf777508852bf9b23f1707c7b2f62715dc15
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Apr 21 13:20:41 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 30 08:16:25 2020 +0200

    notebookbar: Introduce switch in loolwsd.xml
    
    Change-Id: I94546a899fde1cecc2c35dc527e41e8a36061750
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93050
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/configure.ac b/configure.ac
index ace92e589..7a8177e91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -659,6 +659,10 @@ AS_IF([test "$enable_welcome_message_button" = "yes"],
 AC_DEFINE_UNQUOTED([ENABLE_WELCOME_MESSAGE_BUTTON],["$ENABLE_WELCOME_MESSAGE_BUTTON"],[Should the Release notes message on startup should have a dismiss button instead of an x button to close by default?])
 AC_SUBST(ENABLE_WELCOME_MESSAGE_BUTTON)
 
+USER_INTERFACE_MODE='classic'
+AC_DEFINE_UNQUOTED([USER_INTERFACE_MODE],["$USER_INTERFACE_MODE"],[Which user interface mode should be activated])
+AC_SUBST(USER_INTERFACE_MODE)
+
 VEREIGN_URL=
 if test "$enable_vereign" = "yes"; then
     VEREIGN_URL="https://app.vereign.com"
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index f84271e62..a596ca476 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -255,6 +255,7 @@ m4_ifelse(MOBILEAPP,[true],
       window.loleafletLogging = '%LOLEAFLET_LOGGING%';
       window.enableWelcomeMessage = %ENABLE_WELCOME_MSG%;
       window.enableWelcomeMessageButton = %ENABLE_WELCOME_MSG_BTN%;
+      window.userInterfaceMode = '%USER_INTERFACE_MODE%';
       window.outOfFocusTimeoutSecs = %OUT_OF_FOCUS_TIMEOUT_SECS%;
       window.idleTimeoutSecs = %IDLE_TIMEOUT_SECS%;
       window.reuseCookies = '%REUSE_COOKIES%';
diff --git a/loleaflet/src/control/Control.UIManager.js b/loleaflet/src/control/Control.UIManager.js
index 5cb657a25..e8ae9ea4a 100644
--- a/loleaflet/src/control/Control.UIManager.js
+++ b/loleaflet/src/control/Control.UIManager.js
@@ -15,7 +15,9 @@ L.Control.UIManager = L.Control.extend({
 	// UI initialization
 
 	initializeBasicUI: function() {
-		if (window.mode.isMobile() || !window.enableNotebookbar) {
+		var enableNotebookbar = window.userInterfaceMode === 'notebookbar';
+
+		if (window.mode.isMobile() || !enableNotebookbar) {
 			var menubar = L.control.menubar();
 			this.map.menubar = menubar;
 			this.map.addControl(menubar);
@@ -24,7 +26,7 @@ L.Control.UIManager = L.Control.extend({
 		if (window.mode.isMobile()) {
 			$('#mobile-edit-button').show();
 		} else {
-			if (!window.enableNotebookbar) {
+			if (!enableNotebookbar) {
 				this.map.addControl(L.control.topToolbar());
 			}
 
@@ -60,12 +62,13 @@ L.Control.UIManager = L.Control.extend({
 
 	initializeSpecializedUI: function(docType) {
 		var isDesktop = window.mode.isDesktop();
+		var enableNotebookbar = window.userInterfaceMode === 'notebookbar';
 
 		if (window.mode.isMobile()) {
 			this.map.addControl(L.control.mobileBottomBar(docType));
 			this.map.addControl(L.control.mobileTopBar(docType));
 			this.map.addControl(L.control.searchBar());
-		} else if (window.enableNotebookbar) {
+		} else if (enableNotebookbar) {
 			if (docType === 'spreadsheet') {
 				this.map.addControl(L.control.notebookbarCalc());
 			} else if (docType === 'presentation') {
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index 951b96079..e6886b084 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -132,6 +132,10 @@
       <path desc="Path to 'welcome-$lang.html' files served on first start or when the version changes. When empty, defaults to the Release notes." type="path" relative="true" default="loleaflet/welcome"></path>
     </welcome>
 
+    <user_interface>
+      <mode type="string" desc="Controls the user interface style (classic|notebookbar)" default="@USER_INTERFACE_MODE@">@USER_INTERFACE_MODE@</mode>
+    </user_interface>
+
     <storage desc="Backend storage">
         <filesystem allow="false" />
         <wopi desc="Allow/deny wopi storage. Mutually exclusive with webdav." allow="true">
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 61280901f..3ee9e4142 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -768,6 +768,9 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
         enableWelcomeMessageButton = "true";
     Poco::replaceInPlace(preprocess, std::string("%ENABLE_WELCOME_MSG_BTN%"), enableWelcomeMessageButton);
 
+    std::string userInterfaceMode = config.getString("user_interface.mode", "classic");
+    Poco::replaceInPlace(preprocess, std::string("%USER_INTERFACE_MODE%"), userInterfaceMode);
+
     // Capture cookies so we can optionally reuse them for the storage requests.
     {
         NameValueCollection cookies;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a51344da7..22f5d4847 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -961,7 +961,8 @@ void LOOLWSD::initialize(Application& self)
             { "trace[@enable]", "false" },
             { "welcome.enable", ENABLE_WELCOME_MESSAGE },
             { "welcome.enable_button", ENABLE_WELCOME_MESSAGE_BUTTON },
-            { "welcome.path", "loleaflet/welcome" }
+            { "welcome.path", "loleaflet/welcome" },
+            { "user_interface.mode", USER_INTERFACE_MODE }
           };
 
     // Set default values, in case they are missing from the config file.


More information about the Libreoffice-commits mailing list