diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-11-20 12:40:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-11-20 15:59:12 +0100 |
commit | 5b20135a942328bfe5160ba2efa43b1ea9f0239c (patch) | |
tree | 764f57d1e2d01177495840d5cb9e08d9af56442d /vcl | |
parent | 8d8835c55648650276a438b74f694ee5c890b828 (diff) |
hide help buttons when LibreOfficeKit::isActive and local help unavailable
Change-Id: Ia263f9f7c78dbf48143678fc2f577402fb1ce998
Reviewed-on: https://gerrit.libreoffice.org/83304
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/wizardmachine.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 29 |
3 files changed, 34 insertions, 11 deletions
diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx index cb73add6300f..cbcea92343ad 100644 --- a/vcl/source/control/wizardmachine.cxx +++ b/vcl/source/control/wizardmachine.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <comphelper/lok.hxx> +#include <officecfg/Office/Common.hxx> #include <vcl/event.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> @@ -937,9 +939,11 @@ namespace vcl { m_pImpl->sTitleBase = m_xAssistant->get_title(); + const bool bHideHelp = comphelper::LibreOfficeKit::isActive() && + officecfg::Office::Common::Help::HelpRootURL::get().isEmpty(); // create the buttons according to the wizard button flags // the help button - if (nButtonFlags & WizardButtonFlags::HELP) + if (nButtonFlags & WizardButtonFlags::HELP && !bHideHelp) m_xHelp->show(); else m_xHelp->hide(); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 39ac93e3c820..5663a2e09989 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -13,7 +13,9 @@ #include <unordered_map> #include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <comphelper/lok.hxx> #include <i18nutil/unicode.hxx> +#include <officecfg/Office/Common.hxx> #include <osl/module.hxx> #include <sal/log.hxx> #include <unotools/localedatawrapper.hxx> @@ -795,6 +797,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 3bc15169c01f..8b944e23432b 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -49,6 +49,7 @@ #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> @@ -12357,6 +12358,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 @@ -12408,16 +12412,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_IS_ASSISTANT(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 |