Resolves tdf#172256 - Show a warning when using the gen VCL backend
Infobar shown for gen AND Office::UI::Infobar::Enabled::WarnGenericVCL Change-Id: Ia4d42bb7c3ca9cc3da9b7564f7a0b6edce78ee31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205832 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
committed by
Heiko Tietze
parent
0a231f1237
commit
999e18ad24
@@ -327,6 +327,8 @@
|
||||
#define STR_MACROS NC_("STR_MACROS", "Show Macros")
|
||||
#define STR_SECURITY_OPTIONS NC_("STR_MACROS", "Show Security Options")
|
||||
#define STR_EVENTS NC_("STR_EVENTS", "Show Events")
|
||||
#define STR_VCLGEN_TITLE NC_("STR_VCLGEN_TITLE", "You are using generic controls!")
|
||||
#define STR_VCLGEN_TEXT NC_("STR_VCLGEN_TEXT", "Please check whether your distribution offers a better integration.")
|
||||
|
||||
// Translators: default Impress template names
|
||||
#define STR_TEMPLATE_NAME1 NC_("STR_TEMPLATE_NAME1", "Grey Elegant")
|
||||
|
||||
@@ -92,6 +92,7 @@ private:
|
||||
SAL_DLLPRIVATE static void InitInterface_Impl();
|
||||
|
||||
SAL_DLLPRIVATE void AppendContainsMacrosInfobar();
|
||||
SAL_DLLPRIVATE bool AppendGenericVCLInfobar();
|
||||
public:
|
||||
|
||||
SAL_DLLPRIVATE static void SetViewFrame( SfxViewFrame* );
|
||||
|
||||
@@ -72,6 +72,12 @@
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
<prop oor:name="WarnGenericVCL" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>Whether an Infobar is shown when the generic VCL is used.</desc>
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
</group>
|
||||
</component>
|
||||
</oor:component-schema>
|
||||
|
||||
@@ -486,6 +486,8 @@ bool SfxInfoBarContainerWindow::isInfobarEnabled(std::u16string_view sId)
|
||||
}
|
||||
if (sId == u"autocorr_leadtrail")
|
||||
return officecfg::Office::UI::Infobar::Enabled::AutoCorrLeadTrail::get();
|
||||
if (sId == u"VCL_gen")
|
||||
return officecfg::Office::UI::Infobar::Enabled::WarnGenericVCL::get();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1343,6 +1343,7 @@ void SfxViewFrame::AppendAutoCorrLeadTrailInfobar()
|
||||
{
|
||||
weld::Button& rDontShowAgain = pInfoBar->addButton();
|
||||
rDontShowAgain.set_label(SfxResId(STR_NOSHOWAGAIN));
|
||||
rDontShowAgain.set_buildable_name(u"autocorr_leadtrail"_ustr); // id in click handler
|
||||
rDontShowAgain.connect_clicked(LINK(this, SfxViewFrame, DontShowAgainHdl));
|
||||
|
||||
weld::Button& rChangeOptions = pInfoBar->addButton();
|
||||
@@ -1476,6 +1477,20 @@ void SfxViewFrame::AppendContainsMacrosInfobar()
|
||||
}
|
||||
}
|
||||
|
||||
bool SfxViewFrame::AppendGenericVCLInfobar()
|
||||
{
|
||||
auto pInfoBar = AppendInfoBar(u"VCL_gen"_ustr, SfxResId(STR_VCLGEN_TITLE),
|
||||
SfxResId(STR_VCLGEN_TEXT), InfobarType::INFO);
|
||||
if (pInfoBar) // false if not created in AppendInfoBar() after checking ::WarnGenericVCL::get()
|
||||
{
|
||||
weld::Button& rDontShowAgain = pInfoBar->addButton();
|
||||
rDontShowAgain.set_label(SfxResId(STR_NOSHOWAGAIN));
|
||||
rDontShowAgain.set_buildable_name(u"VCL_gen"_ustr); // id in click handler
|
||||
rDontShowAgain.connect_clicked(LINK(this, SfxViewFrame, DontShowAgainHdl));
|
||||
}
|
||||
|
||||
return pInfoBar;
|
||||
}
|
||||
namespace
|
||||
{
|
||||
css::uno::Reference<css::frame::XLayoutManager> getLayoutManager(const SfxFrame& rFrame)
|
||||
@@ -1616,6 +1631,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
|
||||
aHelper.UpdateInfobar(*this);
|
||||
}
|
||||
|
||||
if (Application::GetToolkit() == Toolkit::Gen)
|
||||
bIsInfobarShown = AppendGenericVCLInfobar();
|
||||
|
||||
// Add pending infobars
|
||||
std::vector<InfobarData>& aPendingInfobars = m_xObjSh->getPendingInfobars();
|
||||
while (!aPendingInfobars.empty())
|
||||
@@ -2037,14 +2055,17 @@ IMPL_STATIC_LINK_NOARG(SfxViewFrame, HelpMasterPasswordHdl, weld::Button&, void)
|
||||
pHelp->Start(u"cui/ui/optsecuritypage/savepassword"_ustr);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SfxViewFrame, DontShowAgainHdl, weld::Button&, void)
|
||||
IMPL_LINK(SfxViewFrame, DontShowAgainHdl, weld::Button&, rButton, void)
|
||||
{
|
||||
std::shared_ptr<comphelper::ConfigurationChanges> batch(
|
||||
comphelper::ConfigurationChanges::create());
|
||||
officecfg::Office::UI::Infobar::Enabled::AutoCorrLeadTrail::set(false, batch);
|
||||
if (rButton.get_buildable_name() == u"VCL_gen")
|
||||
officecfg::Office::UI::Infobar::Enabled::WarnGenericVCL::set(false, batch);
|
||||
else if (rButton.get_buildable_name() == u"autocorr_leadtrail")
|
||||
officecfg::Office::UI::Infobar::Enabled::AutoCorrLeadTrail::set(false, batch);
|
||||
batch->commit();
|
||||
|
||||
RemoveInfoBar(u"autocorr_leadtrail");
|
||||
RemoveInfoBar(rButton.get_buildable_name());
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SfxViewFrame, ChangeOptionsHdl, weld::Button&, void)
|
||||
|
||||
Reference in New Issue
Block a user