diff options
author | heiko tietze <tietze.heiko@gmail.com> | 2019-03-21 10:14:07 +0100 |
---|---|---|
committer | Heiko Tietze <tietze.heiko@gmail.com> | 2019-04-10 16:54:37 +0200 |
commit | a1700d52a47184ee07b91b461a846dc5435f0022 (patch) | |
tree | 31e05614ca9133846bef8fd5219ada1191d48414 /sfx2 | |
parent | 3d7a67cdd465956206f881304bbcbaf47ccfcd83 (diff) |
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 <tietze.heiko@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
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<std::chrono::hours>(t0).count()/24; // days since 1970-01-01 + if (nDay-nLastTipOfTheDay > 0) { //only once per day + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); + VclPtr<VclAbstractDialog> 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::seconds>(std::chrono::system_clock::now().time_since_epoch()).count(); + const sal_Int64 nNow = std::chrono::duration_cast<std::chrono::seconds>(t0).count(); const sal_Int64 nPeriodSec(60 * 60 * 24 * 180); // 180 days in seconds bool bUpdateLastTimeGetInvolvedShown = false; |