Skip to content

Commit

Permalink
Add a value "default" for the user interface
Browse files Browse the repository at this point in the history
To be able to override it by a new package version, if necessary.

Also, when explicitly configuring the "classic" or "notebookbar", make
it override what is provide in UiMode.

Signed-off-by: Jan Holesovsky <[email protected]>
Change-Id: I4b9764b32ce712d8bfd46ef90d9c8538fcaf921b
  • Loading branch information
kendy authored and mmeeks committed Nov 19, 2021
1 parent 14d28ca commit b4f588e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion coolwsd.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
</welcome>

<user_interface>
<mode type="string" desc="Controls the user interface style (classic|notebookbar)" default="notebookbar">notebookbar</mode>
<mode type="string" desc="Controls the user interface style. The 'default' means: Take the value from ui_defaults, or decide for one of classic or notebookbar (default|classic|notebookbar)" default="default">default</mode>
</user_interface>

<storage desc="Backend storage">
Expand Down
6 changes: 3 additions & 3 deletions wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ FILE *COOLWSD::TraceEventFile = NULL;
std::string COOLWSD::LogLevel = "trace";
std::string COOLWSD::MostVerboseLogLevelSettableFromClient = "notice";
std::string COOLWSD::LeastVerboseLogLevelSettableFromClient = "fatal";
std::string COOLWSD::UserInterface = "classic";
std::string COOLWSD::UserInterface = "default";
bool COOLWSD::AnonymizeUserData = false;
bool COOLWSD::CheckCoolUser = true;
bool COOLWSD::CleanupOnly = false; //< If we should cleanup and exit.
Expand Down Expand Up @@ -1135,7 +1135,7 @@ void COOLWSD::innerInitialize(Application& self)
#ifdef ENABLE_FEATURE_RESTRICTION
{ "restricted_commands", "" },
#endif
{ "user_interface.mode", "notebookbar" },
{ "user_interface.mode", "default" },
{ "quarantine_files[@enable]", "false" },
{ "quarantine_files.limit_dir_size_mb", "250" },
{ "quarantine_files.max_versions_to_maintain", "2" },
Expand Down Expand Up @@ -1180,7 +1180,7 @@ void COOLWSD::innerInitialize(Application& self)
UnitWSD::get().configure(config());

// Setup user interface mode
UserInterface = getConfigValue<std::string>(conf, "user_interface.mode", "classic");
UserInterface = getConfigValue<std::string>(conf, "user_interface.mode", "default");

// Set the log-level after complete initialization to force maximum details at startup.
LogLevel = getConfigValue<std::string>(conf, "logging.level", "trace");
Expand Down
13 changes: 11 additions & 2 deletions wsd/FileServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,17 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
enableWelcomeMessageButton = "true";
Poco::replaceInPlace(preprocess, std::string("%ENABLE_WELCOME_MSG_BTN%"), enableWelcomeMessageButton);

if (userInterfaceMode.empty())
userInterfaceMode = config.getString("user_interface.mode", "classic");
// the config value of 'notebookbar' or 'classic' overrides the UIMode
// from the WOPI
std::string userInterfaceModeConfig = config.getString("user_interface.mode", "default");
if (userInterfaceModeConfig == "classic" || userInterfaceModeConfig == "notebookbar" || userInterfaceMode.empty())
userInterfaceMode = userInterfaceModeConfig;

// default to the notebookbar if the value is "default" or whatever
// nonsensical
if (userInterfaceMode != "classic" && userInterfaceMode != "notebookbar")
userInterfaceMode = "notebookbar";

Poco::replaceInPlace(preprocess, std::string("%USER_INTERFACE_MODE%"), userInterfaceMode);

std::string enableMacrosExecution = "false";
Expand Down

0 comments on commit b4f588e

Please sign in to comment.