summaryrefslogtreecommitdiff
path: root/sfx2/source/view
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/view')
-rw-r--r--sfx2/source/view/viewfrm.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 0bfe4aeb019e..a31652baee40 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <officecfg/Office/Common.hxx>
+#include <officecfg/Setup.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/splitwin.hxx>
#include <unotools/moduleoptions.hxx>
@@ -105,6 +106,7 @@ using ::com::sun::star::container::XIndexContainer;
#include <sfx2/objface.hxx>
#include <openflag.hxx>
#include <objshimp.hxx>
+#include <openuriexternally.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/bindings.hxx>
@@ -1213,6 +1215,35 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
rBind.Invalidate( SID_RELOAD );
rBind.Invalidate( SID_EDITDOC );
+ // inform about the community involvement
+ const sal_Int64 nLastShown = 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 * 30); // 30 days in seconds
+ bool bUpdateLastTimeGetInvolvedShown = false;
+
+ if (nLastShown == 0)
+ bUpdateLastTimeGetInvolvedShown = true;
+ else if (nPeriodSec < nNow && nLastShown < nNow - nPeriodSec)
+ {
+ bUpdateLastTimeGetInvolvedShown = true;
+
+ VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("getinvolved", SfxResId(STR_GET_INVOLVED_TEXT), InfoBarType::Info);
+
+ VclPtrInstance<PushButton> xGetInvolvedButton(&GetWindow());
+ xGetInvolvedButton->SetText(SfxResId(STR_GET_INVOLVED_BUTTON));
+ xGetInvolvedButton->SetSizePixel(xGetInvolvedButton->GetOptimalSize());
+ xGetInvolvedButton->SetClickHdl(LINK(this, SfxViewFrame, GetInvolvedHandler));
+ pInfoBar->addButton(xGetInvolvedButton);
+ }
+
+ if (bUpdateLastTimeGetInvolvedShown)
+ {
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ officecfg::Setup::Product::LastTimeGetInvolvedShown::set(nNow, batch);
+ batch->commit();
+ }
+
+ // read-only infobar if necessary
const SfxViewShell *pVSh;
const SfxShell *pFSh;
if ( m_xObjSh->IsReadOnly() &&
@@ -1335,6 +1366,17 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
}
+IMPL_LINK_NOARG(SfxViewFrame, GetInvolvedHandler, Button*, void)
+{
+ try
+ {
+ sfx2::openUriExternally("https://tdf.io/joinus", false);
+ }
+ catch (const Exception&)
+ {
+ }
+}
+
IMPL_LINK(SfxViewFrame, SwitchReadOnlyHandler, Button*, pButton, void)
{
if (m_xObjSh.is() && IsSignPDF(m_xObjSh))