diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-29 09:36:50 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-02-04 13:00:24 +0100 |
commit | 9fd34175c7439dc48fd81a69fe4c1bc824c4c92d (patch) | |
tree | 1b39ebb3aa6a46868ebc098fbb80b0873fe69a91 | |
parent | 249ff23cb9c64e501879066a4d6d013ff82d7651 (diff) |
jsdialog: updates in similar fashion like other messages
to unify all jsdialog interactions
Change-Id: I22e14282f5a2c52ef44e68cb39338600004c4e24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108435
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109783
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index d3c7f8f8764c..9829ca49d9ae 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -96,6 +96,7 @@ void JSDialogNotifyIdle::updateStatus(VclPtr<vcl::Window> pWindow) if (!m_aNotifierWindow) return; + // will be deprecated soon if (m_aNotifierWindow->IsReallyVisible()) { if (const vcl::ILibreOfficeKitNotifier* pNotifier = m_aNotifierWindow->GetLOKNotifier()) @@ -119,10 +120,25 @@ void JSDialogNotifyIdle::updateStatus(VclPtr<vcl::Window> pWindow) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); const std::string message = aStream.str(); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, - message.c_str()); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, message.c_str()); } } + + // new approach - update also if hidden + if (const vcl::ILibreOfficeKitNotifier* pNotifier = m_aNotifierWindow->GetLOKNotifier()) + { + boost::property_tree::ptree aTree; + + aTree.put("jsontype", m_sTypeOfJSON); + aTree.put("action", "update"); + aTree.put("id", m_aNotifierWindow->GetLOKWindowId()); + aTree.add_child("control", pWindow->DumpAsPropertyTree()); + + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + const std::string message = aStream.str(); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); + } } boost::property_tree::ptree JSDialogNotifyIdle::generateCloseMessage() const @@ -465,7 +481,8 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id, return pRet; } -std::unique_ptr<weld::MessageDialog> JSInstanceBuilder::weld_message_dialog(const OString& id, bool bTakeOwnership) +std::unique_ptr<weld::MessageDialog> JSInstanceBuilder::weld_message_dialog(const OString& id, + bool bTakeOwnership) { std::unique_ptr<weld::MessageDialog> pRet; ::MessageDialog* pMessageDialog = m_xBuilder->get<::MessageDialog>(id); |