summaryrefslogtreecommitdiff
path: root/vcl/jsdialog/jsdialogbuilder.cxx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-08-11 09:21:30 +0200
committerMichael Meeks <michael.meeks@collabora.com>2022-08-11 20:56:23 +0200
commit53a9745c2a1dc4444c659b954d7d6f0588ffb5d7 (patch)
treeaed33b4e27297ef73265d9bfffe782b8323c9e36 /vcl/jsdialog/jsdialogbuilder.cxx
parent09ac0b5b1b88c3e438ce98f175aef8e46f14f3b2 (diff)
jsdialog: send MessageDialog on run not when built cp-22.05.5-3
- some message boxes doesn't have correct notifier set initially - then when runAsync is called it is ok so we can remember widget Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I8ecf2d20ef4c2ebda3acf3b80bb390717b6caf6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138107 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/jsdialog/jsdialogbuilder.cxx')
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx45
1 files changed, 37 insertions, 8 deletions
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 11edcb26d94d..5c62face9769 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1174,18 +1174,14 @@ weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParen
aJsonWriter.put("jsontype", "dialog");
std::unique_ptr<char[], o3tl::free_delete> message(aJsonWriter.extractData());
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.get());
+
+ std::string sWindowId = std::to_string(xMessageDialog->GetLOKWindowId());
+ InsertWindowToMap(sWindowId);
}
xMessageDialog->SetLOKTunnelingState(false);
- std::string sWindowId = std::to_string(xMessageDialog->GetLOKWindowId());
- InsertWindowToMap(sWindowId);
-
- weld::MessageDialog* pRet = new JSMessageDialog(xMessageDialog, nullptr, true);
-
- if (pRet)
- RememberWidget(sWindowId, "__DIALOG__", pRet);
- return pRet;
+ return new JSMessageDialog(xMessageDialog, nullptr, true);
}
JSDialog::JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder,
@@ -1421,6 +1417,39 @@ JSMessageDialog::~JSMessageDialog()
JSInstanceBuilder::RemoveWindowWidget(m_sWindowId);
}
+void JSMessageDialog::RememberMessageDialog()
+{
+ static OStringLiteral sWidgetName = "__DIALOG__";
+ std::string sWindowId = std::to_string(m_xMessageDialog->GetLOKWindowId());
+ if (JSInstanceBuilder::FindWeldWidgetsMap(sWindowId, sWidgetName) != nullptr)
+ return;
+
+ JSInstanceBuilder::InsertWindowToMap(sWindowId);
+ JSInstanceBuilder::RememberWidget(sWindowId, sWidgetName, this);
+}
+
+bool JSMessageDialog::runAsync(std::shared_ptr<weld::DialogController> aOwner,
+ const std::function<void(sal_Int32)>& rEndDialogFn)
+{
+ bool bRet = SalInstanceMessageDialog::runAsync(aOwner, rEndDialogFn);
+
+ RememberMessageDialog();
+ sendFullUpdate();
+
+ return bRet;
+}
+
+bool JSMessageDialog::runAsync(std::shared_ptr<Dialog> const& rxSelf,
+ const std::function<void(sal_Int32)>& rEndDialogFn)
+{
+ bool bRet = SalInstanceMessageDialog::runAsync(rxSelf, rEndDialogFn);
+
+ RememberMessageDialog();
+ sendFullUpdate();
+
+ return bRet;
+}
+
IMPL_LINK_NOARG(JSMessageDialog, OKHdl, weld::Button&, void) { response(RET_OK); }
IMPL_LINK_NOARG(JSMessageDialog, CancelHdl, weld::Button&, void) { response(RET_CANCEL); }