summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-15 20:29:40 +0100
committerAndras Timar <andras.timar@collabora.com>2019-09-05 12:32:34 +0200
commitab72c996352611bb7123dd2ddc45d55aa6944256 (patch)
treed4a245d62bf1e438f3965137938ea79d8fddc173 /vcl/unx
parent2b802429df9ef3f802da269b29f9e872dc254c0f (diff)
tdf#126007 tdf#122355 online help won't look into a dialog notebook
when the focus is on the help button, offline will through the help fallback route, but online will just fire and forget and let the server side do a fallback, which can't know what the current notebook page was. so bodge it to look at the notebook page right from the start if there is one and its the help button itself which starts the request Change-Id: Ida1d3101d838d99639dda12c438414c16b1ccda5 Reviewed-on: https://gerrit.libreoffice.org/77550 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx62
1 files changed, 43 insertions, 19 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 9831762f4a43..532ec11ffe27 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7851,6 +7851,31 @@ public:
m_aMnemonicButtons.clear();
}
+ OString get_current_page_help_id()
+ {
+ OString sPageHelpId;
+ // check to see if there is a notebook called tabcontrol and get the
+ // helpid for the current page of that
+ std::unique_ptr<weld::Notebook> xNotebook(weld_notebook("tabcontrol", false));
+ if (xNotebook)
+ {
+ if (GtkInstanceContainer* pPage = dynamic_cast<GtkInstanceContainer*>(xNotebook->get_page(xNotebook->get_current_page_ident())))
+ {
+ GtkWidget* pContainer = pPage->getWidget();
+ GList* pChildren = gtk_container_get_children(GTK_CONTAINER(pContainer));
+ GList* pChild = g_list_first(pChildren);
+ if (pChild)
+ {
+ GtkWidget* pPageWidget = static_cast<GtkWidget*>(pChild->data);
+ sPageHelpId = ::get_help_id(pPageWidget);
+ }
+ g_list_free(pChildren);
+ }
+ }
+ return sPageHelpId;
+ }
+
+
virtual ~GtkInstanceBuilder() override
{
g_slist_free(m_pObjectList);
@@ -8147,7 +8172,22 @@ void GtkInstanceWindow::help()
bool bRunNormalHelpRequest = !m_aHelpRequestHdl.IsSet() || m_aHelpRequestHdl.Call(*pSource);
Help* pHelp = bRunNormalHelpRequest ? Application::GetHelp() : nullptr;
if (pHelp)
+ {
+ // tdf#126007, there's a nice fallback route for offline help where
+ // the current page of a notebook will get checked when the help
+ // button is pressed and there was no help for the dialog found.
+ //
+ // But for online help that route doesn't get taken, so bodge this here
+ // by using the page help id if available and if the help button itself
+ // was the original id
+ if (m_pBuilder && sHelpId.endsWith("/help"))
+ {
+ OString sPageId = m_pBuilder->get_current_page_help_id();
+ if (!sPageId.isEmpty())
+ sHelpId = sPageId;
+ }
pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), pSource);
+ }
}
//iterate upwards through the hierarchy from this widgets through its parents
@@ -8161,25 +8201,9 @@ void GtkInstanceWidget::help_hierarchy_foreach(const std::function<bool(const OS
// called tabcontrol, and try the help for the current page of that first
if (m_pBuilder && GTK_IS_DIALOG(pParent))
{
- std::unique_ptr<weld::Notebook> xNotebook(m_pBuilder->weld_notebook("tabcontrol", false));
- if (xNotebook)
- {
- if (GtkInstanceContainer* pPage = dynamic_cast<GtkInstanceContainer*>(xNotebook->get_page(xNotebook->get_current_page_ident())))
- {
- bool bFinished = false;
- GtkWidget* pContainer = pPage->getWidget();
- GList* pChildren = gtk_container_get_children(GTK_CONTAINER(pContainer));
- GList* pChild = g_list_first(pChildren);
- if (pChild)
- {
- GtkWidget* pPageWidget = static_cast<GtkWidget*>(pChild->data);
- bFinished = func(::get_help_id(pPageWidget));
- }
- g_list_free(pChildren);
- if (bFinished)
- return;
- }
- }
+ OString sPageHelpId(m_pBuilder->get_current_page_help_id());
+ if (!sPageHelpId.isEmpty() && func(sPageHelpId))
+ return;
}
if (func(::get_help_id(pParent)))
return;