diff --git a/include/unotools/VersionConfig.hxx b/include/unotools/VersionConfig.hxx
index 57aebd7c9ec1..2a935943a68b 100644
--- a/include/unotools/VersionConfig.hxx
+++ b/include/unotools/VersionConfig.hxx
@@ -19,4 +19,8 @@ namespace utl
* current version of LibreOffice has been upgraded to a newer one.
*/
bool UNOTOOLS_DLLPUBLIC isProductVersionUpgraded();
+/** This method is called to detect if the program is started the
+ * very first time after a clean installation or a profile reset.
+ */
+bool UNOTOOLS_DLLPUBLIC isProductVersionNew();
}
diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs
index 4bbaa1c1ea56..de6740bdbf2f 100644
--- a/officecfg/registry/schema/org/openoffice/Setup.xcs
+++ b/officecfg/registry/schema/org/openoffice/Setup.xcs
@@ -307,13 +307,11 @@
true
-
+
- Set to false to not show the WhatsNew dialog but the infobar.
- Initial nil value is evaluated at the first start to show the
- welcome dialog, and set to true in order to show the Whatsnew
- information as a dialog rather than the simple infobar in case of false.
+ Set to false to not show the WhatsNew dialog but the infobar.
+ true
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 588b5fb3a7e2..c8b088b378a5 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1648,49 +1648,41 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
bool bIsWhatsNewShown = false; //suppress tipoftheday if whatsnew was shown
static const bool bRunningUnitTest = o3tl::IsRunningUnitTest() || o3tl::IsRunningUITest();
- std::optional bShowWelcome = officecfg::Setup::Product::WhatsNewDialog::get(); // nil at first start = welcome dialog
- if (!bShowWelcome.has_value() && !IsInModalMode() && !bRunningUnitTest)
- {
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- ScopedVclPtr pDlg(
- pFact->CreateWelcomeDialog(GetWindow().GetFrameWeld(), true));
- pDlg->Execute();
-
- std::shared_ptr batch(comphelper::ConfigurationChanges::create());
- officecfg::Setup::Product::WhatsNewDialog::set(true, batch); // true after first start = whatsnew dialog
- batch->commit();
-
- bIsWhatsNewShown = true;
- }
-
//what's new dialog
- static bool wantsWhatsNew = utl::isProductVersionUpgraded() && !IsInModalMode() && bShowWelcome.has_value();
+ static bool wantsWhatsNew = officecfg::Setup::Product::WhatsNew::get()
+ && !IsInModalMode() && !bRunningUnitTest
+ && utl::isProductVersionUpgraded(); //sets isProductVersionNew
if (wantsWhatsNew)
{
wantsWhatsNew = false;
- if (officecfg::Setup::Product::WhatsNew::get())
+
+ if (utl::isProductVersionNew()) //welcome dialog
{
- if (bShowWelcome)
- {
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- ScopedVclPtr pDlg(
- pFact->CreateWelcomeDialog(GetWindow().GetFrameWeld(), false));
- pDlg->Execute();
- }
- else
- {
- OUString sText(SfxResId(STR_WHATSNEW_TEXT));
- VclPtr pInfoBar = AppendInfoBar(u"whatsnew"_ustr, u""_ustr, sText.replaceAll("\n",""), InfobarType::INFO);
- if (pInfoBar)
- {
- weld::Button& rWhatsNewButton = pInfoBar->addButton();
- rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON));
- rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler));
- }
- }
- bIsInfobarShown = true;
- bIsWhatsNewShown = true;
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ ScopedVclPtr pDlg(
+ pFact->CreateWelcomeDialog(GetWindow().GetFrameWeld(), true));
+ pDlg->Execute();
}
+ else if (officecfg::Setup::Product::WhatsNewDialog::get()) //whatsnew dialog
+ {
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ ScopedVclPtr pDlg(
+ pFact->CreateWelcomeDialog(GetWindow().GetFrameWeld(), false));
+ pDlg->Execute();
+ }
+ else //whatsnew infobar
+ {
+ OUString sText(SfxResId(STR_WHATSNEW_TEXT));
+ VclPtr pInfoBar = AppendInfoBar(u"whatsnew"_ustr, u""_ustr, sText.replaceAll("\n",""), InfobarType::INFO);
+ if (pInfoBar)
+ {
+ weld::Button& rWhatsNewButton = pInfoBar->addButton();
+ rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON));
+ rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler));
+ }
+ }
+ bIsInfobarShown = true;
+ bIsWhatsNewShown = true;
}
// show tip-of-the-day dialog if it due, but not if there is the impress modal template dialog
diff --git a/unotools/source/misc/VersionConfig.cxx b/unotools/source/misc/VersionConfig.cxx
index 80373ce73430..8b3887447ee7 100644
--- a/unotools/source/misc/VersionConfig.cxx
+++ b/unotools/source/misc/VersionConfig.cxx
@@ -21,9 +21,16 @@
namespace utl
{
+bool isProductVersionNew()
+{
+ static const bool bIsNew = !officecfg::Setup::Product::ooSetupLastVersion::get().has_value();
+ return bIsNew;
+}
+
bool isProductVersionUpgraded()
{
static const bool bUpgraded = []() {
+ (void)isProductVersionNew(); //set variable above
OUString sSetupVersion = utl::ConfigManager::getProductVersion();
sal_Int32 iCurrent = o3tl::toInt32(o3tl::getToken(sSetupVersion, 0, '.')) * 10
+ o3tl::toInt32(o3tl::getToken(sSetupVersion, 1, '.'));