diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-13 08:13:16 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-13 08:07:02 +0000 |
commit | 0ae863c8ac4b712d67041e8bcf4069afbe71b494 (patch) | |
tree | 98ea45221e01e93a08c9f9c4a8ec5127edeac939 /cui/source/options | |
parent | 94d952dfbef9ab9d593491185e49ea4f5d4784c2 (diff) |
tdf#101976 cui: fix crash when setting AutoCheckEnabled and it is read-only
With instdir/share/registry/data/registrymodifications.xcu being:
<?xml version="1.0" encoding="UTF-8"?>
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<item oor:path="/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments">
<prop oor:name="AutoCheckEnabled" oor:op="fuse" oor:type="xs:boolean" oor:finalized="true">
<value>false</value>
</prop>
</item>
</oor:items>
and then trying to set 'Check for updates automatically' in Tools ->
Options -> LibreOffice -> Online Update.
Change-Id: Ifb196b6351c8a9182dfcf2ddf0a1e0555bcccedd
Reviewed-on: https://gerrit.libreoffice.org/28856
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'cui/source/options')
-rw-r--r-- | cui/source/options/optupdt.cxx | 13 | ||||
-rw-r--r-- | cui/source/options/optupdt.hxx | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 3623bd65200c..ae2aec7acb1d 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -37,6 +37,8 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/setup/UpdateCheckConfig.hpp> +#include <com/sun/star/configuration/ReadWriteAccess.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> #include <osl/file.hxx> #include <osl/security.hxx> @@ -67,6 +69,7 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxIt uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext ); + m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*"); bool bDownloadSupported = false; m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported; @@ -274,11 +277,15 @@ void SvxOnlineUpdateTabPage::Reset( const SfxItemSet* ) { bool bValue = false; m_xUpdateAccess->getByName( "AutoCheckEnabled" ) >>= bValue; + OUStringLiteral sPath("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoCheckEnabled"); + beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(sPath); + bool bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0; m_pAutoCheckCheckBox->Check(bValue); - m_pEveryDayButton->Enable(bValue); - m_pEveryWeekButton->Enable(bValue); - m_pEveryMonthButton->Enable(bValue); + m_pAutoCheckCheckBox->Enable(!bReadOnly); + m_pEveryDayButton->Enable(bValue && !bReadOnly); + m_pEveryWeekButton->Enable(bValue && !bReadOnly); + m_pEveryMonthButton->Enable(bValue && !bReadOnly); sal_Int64 nValue = 0; m_xUpdateAccess->getByName( "CheckInterval" ) >>= nValue; diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx index 9460930fc164..04a97b742f74 100644 --- a/cui/source/options/optupdt.hxx +++ b/cui/source/options/optupdt.hxx @@ -23,6 +23,7 @@ #include <sfx2/tabdlg.hxx> #include <vcl/fixed.hxx> #include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/configuration/XReadWriteAccess.hpp> // class SvxPathTabPage -------------------------------------------------- @@ -50,6 +51,7 @@ private: DECL_LINK_TYPED(ExtrasCheckHdl_Impl, Button*, void); css::uno::Reference< css::container::XNameReplace > m_xUpdateAccess; + css::uno::Reference<css::configuration::XReadWriteAccess> m_xReadWriteAccess; void UpdateLastCheckedText(); void UpdateUserAgent(); |