cui/source/options/optupdt.cxx         |  315 +++++++++++++++++++--------------
 cui/source/options/optupdt.hxx         |    9 
 cui/source/options/treeopt.cxx         |   17 -
 cui/uiconfig/ui/optonlineupdatepage.ui |   38 +++
 4 files changed, 237 insertions(+), 142 deletions(-)

New commits:
commit 5d2c5b09c9e7940b2285180b42e6e574063b693e
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Dec 7 15:22:02 2023 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Thu Dec 7 16:26:46 2023 +0100

    GUI to en-/disable the --enable-online-update-mar feature at runtime
    
    ...sharing the existing option tab page for the traditional
    --enable-online-update feature
    
    Change-Id: Ic7b04bf15bf841a46a96d62cf5a857deaa399428
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160430
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index 1c396b1fc217..8ce74bb1fa52 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <svl/numformat.hxx>
@@ -34,12 +35,14 @@
 #include <com/sun/star/util/XChangesBatch.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/setup/UpdateCheck.hpp>
 #include <com/sun/star/setup/UpdateCheckConfig.hpp>
 #include <com/sun/star/configuration/ReadWriteAccess.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <sfx2/filedlghelper.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Update.hxx>
 #include <osl/file.hxx>
 #include <osl/security.hxx>
 #include <comphelper/diagnose_ex.hxx>
@@ -49,6 +52,7 @@ using namespace ::css;
 
 SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rSet)
     : SfxTabPage(pPage, pController, "cui/ui/optonlineupdatepage.ui", 
"OptOnlineUpdatePage", &rSet)
+    , m_showTraditionalOnlineUpdate(isTraditionalOnlineUpdateEnabled())
     , m_xNeverChecked(m_xBuilder->weld_label("neverchecked"))
     , m_xAutoCheckCheckBox(m_xBuilder->weld_check_button("autocheck"))
     , m_xAutoCheckImg(m_xBuilder->weld_widget("lockautocheck"))
@@ -67,36 +71,60 @@ 
SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(weld::Container* pPage, weld::Dia
     , m_xExtrasImg(m_xBuilder->weld_widget("lockextrabits"))
     , m_xUserAgentLabel(m_xBuilder->weld_label("useragent"))
     , m_xPrivacyPolicyButton(m_xBuilder->weld_link_button("btnPrivacyPolicy"))
+    , m_xBox2(m_xBuilder->weld_box("box2"))
+    , m_xFrameDest(m_xBuilder->weld_frame("frameDest"))
+    , m_xFrameAgent(m_xBuilder->weld_frame("frameAgent"))
+    , m_xMar(m_xBuilder->weld_frame("frameMar"))
+    , m_xEnableMar(m_xBuilder->weld_check_button("enableMar"))
 {
-    m_aNeverChecked = m_xNeverChecked->get_label();
+    if (m_showTraditionalOnlineUpdate) {
+        m_aNeverChecked = m_xNeverChecked->get_label();
 
-    m_xAutoCheckCheckBox->connect_toggled( LINK( this, SvxOnlineUpdateTabPage, 
AutoCheckHdl_Impl ) );
-    m_xExtrasCheckBox->connect_toggled( LINK( this, SvxOnlineUpdateTabPage, 
ExtrasCheckHdl_Impl ) );
-    m_xCheckNowButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, 
CheckNowHdl_Impl ) );
-    m_xChangePathButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, 
FileDialogHdl_Impl ) );
-    m_xPrivacyPolicyButton->set_uri(
-        officecfg::Office::Common::Menus::PrivacyPolicyURL::get()
-        + "?type=updatecheck&LOvers=" + utl::ConfigManager::getProductVersion()
-        + "&LOlocale=" + 
LanguageTag(utl::ConfigManager::getUILocale()).getBcp47());
+        m_xAutoCheckCheckBox->connect_toggled( LINK( this, 
SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) );
+        m_xExtrasCheckBox->connect_toggled( LINK( this, 
SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl ) );
+        m_xCheckNowButton->connect_clicked( LINK( this, 
SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) );
+        m_xChangePathButton->connect_clicked( LINK( this, 
SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) );
+        m_xPrivacyPolicyButton->set_uri(
+            officecfg::Office::Common::Menus::PrivacyPolicyURL::get()
+            + "?type=updatecheck&LOvers=" + 
utl::ConfigManager::getProductVersion()
+            + "&LOlocale=" + 
LanguageTag(utl::ConfigManager::getUILocale()).getBcp47());
 
 
-    uno::Reference < uno::XComponentContext > xContext( 
::comphelper::getProcessComponentContext() );
+        uno::Reference < uno::XComponentContext > xContext( 
::comphelper::getProcessComponentContext() );
 
