summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/strings.hrc2
-rw-r--r--include/sfx2/viewfrm.hxx1
-rw-r--r--officecfg/registry/schema/org/openoffice/Setup.xcs6
-rw-r--r--sfx2/source/view/viewfrm.cxx38
4 files changed, 44 insertions, 3 deletions
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index ec2867206e54..a77dbc86d77d 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -246,6 +246,8 @@
#define STR_NONCHECKEDOUT_DOCUMENT NC_("STR_NONCHECKEDOUT_DOCUMENT", "This document is not checked out on the server.")
#define STR_GET_INVOLVED_TEXT NC_("STR_GET_INVOLVED_TEXT", "Help us make %PRODUCTNAME even better!")
#define STR_GET_INVOLVED_BUTTON NC_("STR_GET_INVOLVED_BUTTON", "Get involved")
+#define STR_GET_DONATE_TEXT NC_("STR_GET_DONATE_TEXT", "Your donations support our worldwide community.")
+#define STR_GET_DONATE_BUTTON NC_("STR_GET_DONATE_BUTTON", "Donate")
#define STR_READONLY_DOCUMENT NC_("STR_READONLY_DOCUMENT", "This document is open in read-only mode.")
#define STR_READONLY_PDF NC_("STR_READONLY_PDF", "This PDF is open in read-only mode to allow signing the existing file.")
#define STR_CLASSIFIED_DOCUMENT NC_("STR_CLASSIFIED_DOCUMENT", "The classification label of this document is %1.")
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 053ff2513d8e..6d9ef75b8ffe 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -77,6 +77,7 @@ protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
DECL_LINK(GetInvolvedHandler, Button*, void);
+ DECL_LINK(GetDonateHandler, Button*, void);
DECL_LINK(SwitchReadOnlyHandler, Button*, void);
DECL_LINK(SignDocumentHandler, Button*, void);
SAL_DLLPRIVATE void KillDispatcher_Impl();
diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs
index 3adfefa2d1fd..c9f8a309a204 100644
--- a/officecfg/registry/schema/org/openoffice/Setup.xcs
+++ b/officecfg/registry/schema/org/openoffice/Setup.xcs
@@ -295,6 +295,12 @@
</info>
<value>0</value>
</prop>
+ <prop oor:name="LastTimeDonateShown" oor:type="xs:long" oor:nillable="false">
+ <info>
+ <desc>The last time when the Donate infobar was shown.</desc>
+ </info>
+ <value>0</value>
+ </prop>
</group>
<group oor:name="Office">
<!--The default must be written by the setup.-->
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 8463b2366fbb..61cb945c738a 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1217,14 +1217,14 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
rBind.Invalidate( SID_EDITDOC );
// inform about the community involvement
- const sal_Int64 nLastShown = officecfg::Setup::Product::LastTimeGetInvolvedShown::get();
+ 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 nPeriodSec(60 * 60 * 24 * 180); // 180 days in seconds
bool bUpdateLastTimeGetInvolvedShown = false;
- if (nLastShown == 0)
+ if (nLastGetInvolvedShown == 0)
bUpdateLastTimeGetInvolvedShown = true;
- else if (nPeriodSec < nNow && nLastShown < nNow - nPeriodSec)
+ else if (nPeriodSec < nNow && nLastGetInvolvedShown < (nNow + nPeriodSec/2) - nPeriodSec) // 90d alternating with donation
{
bUpdateLastTimeGetInvolvedShown = true;
@@ -1245,6 +1245,33 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
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("getdonate", SfxResId(STR_GET_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);
+ }
+
+ 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();
+ }
+
// read-only infobar if necessary
const SfxViewShell *pVSh;
const SfxShell *pFSh;
@@ -1373,6 +1400,11 @@ IMPL_LINK_NOARG(SfxViewFrame, GetInvolvedHandler, Button*, void)
GetDispatcher()->Execute(SID_GETINVOLVED);
}
+IMPL_LINK_NOARG(SfxViewFrame, GetDonateHandler, Button*, void)
+{
+ GetDispatcher()->Execute(SID_DONATION);
+}
+
IMPL_LINK(SfxViewFrame, SwitchReadOnlyHandler, Button*, pButton, void)
{
if (m_xObjSh.is() && IsSignPDF(m_xObjSh))