summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-06-15 19:40:06 +0500
committerXisco Fauli <xiscofauli@libreoffice.org>2024-06-17 14:15:05 +0200
commit7de85014812ae6b3fdcd5c846ea097728fd9bcab (patch)
tree2d3f85de5c816889bcfe9332270609b8822c9324 /vcl
parentfc12c5f452f47cba64b585f5487ed4e120e849dc (diff)
Simplify a bit using newer registry API
Change-Id: I0bd2a238662e1da0c62cdaec96b9892df82298f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168909 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168991
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/window/salframe.cxx41
1 files changed, 13 insertions, 28 deletions
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 288b561970f0..ebcb85f55cff 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2652,22 +2652,15 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aMouseSettings.SetStartDragWidth( nDragWidth );
if ( nDragHeight )
aMouseSettings.SetStartDragHeight( nDragHeight );
- HKEY hRegKey;
- if ( RegOpenKeyW( HKEY_CURRENT_USER,
- L"Control Panel\\Desktop",
- &hRegKey ) == ERROR_SUCCESS )
{
wchar_t aValueBuf[10];
DWORD nValueSize = sizeof( aValueBuf );
- DWORD nType;
- if ( RegQueryValueExW( hRegKey, L"MenuShowDelay", nullptr,
- &nType, reinterpret_cast<LPBYTE>(aValueBuf), &nValueSize ) == ERROR_SUCCESS )
+ if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"MenuShowDelay",
+ RRF_RT_REG_SZ, nullptr, reinterpret_cast<LPVOID>(aValueBuf), &nValueSize)
+ == ERROR_SUCCESS)
{
- if ( nType == REG_SZ )
- aMouseSettings.SetMenuDelay( static_cast<sal_uLong>(ImplW2I( aValueBuf )) );
+ aMouseSettings.SetMenuDelay( static_cast<sal_uLong>(ImplW2I( aValueBuf )) );
}
-
- RegCloseKey( hRegKey );
}
StyleSettings aStyleSettings = rSettings.GetStyleSettings();
@@ -2949,30 +2942,22 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetDragFullOptions( nDragFullOptions );
}
- if ( RegOpenKeyW( HKEY_CURRENT_USER,
- L"Control Panel\\International\\Calendars\\TwoDigitYearMax",
- &hRegKey ) == ERROR_SUCCESS )
{
wchar_t aValueBuf[10];
- DWORD nValue;
DWORD nValueSize = sizeof( aValueBuf );
- DWORD nType;
- if ( RegQueryValueExW( hRegKey, L"1", nullptr,
- &nType, reinterpret_cast<LPBYTE>(aValueBuf), &nValueSize ) == ERROR_SUCCESS )
+ if (RegGetValueW(HKEY_CURRENT_USER,
+ L"Control Panel\\International\\Calendars\\TwoDigitYearMax", L"1",
+ RRF_RT_REG_SZ, nullptr, reinterpret_cast<LPVOID>(aValueBuf), &nValueSize)
+ == ERROR_SUCCESS)
{
- if ( nType == REG_SZ )
+ DWORD nValue = static_cast<sal_uLong>(ImplW2I(aValueBuf));
+ if ((nValue > 1000) && (nValue < 10000))
{
- nValue = static_cast<sal_uLong>(ImplW2I( aValueBuf ));
- if ( (nValue > 1000) && (nValue < 10000) )
- {
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::DateFormat::TwoDigitYear::set(static_cast<sal_Int32>(nValue-99), batch);
- batch->commit();
- }
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::DateFormat::TwoDigitYear::set(static_cast<sal_Int32>(nValue-99), batch);
+ batch->commit();
}
}
-
- RegCloseKey( hRegKey );
}
rSettings.SetMouseSettings( aMouseSettings );