[Libreoffice-commits] core.git: include/sfx2 sd/source sfx2/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 18 19:23:14 UTC 2021
include/sfx2/app.hxx | 6 ++++
sd/source/ui/app/sdmod1.cxx | 9 ++++++
sfx2/source/view/viewfrm.cxx | 62 +++++++++++++++++++++++++++++--------------
3 files changed, 57 insertions(+), 20 deletions(-)
New commits:
commit 1f42157e2457e30a7f18fdf9d7bb5bddfb819f04
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 18 14:03:47 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 18 21:22:35 2021 +0200
tdf#143353 defer tip of the day until impress template dialog is gone
wait until that dialog is dismissed before showing the tip dialog
Change-Id: Id0e7e28f09c5a9727e10eda55e468adb56bfda70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120675
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index d15d0645a40a..5e86df8a019b 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -218,6 +218,12 @@ public:
/** loads the application logo as used in the impress slideshow pause screen */
static BitmapEx GetApplicationLogo(tools::Long nWidth);
+ /** if true then dialog/infobar notifications like the tip of the day or
+ version change infobar should be suppressed */
+ static bool IsHeadlessOrUITest();
+
+ static bool IsTipOfTheDayDue();
+
/** this Theme contains Images so must be deleted before DeInitVCL */
sfx2::sidebar::Theme & GetSidebarTheme();
};
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 64a149a1334d..8ac21d2258d9 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -489,6 +489,15 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest const & rReq )
//pFrame is loaded with the desired template
if (!aTemplDlg.getTemplatePath().isEmpty())
pFrame = CreateFromTemplate(aTemplDlg.getTemplatePath(), xTargetFrame, false);
+
+ // show tip-of-the-day dialog if it was deferred because SfxTemplateSelectionDlg
+ // was open
+ if (pFrame && SfxApplication::IsTipOfTheDayDue() && !SfxApplication::IsHeadlessOrUITest())
+ {
+ // tdf#127946 pass in argument for dialog parent
+ SfxUnoFrameItem aDocFrame(SID_FILLFRAME, pFrame->GetFrameInterface());
+ GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { &aDocFrame });
+ }
}
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 628b436dc81e..2881bbd4208f 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1328,6 +1328,37 @@ css::uno::Reference<css::frame::XLayoutManager> getLayoutManager(const SfxFrame&
}
}
+bool SfxApplication::IsHeadlessOrUITest()
+{
+ if (Application::IsHeadlessModeEnabled())
+ return true;
+
+ bool bIsUITest = false; //uitest.uicheck fails when the dialog is open
+ for (sal_uInt16 i = 0, nCount = Application::GetCommandLineParamCount(); i < nCount; ++i)
+ {
+ if (Application::GetCommandLineParam(i) == "--nologo")
+ {
+ bIsUITest = true;
+ break;
+ }
+ }
+ return bIsUITest;
+}
+
+bool SfxApplication::IsTipOfTheDayDue()
+{
+ const bool bShowTipOfTheDay = officecfg::Office::Common::Misc::ShowTipOfTheDay::get();
+ if (!bShowTipOfTheDay)
+ return false;
+
+ const auto t0 = std::chrono::system_clock::now().time_since_epoch();
+
+ // show tip-of-the-day dialog ?
+ 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
+ return nDay - nLastTipOfTheDay > 0; //only once per day
+}
+
void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{
if(m_pImpl->bIsDowning)
@@ -1360,17 +1391,10 @@ 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();
-
- 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;
- }
+ bool bIsHeadlessOrUITest = SfxApplication::IsHeadlessOrUITest(); //uitest.uicheck fails when the dialog is open
//what's new infobar
- if ((utl::isProductVersionUpgraded(true)) && !Application::IsHeadlessModeEnabled() && !bIsUITest)
+ if (utl::isProductVersionUpgraded(true) && !bIsHeadlessOrUITest)
{
VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO);
if (pInfoBar)
@@ -1381,19 +1405,17 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
}
- // show tip-of-the-day dialog
- const bool bShowTipOfTheDay = officecfg::Office::Common::Misc::ShowTipOfTheDay::get();
- 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
- // tdf#127946 pass in argument for dialog parent
- SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface());
- GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { &aDocFrame });
- }
- } //bShowTipOfTheDay
+ // show tip-of-the-day dialog if it due, but not if there is the impress modal template dialog
+ // open where SdModule::ExecuteNewDocument will launch it instead when that dialog is dismissed
+ if (SfxApplication::IsTipOfTheDayDue() && !bIsHeadlessOrUITest && !IsInModalMode())
+ {
+ // tdf#127946 pass in argument for dialog parent
+ SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface());
+ GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { &aDocFrame });
+ }
// inform about the community involvement
+ const auto t0 = std::chrono::system_clock::now().time_since_epoch();
const sal_Int64 nLastGetInvolvedShown = officecfg::Setup::Product::LastTimeGetInvolvedShown::get();
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
More information about the Libreoffice-commits
mailing list