vcl/jsdialog/jsdialogbuilder.cxx |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 9fd34175c7439dc48fd81a69fe4c1bc824c4c92d
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Dec 29 09:36:50 2020 +0100
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Thu Feb 4 13:00:24 2021 +0100

    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.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109783
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

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);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to