Resolves tdf#161796 - Add a donate button to the start center
Set Common::Misc::ShowDonation to false in order to get the
legacy Extensions button
Icon by Muhammad Haq on freeicons.io (slightly modified)
Change-Id: I83d10d7230722d38914934d59d70ece471e62599
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169628
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/icon-themes/colibre/res/donate.png b/icon-themes/colibre/res/donate.png
new file mode 100644
index 0000000..6c93e5e
--- /dev/null
+++ b/icon-themes/colibre/res/donate.png
Binary files differ
diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index de1eae2..7c8bc8f 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -457,6 +457,9 @@
<prop oor:name="PerformFileExtCheck">
<value install:module="wnt">true</value>
</prop>
<prop oor:name="ShowDonation">
<value>true</value>
</prop>
</node>
<node oor:name="Save">
<node oor:name="ODF">
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 15b3a48..c2e0e971 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5367,6 +5367,12 @@
</info>
<value>false</value>
</prop>
<prop oor:name="ShowDonation" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Determines whether to show a donation button in the start center or extension.</desc>
</info>
<value>true</value>
</prop>
<prop oor:name="UseOpenCL" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Determines whether OpenCL can be used, when available, to speed up
diff --git a/sfx2/inc/bitmaps.hlst b/sfx2/inc/bitmaps.hlst
index 0484bb7..04169c3 100644
--- a/sfx2/inc/bitmaps.hlst
+++ b/sfx2/inc/bitmaps.hlst
@@ -95,4 +95,6 @@ inline constexpr OUString BMP_MENU_RENAME = u"cmd/sc_editdoc.png"_ustr;
inline constexpr OUString BMP_MENU_DELETE = u"cmd/sc_delete.png"_ustr;
inline constexpr OUString BMP_MENU_EXPORT = u"cmd/sc_exportto.png"_ustr;
inline constexpr OUString BMP_DONATE = u"res/donate.png"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index e376132..b4a5f11 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -56,6 +56,11 @@
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <officecfg/Office/Common.hxx>
#include <sfx2/strings.hrc>
#include <sfx2/sfxresid.hxx>
#include <bitmaps.hlst>
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
@@ -189,6 +194,13 @@ BackingWindow::BackingWindow(vcl::Window* i_pParent)
mxHelpButton->set_label(mxAltHelpLabel->get_label());
mxHelpButton->connect_clicked(LINK(this, BackingWindow, ClickHelpHdl));
// tdf#161796 make the extension button show the donation page
if (officecfg::Office::Common::Misc::ShowDonation::get())
{
mxExtensionsButton->set_label(SfxResId(STR_DONATE_BUTTON));
mxExtensionsButton->set_from_icon_name(BMP_DONATE);
}
mxDropTarget = mxAllRecentThumbnails->GetDropTarget();
try
@@ -533,9 +545,15 @@ IMPL_LINK(BackingWindow, ExtLinkClickHdl, weld::Button&, rButton,void)
try
{
OUString sURL(officecfg::Office::Common::Menus::ExtensionsURL::get() +
"?LOvers=" + utl::ConfigManager::getProductVersion() +
"&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47() );
OUString sURL;
if (officecfg::Office::Common::Misc::ShowDonation::get())
sURL = officecfg::Office::Common::Menus::DonationURL::get() +
"?BCP47=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47() +
"&LOlang=" + LanguageTag(utl::ConfigManager::getUILocale()).getLanguage();
else
sURL = officecfg::Office::Common::Menus::ExtensionsURL::get() +
"?LOvers=" + utl::ConfigManager::getProductVersion() +
"&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47();
Reference<css::system::XSystemShellExecute> const
xSystemShellExecute(