diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-03-06 11:11:57 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-06-20 20:36:25 +0200 |
commit | 292d9519bd368db69920cf0f8b94e0e51c3d14a1 (patch) | |
tree | 4d4220e44833022ee72e36d85b9ce93f603fa1c7 /desktop | |
parent | 5c44f1ef779bf196f874f47c14d2d0c7f58fbb2e (diff) |
jsdialog: remember weld instances
Change-Id: Ie55e0fcd2307679aee52751b2d2e434393850418
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94302
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96735
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8bbec959b44f..357111d220af 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3588,7 +3588,6 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin StringMap aMap(jsonToStringMap(pArguments)); VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nWindowId); - JSInstanceBuilder* pBuilder = JSInstanceBuilder::FindLOKWeldBuilder(nWindowId); if (!pWindow && nWindowId >= 1000000000 /* why unsigned? */) pWindow = getSidebarWindow(); @@ -3610,18 +3609,20 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin try { - bool bIsWeldedDialog = pBuilder != nullptr; + OString sControlId = OUStringToOString(aMap["id"], RTL_TEXTENCODING_ASCII_US); + weld::Widget* pWidget = JSInstanceBuilder::FindWeldWidgetsMap(nWindowId, sControlId); + + bool bIsWeldedDialog = pWidget != nullptr; bool bContinueWithLOKWindow = false; if (bIsWeldedDialog) { - OString sControlId = OUStringToOString(aMap["id"], RTL_TEXTENCODING_ASCII_US); OUString sControlType = aMap["type"]; OUString sAction = aMap["cmd"]; if (sControlType == "tabcontrol") { - auto pNotebook = pBuilder->weld_notebook(sControlId, false); + auto pNotebook = dynamic_cast<weld::Notebook*>(pWidget); if (pNotebook) { if (sAction == "selecttab") @@ -3637,7 +3638,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin } else if (sControlType == "combobox") { - auto pCombobox = pBuilder->weld_combo_box(sControlId, false); + auto pCombobox = dynamic_cast<weld::ComboBox*>(pWidget); if (pCombobox) { if (sAction == "selected") @@ -3651,6 +3652,11 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin pCombobox->set_active(pos); } } + else if (sAction == "change") + { + pCombobox->set_entry_text(aMap["data"]); + pCombobox->signal_changed(); + } else bContinueWithLOKWindow = true; } |