officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs | 6 + sfx2/source/dialog/infobar.cxx | 2 sfx2/source/view/viewfrm.cxx | 35 ++++------ 3 files changed, 23 insertions(+), 20 deletions(-)
New commits: commit 1dcbf68bfabe1436f5a3f54f902d18de06895dbb Author: Heiko Tietze <[email protected]> AuthorDate: Fri Oct 2 13:39:12 2020 +0200 Commit: Heiko Tietze <[email protected]> CommitDate: Mon Oct 5 12:05:00 2020 +0200 Disable WhatsNew infobar with standard method WhatsNew IB uses the Newly introduced Enabled property now IsReadOnly got removed Follow-up to 3fb1477de164bba260e3e9a39afcb3f67c78fb5e Change-Id: I3989acf835ee219575106bc6c7d5edac4e6accd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103841 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> Reviewed-by: Heiko Tietze <[email protected]> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs index af0434046770..a7f996dc4ed8 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs @@ -48,6 +48,12 @@ </info> <value>true</value> </prop> + <prop oor:name="WhatsNew" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Whether an Infobar is shown when the major version number has changed</desc> + </info> + <value>true</value> + </prop> </group> </component> </oor:component-schema> diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 580bd6685801..1b48cf758212 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -439,6 +439,8 @@ bool SfxInfoBarContainerWindow::isInfobarEnabled(const OUString& sId) return officecfg::Office::UI::Infobar::Enabled::GetInvolved::get(); if (sId == "hyphenationmissing") return officecfg::Office::UI::Infobar::Enabled::HyphenationMissing::get(); + if (sId == "whatsnew") + return officecfg::Office::UI::Infobar::Enabled::WhatsNew::get(); return true; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6dc772e0c06e..76b8db3754b5 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1325,29 +1325,24 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } //what's new infobar - if (!officecfg::Setup::Product::ooSetupLastVersion::isReadOnly()) //don't show/update when readonly + OUString sSetupVersion = utl::ConfigManager::getProductVersion(); + sal_Int32 iCurrent = sSetupVersion.getToken(0,'.').toInt32() * 10 + sSetupVersion.getToken(1,'.').toInt32(); + OUString sLastVersion + = officecfg::Setup::Product::ooSetupLastVersion::get().value_or("0.0"); + sal_Int32 iLast = sLastVersion.getToken(0,'.').toInt32() * 10 + sLastVersion.getToken(1,'.').toInt32(); + if ((iCurrent > iLast) && !Application::IsHeadlessModeEnabled() && !bIsUITest) { - OUString sSetupVersion = utl::ConfigManager::getProductVersion(); - sal_Int32 iCurrent = sSetupVersion.getToken(0,'.').toInt32() * 10 + sSetupVersion.getToken(1,'.').toInt32(); - OUString sLastVersion - = officecfg::Setup::Product::ooSetupLastVersion::get().value_or("0.0"); - sal_Int32 iLast = sLastVersion.getToken(0,'.').toInt32() * 10 + sLastVersion.getToken(1,'.').toInt32(); - if ((iCurrent > iLast) && !Application::IsHeadlessModeEnabled() && !bIsUITest) + VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO); + if (pInfoBar) { - VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO); - if (pInfoBar) - { - weld::Button& rWhatsNewButton = pInfoBar->addButton(); - rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON)); - rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler)); - - //update lastversion - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Setup::Product::ooSetupLastVersion::set( - sSetupVersion, batch); - batch->commit(); - } + weld::Button& rWhatsNewButton = pInfoBar->addButton(); + rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON)); + rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler)); } + //update lastversion + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch); + batch->commit(); } // show tip-of-the-day dialog _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
