From a1700d52a47184ee07b91b461a846dc5435f0022 Mon Sep 17 00:00:00 2001 From: heiko tietze Date: Thu, 21 Mar 2019 10:14:07 +0100 Subject: tdf#124238 - Show a Tip-Of-The-Day dialog on startup New dialog Change-Id: If1e501de26eb5a9c20a59e621f9e805c3b5e2cf8 Reviewed-on: https://gerrit.libreoffice.org/69498 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- sfx2/source/view/viewfrm.cxx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index abff96219425..50201c343c76 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1219,9 +1219,30 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) rBind.Invalidate( SID_RELOAD ); rBind.Invalidate( SID_EDITDOC ); + const auto t0 = std::chrono::system_clock::now().time_since_epoch(); + + // show tip-of-the-day dialog + const bool bShowTipOfTheDay = officecfg::Office::Common::Misc::ShowTipOfTheDay::get(); + bool bIsUITest = false; //uitest.uicheck fails when the dialog is open + for( sal_uInt16 i = 0; i < Application::GetCommandLineParamCount(); i++ ) + { + if( Application::GetCommandLineParam(i) == "--nologo" ) + bIsUITest = true; + } + if (bShowTipOfTheDay && !Application::IsHeadlessModeEnabled() && !bIsUITest) { + const sal_Int32 nLastTipOfTheDay = officecfg::Office::Common::Misc::LastTipOfTheDayShown::get(); + const sal_Int32 nDay = std::chrono::duration_cast(t0).count()/24; // days since 1970-01-01 + if (nDay-nLastTipOfTheDay > 0) { //only once per day + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); + VclPtr pDlg = + pFact->CreateTipOfTheDayDialog( GetWindow().GetFrameWeld() ); + pDlg->Execute(); + } + } + // inform about the community involvement const sal_Int64 nLastGetInvolvedShown = officecfg::Setup::Product::LastTimeGetInvolvedShown::get(); - const sal_Int64 nNow = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + const sal_Int64 nNow = std::chrono::duration_cast(t0).count(); const sal_Int64 nPeriodSec(60 * 60 * 24 * 180); // 180 days in seconds bool bUpdateLastTimeGetInvolvedShown = false; -- cgit