[Libreoffice-commits] online.git: android/lib ios/Mobile kit/ForKit.cpp kit/Kit.cpp kit/Kit.hpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp

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


 android/lib/src/main/cpp/androidapp.cpp |    2 +-
 ios/Mobile/AppDelegate.mm               |    2 +-
 kit/ForKit.cpp                          |   10 +++++++++-
 kit/Kit.cpp                             |    9 +++++++--
 kit/Kit.hpp                             |    3 ++-
 wsd/LOOLWSD.cpp                         |    9 ++++++++-
 wsd/LOOLWSD.hpp                         |    1 +
 7 files changed, 29 insertions(+), 7 deletions(-)

New commits:
commit 11965d083edd7dc0f2a1e8e872de3e79cb26ebf5
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Jun 26 12:58:09 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 30 08:15:25 2020 +0200

    notebookbar: early init
    
    - read settings from loolwsd.xml
    - in case of notebookbar activated send :notebookbar parameter
    - for mobile apps I left empty parameter in setupKitEnvironment calls
    
    Change-Id: I5813589564b37eecc1e77c5d0eb737eca5f92f04
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97233
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/android/lib/src/main/cpp/androidapp.cpp b/android/lib/src/main/cpp/androidapp.cpp
index 7570f96ca..e6a3f8a3b 100644
--- a/android/lib/src/main/cpp/androidapp.cpp
+++ b/android/lib/src/main/cpp/androidapp.cpp
@@ -45,7 +45,7 @@ JNI_OnLoad(JavaVM* vm, void*) {
         return JNI_ERR; // JNI version not supported.
     }
 
-    setupKitEnvironment();
+    setupKitEnvironment("");
 
     // Uncomment the following to see the logs from the core too
     //setenv("SAL_LOG", "+WARN+INFO", 0);
diff --git a/ios/Mobile/AppDelegate.mm b/ios/Mobile/AppDelegate.mm
index 9e5f19278..d38f04787 100644
--- a/ios/Mobile/AppDelegate.mm
+++ b/ios/Mobile/AppDelegate.mm
@@ -185,7 +185,7 @@ static void updateTemplates(NSData *data, NSURLResponse *response)
     if (!trace)
         trace = strdup("warning");
 
-    setupKitEnvironment();
+    setupKitEnvironment("");
 
     Log::initialize("Mobile", trace, false, false, {});
     Util::setThreadName("main");
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index 3a0a0811d..b69e2593b 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -52,6 +52,8 @@ static bool SingleKit = false;
 #endif
 #endif
 
+static std::string UserInterface;
+
 static bool DisplayVersion = false;
 static std::string UnitTestLibrary;
 static std::string LogLevel;
@@ -539,6 +541,12 @@ int main(int argc, char** argv)
             LOG_ERR("Security: Running without the ability to filter system calls is ill advised.");
             NoSeccomp = true;
         }
+
+        else if (std::strstr(cmd, "--ui") == cmd)
+        {
+            eq = std::strchr(cmd, '=');
+            UserInterface = std::string(eq+1);
+        }
     }
 
     if (loSubPath.empty() || sysTemplate.empty() ||
@@ -555,7 +563,7 @@ int main(int argc, char** argv)
         return EX_USAGE;
     }
 
-    setupKitEnvironment();
+    setupKitEnvironment(UserInterface);
 
     if (!std::getenv("LD_BIND_NOW")) // must be set by parent.
         LOG_INF("Note: LD_BIND_NOW is not set.");
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 7a5fc1f7a..b50ae65a4 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -2505,7 +2505,7 @@ void wakeCallback(void* pData)
 #endif
 }
 
