diff options
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 35 |
3 files changed, 23 insertions, 20 deletions
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 |