libreoffice-online/common/ConfigUtil.cpp
Rash419 9bb0b6fabd introduce new options to customize featurelock dialog
- adds two new options
1. localize the dialog
2. change upsell image shown in dialog using proxy handler
- provides all the settings using dynamic configuration

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I7e21c1b31c806c88bf54f891de40f02fa342168f
2022-07-20 17:41:19 +05:30

69 lines
1.6 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <config.h>
#include <ConfigUtil.hpp>
#include <Util.hpp>
#include <cassert>
#include <string>
#include <sstream>
#include <Poco/Util/AbstractConfiguration.h>
#include <Poco/Util/XMLConfiguration.h>
namespace config
{
static Poco::AutoPtr<Poco::Util::XMLConfiguration> XmlConfig;
static const Poco::Util::AbstractConfiguration* Config{ 0 };
void initialize(const Poco::Util::AbstractConfiguration* config)
{
assert(!Config && "Config is already initialized.");
Config = config;
}
void initialize(const std::string& xml)
{
std::istringstream iss(xml);
XmlConfig.reset(new Poco::Util::XMLConfiguration(iss));
initialize(XmlConfig);
}
bool isInitialized()
{
return Config;
}
std::string getString(const std::string& key, const std::string& def)
{
assert(Config && "Config is not initialized.");
return Config ? Config->getString(key, def) : def;
}
bool getBool(const std::string& key, const bool def)
{
assert(Config && "Config is not initialized.");
return Config ? Config->getBool(key, def) : def;
}
bool has(const std::string& key)
{
assert(Config && "Config is not initialized.");
return Config ? Config->has(key) : false;
}
bool isSslEnabled()
{
#if ENABLE_SSL
return !Util::isFuzzing() && getBool("ssl.enable", true);
#else
return false;
#endif
}
} // namespace config