-    m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext );
-    m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, 
"*");
+        m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext );
+        m_xReadWriteAccess = 
css::configuration::ReadWriteAccess::create(xContext, "*");
 
-    bool bDownloadSupported = false;
-    m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported;
+        bool bDownloadSupported = false;
+        m_xUpdateAccess->getByName( "DownloadSupported" ) >>= 
bDownloadSupported;
 
-    m_xAutoDownloadCheckBox->set_visible(bDownloadSupported);
-    m_xDestPathLabel->set_visible(bDownloadSupported);
-    m_xDestPath->set_visible(bDownloadSupported);
-    m_xChangePathButton->set_visible(bDownloadSupported);
+        m_xAutoDownloadCheckBox->set_visible(bDownloadSupported);
+        m_xDestPathLabel->set_visible(bDownloadSupported);
+        m_xDestPath->set_visible(bDownloadSupported);
+        m_xChangePathButton->set_visible(bDownloadSupported);
 
-    m_aLastCheckedTemplate = m_xLastChecked->get_label();
+        m_aLastCheckedTemplate = m_xLastChecked->get_label();
 
-    UpdateLastCheckedText();
-    UpdateUserAgent();
+        UpdateLastCheckedText();
+        UpdateUserAgent();
+    } else {
+        m_xAutoCheckCheckBox->hide();
+        m_xEveryDayButton->hide();
+        m_xEveryWeekButton->hide();
+        m_xEveryMonthButton->hide();
+        m_xCheckNowButton->hide();
+        m_xBox2->hide();
+        m_xAutoCheckImg->hide();
+        m_xCheckIntervalImg->hide();
+        m_xFrameDest->hide();
+        m_xFrameAgent->hide();
+        m_xPrivacyPolicyButton->hide();
+    }
+
+#if HAVE_FEATURE_UPDATE_MAR
+    m_xMar->show();
+    
m_xEnableMar->set_sensitive(!officecfg::Office::Update::Update::Enabled::isReadOnly());
+#endif
 }
 
 SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage()
@@ -232,130 +260,148 @@ bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* )
 {
     bool bModified = false;
 
-    bool bValue;
-    sal_Int64 nValue;
+    if (m_showTraditionalOnlineUpdate) {
+        bool bValue;
+        sal_Int64 nValue;
 
-    if( m_xAutoCheckCheckBox->get_state_changed_from_saved() )
-    {
-        bValue = m_xAutoCheckCheckBox->get_active();
-        m_xUpdateAccess->replaceByName( "AutoCheckEnabled", uno::Any( bValue ) 
);
-        bModified = true;
-    }
+        if( m_xAutoCheckCheckBox->get_state_changed_from_saved() )
+        {
+            bValue = m_xAutoCheckCheckBox->get_active();
+            m_xUpdateAccess->replaceByName( "AutoCheckEnabled", uno::Any( 
bValue ) );
+            bModified = true;
+        }
 
-    nValue = 0;
-    if( m_xEveryDayButton->get_active() )
-    {
-        if( !m_xEveryDayButton->get_saved_state() )
-            nValue = 86400;
-    }
-    else if( m_xEveryWeekButton->get_active() )
-    {
-        if( !m_xEveryWeekButton->get_saved_state() )
-            nValue = 604800;
-    }
-    else if( m_xEveryMonthButton->get_active() )
-    {
-        if( !m_xEveryMonthButton->get_saved_state() )
-            nValue = 2592000;
-    }
+        nValue = 0;
+        if( m_xEveryDayButton->get_active() )
+        {
+            if( !m_xEveryDayButton->get_saved_state() )
+                nValue = 86400;
+        }
+        else if( m_xEveryWeekButton->get_active() )
+        {
+            if( !m_xEveryWeekButton->get_saved_state() )
+                nValue = 604800;
+        }
+        else if( m_xEveryMonthButton->get_active() )
+        {
+            if( !m_xEveryMonthButton->get_saved_state() )
+                nValue = 2592000;
+        }
 
-    if( nValue > 0 )
-    {
-        m_xUpdateAccess->replaceByName( "CheckInterval", uno::Any( nValue ) );
-        bModified = true;
-    }
+        if( nValue > 0 )
+        {
+            m_xUpdateAccess->replaceByName( "CheckInterval", uno::Any( nValue 
) );
+            bModified = true;
+        }
 
-    if( m_xAutoDownloadCheckBox->get_state_changed_from_saved() )
-    {
-        bValue = m_xAutoDownloadCheckBox->get_active();
-        m_xUpdateAccess->replaceByName( "AutoDownloadEnabled", uno::Any( 
bValue ) );
-        bModified = true;
-    }
+        if( m_xAutoDownloadCheckBox->get_state_changed_from_saved() )
+        {
+            bValue = m_xAutoDownloadCheckBox->get_active();
+            m_xUpdateAccess->replaceByName( "AutoDownloadEnabled", uno::Any( 
bValue ) );
+            bModified = true;
+        }
 
-    OUString sValue, aURL;
-    m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
+        OUString sValue, aURL;
+        m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
 
-    if( ( osl::FileBase::E_None == 
osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) ) &&
-        ( aURL != sValue ) )
-    {
-        m_xUpdateAccess->replaceByName( "DownloadDestination", uno::Any( aURL 
) );
-        bModified = true;
+        if( ( osl::FileBase::E_None == 
osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) ) &&
+            ( aURL != sValue ) )
+        {
+            m_xUpdateAccess->replaceByName( "DownloadDestination", uno::Any( 
aURL ) );
+            bModified = true;
+        }
+
+        if( m_xExtrasCheckBox->get_state_changed_from_saved() )
+        {
+            bValue = m_xExtrasCheckBox->get_active();
+            m_xUpdateAccess->replaceByName( "ExtendedUserAgent", uno::Any( 
bValue ) );
+            bModified = true;
+        }
+
+        uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, 
uno::UNO_QUERY);
+        if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
+            xChangesBatch->commitChanges();
     }
 
