diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2020-10-02 13:39:12 +0200 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2020-10-05 12:05:00 +0200 |
commit | 1dcbf68bfabe1436f5a3f54f902d18de06895dbb (patch) | |
tree | accbd6fbddcd519525d1d09d0bc9dfeabb25c398 /sfx2 | |
parent | 551796bf1ccfbb7953109f55c09011ef48315d8a (diff) |
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 <Samuel.Mehrbrodt@cib.de>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 35 |
2 files changed, 17 insertions, 20 deletions
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 |