summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorheiko tietze <tietze.heiko@gmail.com>2019-05-13 10:59:18 +0200
committerHeiko Tietze <tietze.heiko@gmail.com>2019-05-17 10:43:57 +0200
commit5187d3ae495a07373a12fd5980c9269bc8ce3f8f (patch)
treed529b9a31620015ecab6e69c607a37de2fb8018b /sfx2
parent9e35b5a70844c8a0f6bc8e9dd8e0055cf5597b07 (diff)
Resolves: tdf#69042 - Add a "What's New" infobar
Shows an infobar with a link to the respective wiki page Adds a button to the About dialog Replaces If6eb1542d2ad310226f76850f480f2f99070b803 Change-Id: I1eeb504994a6364feb90cfa447029875e0ec1969 Reviewed-on: https://gerrit.libreoffice.org/72218 Tested-by: Jenkins Reviewed-by: Heiko Tietze <tietze.heiko@gmail.com> Tested-by: Heiko Tietze <tietze.heiko@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/sdi/appslots.sdi4
-rw-r--r--sfx2/sdi/sfx.sdi14
-rw-r--r--sfx2/source/appl/appserv.cxx9
-rw-r--r--sfx2/source/view/viewfrm.cxx48
4 files changed, 66 insertions, 9 deletions
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index e46e29741243..c1444d478a68 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -136,6 +136,10 @@ interface Application
[
ExecMethod = MiscExec_Impl ;
]
+ SID_WHATSNEW
+ [
+ ExecMethod = MiscExec_Impl ;
+ ]
SID_SHOW_LICENSE
[
ExecMethod = MiscExec_Impl ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 1794527ef78d..d3e1157d96e2 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4945,7 +4945,21 @@ SfxVoidItem GetInvolved SID_GETINVOLVED
MenuConfig = TRUE,
GroupId = SfxGroupId::Application;
]
+SfxVoidItem WhatsNew SID_WHATSNEW
+()
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ GroupId = SfxGroupId::Application;
+]
SfxVoidItem ShowLicense SID_SHOW_LICENSE
()
[
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 8de0d32cbf21..c5f09027700c 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -585,6 +585,15 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
sfx2::openUriExternally(sURL, false);
break;
}
+ case SID_WHATSNEW:
+ {
+ // Open release notes depending on version and locale
+ OUString sURL(officecfg::Office::Common::Menus::ReleaseNotesURL::get() + //https://hub.libreoffice.org/ReleaseNotes/
+ "?LOvers=" + utl::ConfigManager::getProductVersion() +
+ "&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getLanguage() );
+ sfx2::openUriExternally(sURL, false);
+ break;
+ }
case SID_SHOW_LICENSE:
{
LicenseDialog aDialog(rReq.GetFrameWeld());
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 897bd9f5b180..18d71c170ea9 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1221,14 +1221,39 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
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;
}
+
+ //what's new infobar
+ if (!officecfg::Setup::Product::ooSetupLastVersion::isReadOnly()) //don't show/update when readonly
+ {
+ OUString sSetupVersion = utl::ConfigManager::getProductVersion();
+ sal_Int32 iCurrent = sSetupVersion.getToken(0,'.').toInt32() * 10 + sSetupVersion.getToken(1,'.').toInt32();
+ OUString sLastVersion = utl::ConfigManager::getLastProductVersion();
+ if (sLastVersion.isEmpty()) sLastVersion="0.0";
+ sal_Int32 iLast = sLastVersion.getToken(0,'.').toInt32() * 10 + sLastVersion.getToken(1,'.').toInt32();
+ if ((iCurrent > iLast) && !Application::IsHeadlessModeEnabled() && !bIsUITest)
+ {
+ VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", SfxResId(STR_WHATSNEW_TEXT), InfoBarType::Info);
+ VclPtrInstance<PushButton> xWhatsNewButton(&GetWindow());
+ xWhatsNewButton->SetText(SfxResId(STR_WHATSNEW_BUTTON));
+ xWhatsNewButton->SetSizePixel(xWhatsNewButton->GetOptimalSize());
+ xWhatsNewButton->SetClickHdl(LINK(this, SfxViewFrame, WhatsNewHandler));
+ pInfoBar->addButton(xWhatsNewButton);
+
+ //update lastversion
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch);
+ batch->commit();
+ }
+ }
+
+ // 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
@@ -1279,13 +1304,13 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{
bUpdateLastTimeDonateShown = true;
- VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("getdonate", SfxResId(STR_GET_DONATE_TEXT), InfoBarType::Info);
+ VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("donate", SfxResId(STR_DONATE_TEXT), InfoBarType::Info);
- VclPtrInstance<PushButton> xGetDonateButton(&GetWindow());
- xGetDonateButton->SetText(SfxResId(STR_GET_DONATE_BUTTON));
- xGetDonateButton->SetSizePixel(xGetDonateButton->GetOptimalSize());
- xGetDonateButton->SetClickHdl(LINK(this, SfxViewFrame, GetDonateHandler));
- pInfoBar->addButton(xGetDonateButton);
+ VclPtrInstance<PushButton> xDonateButton(&GetWindow());
+ xDonateButton->SetText(SfxResId(STR_DONATE_BUTTON));
+ xDonateButton->SetSizePixel(xDonateButton->GetOptimalSize());
+ xDonateButton->SetClickHdl(LINK(this, SfxViewFrame, DonationHandler));
+ pInfoBar->addButton(xDonateButton);
}
if (bUpdateLastTimeDonateShown
@@ -1419,12 +1444,17 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
}
+IMPL_LINK_NOARG(SfxViewFrame, WhatsNewHandler, Button*, void)
+{
+ GetDispatcher()->Execute(SID_WHATSNEW);
+}
+
IMPL_LINK_NOARG(SfxViewFrame, GetInvolvedHandler, Button*, void)
{
GetDispatcher()->Execute(SID_GETINVOLVED);
}
-IMPL_LINK_NOARG(SfxViewFrame, GetDonateHandler, Button*, void)
+IMPL_LINK_NOARG(SfxViewFrame, DonationHandler, Button*, void)
{
GetDispatcher()->Execute(SID_DONATION);
}