diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-11-20 12:40:10 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-11-20 15:32:35 +0100 |
commit | c4452078ca8142bdaf6ab7a00e039f64915cf35a (patch) | |
tree | f2ead1170d4d9fc17e08b01d5ed0d10b93d1ff8a /vcl | |
parent | 98c678527579d7fdd5a4811d9f5f05ae7fdb282b (diff) |
hide help buttons when LibreOfficeKit::isActive and local help unavailable
Change-Id: Ia263f9f7c78dbf48143678fc2f577402fb1ce998
Reviewed-on: https://gerrit.libreoffice.org/83309
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/builder.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 30 |
2 files changed, 30 insertions, 10 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 8e4113aee6da..900e9b6e9007 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -14,7 +14,9 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/packages/zip/ZipFileAccess.hpp> +#include <comphelper/lok.hxx> #include <i18nutil/unicode.hxx> +#include <officecfg/Office/Common.hxx> #include <osl/module.hxx> #include <osl/file.hxx> #include <sal/log.hxx> @@ -771,6 +773,14 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr SAL_WARN_IF(nButtons && !bHasDefButton, "vcl.layout", "No default button defined in " << sUIFile); } #endif + + const bool bHideHelp = comphelper::LibreOfficeKit::isActive() && + officecfg::Office::Common::Help::HelpRootURL::get().isEmpty(); + if (bHideHelp) + { + if (vcl::Window *pHelpButton = get<vcl::Window>("help")) + pHelpButton->Hide(); + } } VclBuilder::~VclBuilder() diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 532ec11ffe27..2a91e0706239 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -22,12 +22,14 @@ #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> +#include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/compbase.hxx> #include <comphelper/string.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> +#include <officecfg/Office/Common.hxx> #include <rtl/bootstrap.hxx> #include <sal/log.hxx> #include <svl/zforlist.hxx> @@ -7672,6 +7674,9 @@ private: void postprocess_widget(GtkWidget* pWidget) { + const bool bHideHelp = comphelper::LibreOfficeKit::isActive() && + officecfg::Office::Common::Help::HelpRootURL::get().isEmpty(); + //fixup icons //wanted: better way to do this, e.g. make gtk use gio for //loading from a filename and provide gio protocol handler @@ -7698,16 +7703,21 @@ private: //set helpids const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pWidget)); size_t nLen = pStr ? strlen(pStr) : 0; - if (!nLen) - return; - OString sHelpId = m_aUtf8HelpRoot + OString(pStr, nLen); - set_help_id(pWidget, sHelpId); - //hook up for extended help - const ImplSVData* pSVData = ImplGetSVData(); - if (pSVData->maHelpData.mbBalloonHelp && !GTK_IS_DIALOG(pWidget)) - { - gtk_widget_set_has_tooltip(pWidget, true); - g_signal_connect(pWidget, "query-tooltip", G_CALLBACK(signalTooltipQuery), nullptr); + if (nLen) + { + OString sBuildableName(pStr, nLen); + OString sHelpId = m_aUtf8HelpRoot + sBuildableName; + set_help_id(pWidget, sHelpId); + //hook up for extended help + const ImplSVData* pSVData = ImplGetSVData(); + if (pSVData->maHelpData.mbBalloonHelp && !GTK_IS_DIALOG(pWidget) && !GTK_IS_ASSISTANT(pWidget)) + { + gtk_widget_set_has_tooltip(pWidget, true); + g_signal_connect(pWidget, "query-tooltip", G_CALLBACK(signalTooltipQuery), nullptr); + } + + if (bHideHelp && sBuildableName == "help") + gtk_widget_hide(pWidget); } // expand placeholder and collect potentially missing mnemonics |