[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 20 20:43:42 UTC 2019


 vcl/source/control/wizardmachine.cxx |    6 +++++-
 vcl/source/window/builder.cxx        |   10 ++++++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx         |   29 +++++++++++++++++++----------
 3 files changed, 34 insertions(+), 11 deletions(-)

New commits:
commit a7cbedbcbeccf0c75760e39e7b88f41f350cd691
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 20 12:40:10 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Nov 20 21:42:43 2019 +0100

    hide help buttons when LibreOfficeKit::isActive and local help unavailable
    
    Change-Id: Ia263f9f7c78dbf48143678fc2f577402fb1ce998
    Reviewed-on: https://gerrit.libreoffice.org/83323
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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 398a194230b6..064322e9cae9 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>
@@ -12317,6 +12318,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
@@ -12368,16 +12372,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


More information about the Libreoffice-commits mailing list