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 <sbergman@redhat.com>
This commit is contained in:
Dhiraj Holden 2022-01-17 10:30:14 -05:00 committed by Stephan Bergmann
parent 8ca549ebc0
commit cf0b49af54
2 changed files with 12 additions and 21 deletions

View file

@ -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,\

View file

@ -11,14 +11,12 @@
#include <com/sun/star/beans/Optional.hpp>
#include <comphelper/base64.hxx>
#include <comphelper/configurationhelper.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <comphelper/configuration.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <map>
#include <o3tl/char16_t2wchar_t.hxx>
#include <tools/diagnose_ex.h>
#include <officecfg/UserProfile.hxx>
#include <Iads.h>
#include <Adshlp.h>
@ -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<css::container::XNameReplace> xNameReplace(
xIface, css::uno::UNO_QUERY_THROW);
xNameReplace->replaceByName("Cache", css::uno::makeAny(sOutBuf.makeStringAndClear()));
css::uno::Reference<css::util::XChangesBatch> xChangesBatch(xIface,
css::uno::UNO_QUERY_THROW);
xChangesBatch->commitChanges();
std::shared_ptr<comphelper::ConfigurationChanges> 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<css::container::XNameAccess> 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();