-    if( m_xExtrasCheckBox->get_state_changed_from_saved() )
-    {
-        bValue = m_xExtrasCheckBox->get_active();
-        m_xUpdateAccess->replaceByName( "ExtendedUserAgent", uno::Any( bValue 
) );
+#if HAVE_FEATURE_UPDATE_MAR
+    if (m_xEnableMar->get_state_changed_from_saved()) {
+        auto batch(comphelper::ConfigurationChanges::create());
+        
officecfg::Office::Update::Update::Enabled::set(m_xEnableMar->get_active(), 
batch);
+        batch->commit();
         bModified = true;
     }
-
-    uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, 
uno::UNO_QUERY);
-    if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
-        xChangesBatch->commitChanges();
+#endif
 
     return bModified;
 }
 
 void SvxOnlineUpdateTabPage::Reset( const SfxItemSet* )
 {
-    bool bValue = false;
-    m_xUpdateAccess->getByName( "AutoCheckEnabled" ) >>= bValue;
-    beans::Property aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoCheckEnabled");
-    bool bReadOnly = (aProperty.Attributes & 
beans::PropertyAttribute::READONLY) != 0;
-
-    m_xAutoCheckCheckBox->set_active(bValue);
-    m_xAutoCheckCheckBox->set_sensitive(!bReadOnly);
-    m_xAutoCheckImg->set_visible(bReadOnly);
-
-    sal_Int64 nValue = 0;
-    m_xUpdateAccess->getByName( "CheckInterval" ) >>= nValue;
-    aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/CheckInterval");
-    bool bReadOnly2 = (aProperty.Attributes & 
beans::PropertyAttribute::READONLY) != 0;
-    m_xEveryDayButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
-    m_xEveryWeekButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
-    m_xEveryMonthButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
-    m_xCheckIntervalImg->set_visible(bReadOnly2);
-
-    if( nValue == 86400 )
-        m_xEveryDayButton->set_active(true);
-    else if( nValue == 604800 )
-        m_xEveryWeekButton->set_active(true);
-    else
-        m_xEveryMonthButton->set_active(true);
-
-    m_xAutoCheckCheckBox->save_state();
-    m_xEveryDayButton->save_state();
-    m_xEveryWeekButton->save_state();
-    m_xEveryMonthButton->save_state();
-
-    m_xUpdateAccess->getByName( "AutoDownloadEnabled" ) >>= bValue;
-    aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoDownloadEnabled");
-    bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 
0;
-    m_xAutoDownloadCheckBox->set_active(bValue);
-    m_xAutoDownloadCheckBox->set_sensitive(!bReadOnly);
-    m_xAutoDownloadImg->set_visible(bReadOnly);
-    m_xDestPathLabel->set_sensitive(true);
-    m_xDestPath->set_sensitive(true);
-
-    OUString sValue, aPath;
-    m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
-    aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/DownloadDestination");
-    bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 
0;
-    m_xChangePathButton->set_sensitive(!bReadOnly);
-
-    if( osl::FileBase::E_None == 
osl::FileBase::getSystemPathFromFileURL(sValue, aPath) )
-        m_xDestPath->set_label(aPath);
-
-    m_xUpdateAccess->getByName( "ExtendedUserAgent" ) >>= bValue;
-    aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/ExtendedUserAgent");
-    bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 
0;
-    m_xExtrasCheckBox->set_active(bValue);
-    m_xExtrasCheckBox->set_sensitive(!bReadOnly);
-    m_xExtrasImg->set_visible(bReadOnly);
-    m_xExtrasCheckBox->save_state();
-    UpdateUserAgent();
+    if (m_showTraditionalOnlineUpdate) {
+        bool bValue = false;
+        m_xUpdateAccess->getByName( "AutoCheckEnabled" ) >>= bValue;
+        beans::Property aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoCheckEnabled");
+        bool bReadOnly = (aProperty.Attributes & 
beans::PropertyAttribute::READONLY) != 0;
+
+        m_xAutoCheckCheckBox->set_active(bValue);
+        m_xAutoCheckCheckBox->set_sensitive(!bReadOnly);
+        m_xAutoCheckImg->set_visible(bReadOnly);
+
+        sal_Int64 nValue = 0;
+        m_xUpdateAccess->getByName( "CheckInterval" ) >>= nValue;
+        aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/CheckInterval");
+        bool bReadOnly2 = (aProperty.Attributes & 
beans::PropertyAttribute::READONLY) != 0;
+        m_xEveryDayButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
+        m_xEveryWeekButton->set_sensitive(bValue && !(bReadOnly || 
bReadOnly2));
+        m_xEveryMonthButton->set_sensitive(bValue && !(bReadOnly || 
bReadOnly2));
+        m_xCheckIntervalImg->set_visible(bReadOnly2);
+
+        if( nValue == 86400 )
+            m_xEveryDayButton->set_active(true);
+        else if( nValue == 604800 )
+            m_xEveryWeekButton->set_active(true);
+        else
+            m_xEveryMonthButton->set_active(true);
+
+        m_xAutoCheckCheckBox->save_state();
+        m_xEveryDayButton->save_state();
+        m_xEveryWeekButton->save_state();
+        m_xEveryMonthButton->save_state();
+
+        m_xUpdateAccess->getByName( "AutoDownloadEnabled" ) >>= bValue;
+        aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoDownloadEnabled");
+        bReadOnly = (aProperty.Attributes & 
beans::PropertyAttribute::READONLY) != 0;
+        m_xAutoDownloadCheckBox->set_active(bValue);
+        m_xAutoDownloadCheckBox->set_sensitive(!bReadOnly);
+        m_xAutoDownloadImg->set_visible(bReadOnly);
+        m_xDestPathLabel->set_sensitive(true);
+        m_xDestPath->set_sensitive(true);
+
+        OUString sValue, aPath;
+        m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
+        aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/DownloadDestination");
+        bReadOnly = (aProperty.Attributes & 
beans::PropertyAttribute::READONLY) != 0;
+        m_xChangePathButton->set_sensitive(!bReadOnly);
+
+        if( osl::FileBase::E_None == 
osl::FileBase::getSystemPathFromFileURL(sValue, aPath) )
+            m_xDestPath->set_label(aPath);
+
+        m_xUpdateAccess->getByName( "ExtendedUserAgent" ) >>= bValue;
+        aProperty = 
m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/ExtendedUserAgent");
+        bReadOnly = (aProperty.Attributes & 
beans::PropertyAttribute::READONLY) != 0;
+        m_xExtrasCheckBox->set_active(bValue);
+        m_xExtrasCheckBox->set_sensitive(!bReadOnly);
+        m_xExtrasImg->set_visible(bReadOnly);
+        m_xExtrasCheckBox->save_state();
+        UpdateUserAgent();
+
+        m_xAutoDownloadCheckBox->save_state();
+    }
 
-    m_xAutoDownloadCheckBox->save_state();
+#if HAVE_FEATURE_UPDATE_MAR
+    
m_xEnableMar->set_active(officecfg::Office::Update::Update::Enabled::get());
+    m_xEnableMar->save_state();
+#endif
 }
 
 void SvxOnlineUpdateTabPage::FillUserData()
