diff options
Diffstat (limited to 'sfx2/source/view/viewfrm.cxx')
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 173 |
1 files changed, 92 insertions, 81 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index c6b25637cc..b14ff206fa 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1496,88 +1496,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) rBind.Invalidate( SID_RELOAD ); rBind.Invalidate( SID_EDITDOC ); -#if !ENABLE_WASM_STRIP_PINGUSER - bool bIsHeadlessOrUITest = SfxApplication::IsHeadlessOrUITest(); //uitest.uicheck fails when the dialog is open - - //what's new infobar - if (utl::isProductVersionUpgraded(true) && !bIsHeadlessOrUITest) - { - 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)); - } - } - - // 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 - bool bUpdateLastTimeGetInvolvedShown = false; - - if (nLastGetInvolvedShown == 0) - bUpdateLastTimeGetInvolvedShown = true; - else if (nPeriodSec < nNow && nLastGetInvolvedShown < (nNow + nPeriodSec/2) - nPeriodSec) // 90d alternating with donation - { - bUpdateLastTimeGetInvolvedShown = true; - - VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("getinvolved", "", SfxResId(STR_GET_INVOLVED_TEXT), InfobarType::INFO); - - if (pInfoBar) - { - weld::Button& rGetInvolvedButton = pInfoBar->addButton(); - rGetInvolvedButton.set_label(SfxResId(STR_GET_INVOLVED_BUTTON)); - rGetInvolvedButton.connect_clicked(LINK(this, SfxViewFrame, GetInvolvedHandler)); - } - } - - if (bUpdateLastTimeGetInvolvedShown - && !officecfg::Setup::Product::LastTimeGetInvolvedShown::isReadOnly()) - { - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Setup::Product::LastTimeGetInvolvedShown::set(nNow, batch); - batch->commit(); - } - - // inform about donations - const sal_Int64 nLastDonateShown = officecfg::Setup::Product::LastTimeDonateShown::get(); - bool bUpdateLastTimeDonateShown = false; - - if (nLastDonateShown == 0) - bUpdateLastTimeDonateShown = true; - else if (nPeriodSec < nNow && nLastDonateShown < nNow - nPeriodSec) // 90d alternating with getinvolved - { - bUpdateLastTimeDonateShown = true; - - VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("donate", "", SfxResId(STR_DONATE_TEXT), InfobarType::INFO); - if (pInfoBar) - { - weld::Button& rDonateButton = pInfoBar->addButton(); - rDonateButton.set_label(SfxResId(STR_DONATE_BUTTON)); - rDonateButton.connect_clicked(LINK(this, SfxViewFrame, DonationHandler)); - } - } + bool bIsInfobarShown(false); - if (bUpdateLastTimeDonateShown - && !officecfg::Setup::Product::LastTimeDonateShown::isReadOnly()) - { - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch); - batch->commit(); - } -#endif if (officecfg::Office::Common::Passwords::HasMaster::get() && officecfg::Office::Common::Passwords::StorageVersion::get() == 0) { @@ -1585,6 +1505,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) VclPtr<SfxInfoBarWindow> pOldMasterPasswordInfoBar = AppendInfoBar("oldmasterpassword", "", SfxResId(STR_REFRESH_MASTER_PASSWORD), InfobarType::DANGER, false); + bIsInfobarShown = true; if (pOldMasterPasswordInfoBar) { weld::Button& rButton = pOldMasterPasswordInfoBar->addButton(); @@ -1611,10 +1532,14 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) (( pVSh = m_xObjSh->GetViewShell()) && (pFSh = pVSh->GetFormShell()) && pFSh->IsDesignMode()))) { AppendReadOnlyInfobar(); + bIsInfobarShown = true; } if (!bEmbedded && m_xObjSh->Get_Impl()->getCurrentMacroExecMode() == css::document::MacroExecMode::NEVER_EXECUTE) + { AppendContainsMacrosInfobar(); + bIsInfobarShown = true; + } if (vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface()) == "com.sun.star.text.TextDocument") sfx2::SfxNotebookBar::ReloadNotebookBar(u"modules/swriter/ui/"); @@ -1655,6 +1580,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage, aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType, aInfobarData.mbShowCloseButton); + bIsInfobarShown = true; // tdf#148913 don't extend this condition to keep it thread-safe if (pInfoBar) @@ -1680,11 +1606,96 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage, aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType, aInfobarData.mbShowCloseButton); + bIsInfobarShown = true; } aPendingInfobars.pop_back(); } +#if !ENABLE_WASM_STRIP_PINGUSER + bool bIsHeadlessOrUITest = SfxApplication::IsHeadlessOrUITest(); //uitest.uicheck fails when the dialog is open + + //what's new infobar + if (!bIsInfobarShown && utl::isProductVersionUpgraded(true) && !bIsHeadlessOrUITest) + { + VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO); + bIsInfobarShown = true; + if (pInfoBar) + { + weld::Button& rWhatsNewButton = pInfoBar->addButton(); + rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON)); + rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler)); + } + } + + // 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 + bool bUpdateLastTimeGetInvolvedShown = false; + + if (nLastGetInvolvedShown == 0) + bUpdateLastTimeGetInvolvedShown = true; + else if (!bIsInfobarShown && nPeriodSec < nNow && nLastGetInvolvedShown < (nNow + nPeriodSec/2) - nPeriodSec) // 90d alternating with donation + { + bUpdateLastTimeGetInvolvedShown = true; + + VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("getinvolved", "", SfxResId(STR_GET_INVOLVED_TEXT), InfobarType::INFO); + bIsInfobarShown = true; + if (pInfoBar) + { + weld::Button& rGetInvolvedButton = pInfoBar->addButton(); + rGetInvolvedButton.set_label(SfxResId(STR_GET_INVOLVED_BUTTON)); + rGetInvolvedButton.connect_clicked(LINK(this, SfxViewFrame, GetInvolvedHandler)); + } + } + + if (bUpdateLastTimeGetInvolvedShown + && !officecfg::Setup::Product::LastTimeGetInvolvedShown::isReadOnly()) + { + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Setup::Product::LastTimeGetInvolvedShown::set(nNow, batch); + batch->commit(); + } + + // inform about donations + const sal_Int64 nLastDonateShown = officecfg::Setup::Product::LastTimeDonateShown::get(); + bool bUpdateLastTimeDonateShown = false; + + if (nLastDonateShown == 0) + bUpdateLastTimeDonateShown = true; + else if (!bIsInfobarShown && nPeriodSec < nNow && nLastDonateShown < nNow - nPeriodSec) // 90d alternating with getinvolved + { + bUpdateLastTimeDonateShown = true; + + VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("donate", "", SfxResId(STR_DONATE_TEXT), InfobarType::INFO); + if (pInfoBar) + { + weld::Button& rDonateButton = pInfoBar->addButton(); + rDonateButton.set_label(SfxResId(STR_DONATE_BUTTON)); + rDonateButton.connect_clicked(LINK(this, SfxViewFrame, DonationHandler)); + } + } + + if (bUpdateLastTimeDonateShown + && !officecfg::Setup::Product::LastTimeDonateShown::isReadOnly()) + { + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch); + batch->commit(); + } +#endif + break; } default: break; |