From cf0b49af5464507a269b03900b29e3cba155ce2b Mon Sep 17 00:00:00 2001 From: Dhiraj Holden Date: Mon, 17 Jan 2022 10:30:14 -0500 Subject: [PATCH] tdf#46037 remove configurationhelper from WinUserInfoBe Change-Id: I7d23fe4f32c3b67304103ca88a757529ba4faa09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128508 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- extensions/Library_WinUserInfoBe.mk | 4 +++ .../config/WinUserInfo/WinUserInfoBe.cxx | 29 +++++-------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/extensions/Library_WinUserInfoBe.mk b/extensions/Library_WinUserInfoBe.mk index 3d5932f3b279..3e20e09419af 100644 --- a/extensions/Library_WinUserInfoBe.mk +++ b/extensions/Library_WinUserInfoBe.mk @@ -13,6 +13,10 @@ $(eval $(call gb_Library_Library,WinUserInfoBe)) $(eval $(call gb_Library_set_componentfile,WinUserInfoBe,extensions/source/config/WinUserInfo/WinUserInfoBe,services)) +$(eval $(call gb_Library_use_custom_headers,WinUserInfoBe,\ + officecfg/registry \ +)) + $(eval $(call gb_Library_use_sdk_api,WinUserInfoBe)) $(eval $(call gb_Library_add_exception_objects,WinUserInfoBe,\ diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx index ce4d147220c2..e62068f17b04 100644 --- a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx +++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx @@ -11,14 +11,12 @@ #include #include -#include -#include -#include -#include +#include #include #include #include #include +#include #include #include @@ -213,16 +211,10 @@ private: OUStringBuffer sOutBuf; comphelper::Base64::encode(sOutBuf, seqCachedData); - auto xIface = comphelper::ConfigurationHelper::openConfig( - xContext, "org.openoffice.UserProfile/WinUserInfo", - comphelper::EConfigurationModes::Standard); - css::uno::Reference xNameReplace( - xIface, css::uno::UNO_QUERY_THROW); - xNameReplace->replaceByName("Cache", css::uno::makeAny(sOutBuf.makeStringAndClear())); - - css::uno::Reference xChangesBatch(xIface, - css::uno::UNO_QUERY_THROW); - xChangesBatch->commitChanges(); + std::shared_ptr batch( + comphelper::ConfigurationChanges::create(xContext)); + officecfg::UserProfile::WinUserInfo::Cache::set(sOutBuf.makeStringAndClear(), batch); + batch->commit(); } catch (const css::uno::Exception&) { @@ -236,13 +228,8 @@ private: if (m_sUserDN.isEmpty()) throw css::uno::RuntimeException(); - auto xIface = comphelper::ConfigurationHelper::openConfig( - xContext, "org.openoffice.UserProfile/WinUserInfo", - comphelper::EConfigurationModes::ReadOnly); - css::uno::Reference xNameAccess(xIface, - css::uno::UNO_QUERY_THROW); - OUString sCache; - xNameAccess->getByName("Cache") >>= sCache; + OUString sCache = officecfg::UserProfile::WinUserInfo::Cache::get(xContext); + if (sCache.isEmpty()) throw css::uno::RuntimeException();