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

Miklos Vajna vmiklos at collabora.co.uk
Tue Sep 13 08:08:34 UTC 2016


 cui/source/options/optupdt.cxx |   13 ++++++++++---
 cui/source/options/optupdt.hxx |    2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 0ae863c8ac4b712d67041e8bcf4069afbe71b494
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Sep 13 08:13:16 2016 +0200

    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 at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index 3623bd6..ae2aec7 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 9460930..04a97b7 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();


More information about the Libreoffice-commits mailing list