@@ -445,4 +491,17 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl, 
weld::Button&, void)
     }
 }
 
+bool SvxOnlineUpdateTabPage::isTraditionalOnlineUpdateEnabled() {
+    try
+    {
+        css::uno::Reference < css::uno::XInterface > xService( 
setup::UpdateCheck::create( ::comphelper::getProcessComponentContext() ) );
+        if( xService.is() )
+            return true;
+    }
+    catch ( css::uno::DeploymentException& )
+    {
+    }
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx
index 56739078e401..b6e7e4c448f4 100644
--- a/cui/source/options/optupdt.hxx
+++ b/cui/source/options/optupdt.hxx
@@ -28,6 +28,8 @@
 class SvxOnlineUpdateTabPage : public SfxTabPage
 {
 private:
+    bool m_showTraditionalOnlineUpdate;
+
     OUString       m_aNeverChecked;
     OUString       m_aLastCheckedTemplate;
 
@@ -52,6 +54,11 @@ private:
     std::unique_ptr<weld::Widget> m_xExtrasImg;
     std::unique_ptr<weld::Label> m_xUserAgentLabel;
     std::unique_ptr<weld::LinkButton> m_xPrivacyPolicyButton;
+    std::unique_ptr<weld::Box> m_xBox2;
+    std::unique_ptr<weld::Frame> m_xFrameDest;
+    std::unique_ptr<weld::Frame> m_xFrameAgent;
+    std::unique_ptr<weld::Frame> m_xMar;
+    std::unique_ptr<weld::CheckButton> m_xEnableMar;
 
     DECL_LINK(FileDialogHdl_Impl, weld::Button&, void);
     DECL_LINK(CheckNowHdl_Impl, weld::Button&, void);
@@ -71,6 +78,8 @@ public:
     virtual bool            FillItemSet( SfxItemSet* rSet ) override;
     virtual void            Reset( const SfxItemSet* rSet ) override;
     virtual void            FillUserData() override;
+
+    static bool isTraditionalOnlineUpdateEnabled();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 882d59431169..c0a42990f5d7 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -80,7 +80,6 @@
 #include <com/sun/star/frame/UnknownModuleException.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/linguistic2/LinguProperties.hpp>
-#include <com/sun/star/setup/UpdateCheck.hpp>
 #include <comphelper/getexpandeduri.hxx>
 #include <comphelper/processfactory.hxx>
 #include <editeng/langitem.hxx>
@@ -1735,20 +1734,14 @@ void OfaTreeOptionsDialog::generalOptions(const 
std::vector<sal_uInt16>& vPageId
             if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
                 continue;
 
+#if !HAVE_FEATURE_UPDATE_MAR
             // Disable Online Update page if service not installed
-            if( RID_SVXPAGE_ONLINEUPDATE == nPageId )
+            if( RID_SVXPAGE_ONLINEUPDATE == nPageId
+                && !SvxOnlineUpdateTabPage::isTraditionalOnlineUpdateEnabled() 
)
             {
-                try
-                {
-                    Reference < XInterface > xService( 
setup::UpdateCheck::create( ::comphelper::getProcessComponentContext() ) );
-                    if( ! xService.is() )
-                        continue;
-                }
-                catch ( css::uno::DeploymentException& )
-                {
-                    continue;
-                }
+                continue;
             }
+#endif
 
             // Disable Basic IDE options, if experimental features are not 
enabled
             if( RID_SVXPAGE_BASICIDE_OPTIONS == nPageId )
diff --git a/cui/uiconfig/ui/optonlineupdatepage.ui 
b/cui/uiconfig/ui/optonlineupdatepage.ui
index e94217a5fdae..74a76e8a7510 100644
--- a/cui/uiconfig/ui/optonlineupdatepage.ui
+++ b/cui/uiconfig/ui/optonlineupdatepage.ui
@@ -224,7 +224,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkFrame">
+          <object class="GtkFrame" id="frameDest">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
             <property name="label-xalign">0</property>
@@ -378,7 +378,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkFrame">
+          <object class="GtkFrame" id="frameAgent">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
             <property name="label-xalign">0</property>
@@ -518,6 +518,40 @@
             <property name="position">3</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkFrame" id="frameMar">
+            <property name="visible">False</property>
+            <property name="can-focus">False</property>
+            <property name="label-xalign">0</property>
+            <property name="shadow-type">none</property>
+            <child>
+              <object class="GtkCheckButton" id="enableMar">
+                <property name="label" translatable="yes" 
context="optonlineupdatepage|enableMar">Enable au_tomatic update</property>
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">False</property>
+                <property name="halign">start</property>
+                <property name="use-underline">True</property>
+                <property name="draw-indicator">True</property>
+                <child internal-child="accessible">
+                  <object class="AtkObject" id="enableMar-atkobject">
+                    <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|enableMar">Mark to enable automatic 
update.</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="labelMar">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="label" translatable="yes" 
context="optonlineupdatepage|labelMar">Automatic Update</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+        </child>
       </object>
     </child>
     <child type="label">

Reply via email to