-void setupKitEnvironment()
+void setupKitEnvironment(const std::string& userInterface)
 {
     // Setup & check environment
     const std::string layers(
@@ -2536,6 +2536,10 @@ void setupKitEnvironment()
     if (Log::logger().trace())
         options += ":profile_events";
 #endif
+
+    if (userInterface == "notebookbar")
+        options += ":notebookbar";
+
 //    options += ":sc_no_grid_bg"; // leave this disabled for now, merged-cells needs more work.
     ::setenv("SAL_LOK_OPTIONS", options.c_str(), 0);
 }
@@ -2555,6 +2559,7 @@ void lokit_main(
                 bool displayVersion,
 #else
                 int docBrokerSocket,
+                const std::string& userInterface,
 #endif
                 size_t numericIdentifier
                 )
@@ -2818,7 +2823,7 @@ void lokit_main(
 #ifndef IOS
         // Was not done by the preload.
         // For iOS we call it in -[AppDelegate application: didFinishLaunchingWithOptions:]
-        setupKitEnvironment();
+        setupKitEnvironment(userInterface);
 #endif
 
 #if defined(__linux) && !defined(__ANDROID__)
diff --git a/kit/Kit.hpp b/kit/Kit.hpp
index a5c6332b8..06a03034d 100644
--- a/kit/Kit.hpp
+++ b/kit/Kit.hpp
@@ -38,6 +38,7 @@ void lokit_main(
                 bool displayVersion,
 #else
                 int docBrokerSocket,
+                const std::string& userInterface,
 #endif
                 size_t numericIdentifier
                 );
@@ -47,7 +48,7 @@ void runKitLoopInAThread();
 #endif
 
 /// We need to get several env. vars right
-void setupKitEnvironment();
+void setupKitEnvironment(const std::string& userInterface);
 
 bool globalPreinit(const std::string& loTemplate);
 /// Wrapper around private Document::ViewCallback().
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 8cdf9974a..a51344da7 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -531,7 +531,7 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks(unsigned mobileAppDocId)
 #endif
                     // Ugly to have that static global LOOLWSD::prisonerServerSocketFD, Otoh we know
                     // there is just one LOOLWSD object. (Even in real Online.)
-                    lokit_main(LOOLWSD::prisonerServerSocketFD, mobileAppDocId);
+                    lokit_main(LOOLWSD::prisonerServerSocketFD, LOOLWSD::UserInterface, mobileAppDocId);
                 }).detach();
 #endif
 
@@ -728,6 +728,7 @@ std::string LOOLWSD::HostIdentifier;
 std::string LOOLWSD::ConfigFile = LOOLWSD_CONFIGDIR "/loolwsd.xml";
 std::string LOOLWSD::ConfigDir = LOOLWSD_CONFIGDIR "/conf.d";
 std::string LOOLWSD::LogLevel = "trace";
+std::string LOOLWSD::UserInterface = "classic";
 bool LOOLWSD::AnonymizeUserData = false;
 bool LOOLWSD::CheckLoolUser = true;
 bool LOOLWSD::IsProxyPrefixEnabled = false;
@@ -999,6 +1000,9 @@ void LOOLWSD::initialize(Application& self)
     // Allow UT to manipulate before using configuration values.
     UnitWSD::get().configure(config());
 
+    // Setup user interface mode
+    UserInterface = getConfigValue<std::string>(conf, "user_interface.mode", "classic");
+
     // Set the log-level after complete initialization to force maximum details at startup.
     LogLevel = getConfigValue<std::string>(conf, "logging.level", "trace");
     setenv("LOOL_LOGLEVEL", LogLevel.c_str(), true);
@@ -1790,6 +1794,8 @@ bool LOOLWSD::createForKit()
     if (NoSeccomp)
         args.push_back("--noseccomp");
 
+    args.push_back("--ui=" + UserInterface);
+
     if (!CheckLoolUser)
         args.push_back("--disable-lool-user-checking");
 
@@ -3493,6 +3499,7 @@ public:
            << "\n  CheckLoolUser: " << (LOOLWSD::CheckLoolUser ? "yes" : "no")
            << "\n  IsProxyPrefixEnabled: " << (LOOLWSD::IsProxyPrefixEnabled ? "yes" : "no")
            << "\n  OverrideWatermark: " << LOOLWSD::OverrideWatermark
+           << "\n  UserInterface: " << LOOLWSD::UserInterface
             ;
 
         os << "\nServer poll:\n";
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 54d63962f..bbc6bc430 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -230,6 +230,7 @@ public:
     static bool DummyLOK;
     static std::string FuzzFileName;
 #endif
+    static std::string UserInterface;
     static std::string ConfigFile;
     static std::string ConfigDir;
     static std::string SysTemplate;


More information about the Libreoffice-commits mailing list