From cde00e11db2f273f4027780a4f66e40ec7c598e1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 23 Jul 2021 12:28:46 +0200 Subject: [PATCH] use officecfg to retrieve offlinehelppopup Change-Id: I2441dc1c508ceb4805a98b7e45863bbda4af0b18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119415 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/options/optgdlg.cxx | 8 ++++++-- include/svtools/helpopt.hxx | 2 -- sfx2/source/appl/sfxhelp.cxx | 14 ++++++++------ svtools/source/config/helpopt.cxx | 25 ++----------------------- 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 04d2683c921e..9194219d2056 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -219,7 +219,11 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) SvtHelpOptions aHelpOptions; if ( m_xPopUpNoHelpCB->get_state_changed_from_saved() ) - aHelpOptions.SetOfflineHelpPopUp( m_xPopUpNoHelpCB->get_active() ); + { + auto xChanges = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(m_xPopUpNoHelpCB->get_active(), xChanges); + xChanges->commit(); + } if ( m_xExtHelpCB->get_state_changed_from_saved() ) aHelpOptions.SetExtendedHelp( m_xExtHelpCB->get_active() ); @@ -286,7 +290,7 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) SvtHelpOptions aHelpOptions; m_xExtHelpCB->set_active( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() ); m_xExtHelpCB->save_state(); - m_xPopUpNoHelpCB->set_active( aHelpOptions.IsOfflineHelpPopUp() ); + m_xPopUpNoHelpCB->set_active( officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get() ); m_xPopUpNoHelpCB->save_state(); m_xShowTipOfTheDay->set_active( officecfg::Office::Common::Misc::ShowTipOfTheDay::get() ); m_xShowTipOfTheDay->save_state(); diff --git a/include/svtools/helpopt.hxx b/include/svtools/helpopt.hxx index 8d1479609e0c..803fce3ff0f0 100644 --- a/include/svtools/helpopt.hxx +++ b/include/svtools/helpopt.hxx @@ -38,8 +38,6 @@ public: bool IsExtendedHelp() const; void SetHelpTips( bool b ); bool IsHelpTips() const; - void SetOfflineHelpPopUp(bool b); - bool IsOfflineHelpPopUp() const; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index e96c3f7f4a0d..df0543b15a21 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -1136,8 +1136,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) if ( !impl_hasHelpInstalled() ) { - SvtHelpOptions aHelpOptions; - bool bShowOfflineHelpPopUp = aHelpOptions.IsOfflineHelpPopUp(); + bool bShowOfflineHelpPopUp = officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get(); pWindow = GetBestParent(pWindow); @@ -1150,7 +1149,9 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) HelpManualMessage aQueryBox(pWeldWindow); short OnlineHelpBox = aQueryBox.run(); bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK; - aHelpOptions.SetOfflineHelpPopUp(aQueryBox.GetOfflineHelpPopUp()); + auto xChanges = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(aQueryBox.GetOfflineHelpPopUp(), xChanges); + xChanges->commit(); aBusy.decBusy(); } if(!bShowOfflineHelpPopUp) @@ -1292,8 +1293,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt if ( !impl_hasHelpInstalled() ) { - SvtHelpOptions aHelpOptions; - bool bShowOfflineHelpPopUp = aHelpOptions.IsOfflineHelpPopUp(); + bool bShowOfflineHelpPopUp = officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get(); TopLevelWindowLocker aBusy; @@ -1303,7 +1303,9 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt HelpManualMessage aQueryBox(pWidget); short OnlineHelpBox = aQueryBox.run(); bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK; - aHelpOptions.SetOfflineHelpPopUp(aQueryBox.GetOfflineHelpPopUp()); + auto xChanges = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(aQueryBox.GetOfflineHelpPopUp(), xChanges); + xChanges->commit(); aBusy.decBusy(); } if(!bShowOfflineHelpPopUp) diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 2a7afe9e4918..88c9d9865905 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -43,8 +43,7 @@ enum class HelpProperty { ExtendedHelp = 0, HelpTips = 1, - Locale = 2, - OfflineHelpPopUp = 3 + Locale = 2 }; } @@ -53,7 +52,6 @@ class SvtHelpOptions_Impl : public utl::ConfigItem { bool bExtendedHelp; bool bHelpTips; - bool bOfflineHelpPopUp; OUString aLocale; OUString sHelpStyleSheet; @@ -72,8 +70,6 @@ public: bool IsExtendedHelp() const { return bExtendedHelp; } void SetHelpTips( bool b ) { bHelpTips = b; SetModified(); } bool IsHelpTips() const { return bHelpTips; } - void SetOfflineHelpPopUp(bool b) { bOfflineHelpPopUp = b; SetModified();} - bool IsOfflineHelpPopUp() const { return bOfflineHelpPopUp;} static ::osl::Mutex & getInitMutex(); }; @@ -84,8 +80,7 @@ Sequence< OUString > const & SvtHelpOptions_Impl::GetPropertyNames() { "ExtendedTip", "Tip", - "Locale", - "BuiltInHelpNotInstalledPopUp" + "Locale" }; return aNames; @@ -102,7 +97,6 @@ SvtHelpOptions_Impl::SvtHelpOptions_Impl() : ConfigItem( "Office.Common/Help" ) , bExtendedHelp( false ) , bHelpTips( true ) - , bOfflineHelpPopUp( true) { Sequence< OUString > aNames = GetPropertyNames(); Load( aNames ); @@ -143,9 +137,6 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames) case HelpProperty::HelpTips: bHelpTips = bTmp; break; - case HelpProperty::OfflineHelpPopUp: - bOfflineHelpPopUp = bTmp; - break; default: SAL_WARN( "svtools.config", "Wrong Member!" ); break; @@ -201,10 +192,6 @@ void SvtHelpOptions_Impl::ImplCommit() pValues[nProp] <<= aLocale; break; - case HelpProperty::OfflineHelpPopUp: - pValues[nProp] <<= bOfflineHelpPopUp; - break; - } } @@ -247,15 +234,7 @@ bool SvtHelpOptions::IsExtendedHelp() const { return pImpl->IsExtendedHelp(); } -void SvtHelpOptions::SetOfflineHelpPopUp (bool b ) -{ - pImpl->SetOfflineHelpPopUp( b ); -} -bool SvtHelpOptions::IsOfflineHelpPopUp() const -{ - return pImpl->IsOfflineHelpPopUp(); -} void SvtHelpOptions::SetHelpTips( bool b ) { pImpl->SetHelpTips( b );