use officecfg to retrieve offlinehelppopup

Change-Id: I2441dc1c508ceb4805a98b7e45863bbda4af0b18
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119415
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2021-07-23 12:28:46 +02:00
parent e271fce82e
commit cde00e11db
4 changed files with 16 additions and 33 deletions

View file

@ -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();

View file

@ -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: */

View file

@ -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)

View file

@ -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 );