[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - svtools/source vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 20 14:33:34 UTC 2019


 svtools/source/dialogs/wizardmachine.cxx |    7 ++++++-
 vcl/source/window/builder.cxx            |   10 ++++++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx             |   30 ++++++++++++++++++++----------
 3 files changed, 36 insertions(+), 11 deletions(-)

New commits:
commit c4452078ca8142bdaf6ab7a00e039f64915cf35a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 20 12:40:10 2019 +0000
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Nov 20 15:32:35 2019 +0100

    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 at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index 0ec3e014aba3..f6b4c8059db3 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/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 <svtools/wizardmachine.hxx>
 #include <svtools/helpids.h>
 #include <tools/debug.hxx>
@@ -119,9 +121,12 @@ namespace svt
     {
         m_pImpl->sTitleBase = GetText();
 
+        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_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP);
             m_pHelp->SetSizePixel(LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)));
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


More information about the Libreoffice-commits mailing list