[Libreoffice-commits] core.git: unotools/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu May 23 15:21:40 UTC 2019


 unotools/source/config/configmgr.cxx |   52 ++++++-----------------------------
 1 file changed, 10 insertions(+), 42 deletions(-)

New commits:
commit c2950d74b1a641ae45171143b5ea2b8acd4b0169
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu May 23 13:44:10 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu May 23 17:20:32 2019 +0200

    Make utl::ConfigManager::get* use direct C++ config access internally
    
    But some of those functions' names may be more telling than their configuration
    property counterparts, so there may be merit in keeping those trivial wrapper
    functions around.
    
    Change-Id: Ibbf4965fcefd58649920fad964b4a8d2108deaca
    Reviewed-on: https://gerrit.libreoffice.org/72836
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index 05b1e5874643..610246295d55 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <i18nlangtag/languagetag.hxx>
+#include <officecfg/Setup.hxx>
 #include <rtl/instance.hxx>
 #include <rtl/ustring.hxx>
 #include <sal/log.hxx>
@@ -66,21 +67,6 @@ getConfigurationProvider() {
     return css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() );
 }
 
-OUString getConfigurationString(OUString const & module, OUString const & path)
-{
-    css::uno::Sequence< css::uno::Any > args(1);
-    args[0] <<= css::beans::NamedValue(
-        "nodepath",
-        css::uno::makeAny(module));
-    return
-        css::uno::Reference< css::container::XHierarchicalNameAccess >(
-            getConfigurationProvider()->createInstanceWithArguments(
-                "com.sun.star.configuration.ConfigurationAccess",
-                args),
-            css::uno::UNO_QUERY_THROW)->
-        getByHierarchicalName(path).get< OUString >();
-}
-
 struct theConfigManager:
     public rtl::Static< utl::ConfigManager, theConfigManager >
 {};
@@ -88,57 +74,39 @@ struct theConfigManager:
 }
 
 OUString utl::ConfigManager::getAboutBoxProductVersion() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "Product/ooSetupVersionAboutBox");
+    return officecfg::Setup::Product::ooSetupVersionAboutBox::get();
 }
 
 OUString utl::ConfigManager::getAboutBoxProductVersionSuffix() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "Product/ooSetupVersionAboutBoxSuffix");
+    return officecfg::Setup::Product::ooSetupVersionAboutBoxSuffix::get();
 }
 
 OUString utl::ConfigManager::getDefaultCurrency() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "L10N/ooSetupCurrency");
+    return officecfg::Setup::L10N::ooSetupCurrency::get();
 }
 
 OUString utl::ConfigManager::getUILocale() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "L10N/ooLocale");
+    return officecfg::Setup::L10N::ooLocale::get();
 }
 
 OUString utl::ConfigManager::getWorkLocale() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "L10N/ooSetupSystemLocale");
+    return officecfg::Setup::L10N::ooSetupSystemLocale::get();
 }
 
 OUString utl::ConfigManager::getProductExtension() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "Product/ooSetupExtension");
+    return officecfg::Setup::Product::ooSetupExtension::get();
 }
 
 OUString utl::ConfigManager::getProductName() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "Product/ooName");
+    return officecfg::Setup::Product::ooName::get();
 }
 
 OUString utl::ConfigManager::getProductVersion() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "Product/ooSetupVersion");
+    return officecfg::Setup::Product::ooSetupVersion::get();
 }
 
 OUString utl::ConfigManager::getVendor() {
-    return getConfigurationString(
-        "/org.openoffice.Setup",
-        "Product/ooVendor");
+    return officecfg::Setup::Product::ooVendor::get();
 }
 
 void utl::ConfigManager::storeConfigItems() {


More information about the Libreoffice-commits mailing list