summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorGökay ŞATIR <gokaysatir@gmail.com>2021-08-31 13:01:31 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-31 15:05:43 +0200
commit643e0fe7fc16345e3f534f270f7eb5b5276e26a2 (patch)
tree6a68befd2d715836b444d663ffaa49ce96921a8f /desktop
parente5cfda76aefd6996813f461198816be24cd6ad43 (diff)
lokinteractionhandler: Use json_writer for JSon types.
This patch is for making more use of new json_writer class. Change-Id: Ic8dd6694887635a363a74d2cf5bd1e3e2987463d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121364 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/lokinteractionhandler.cxx23
1 files changed, 11 insertions, 12 deletions
diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx
index 325e5893184a..1e794c0ff651 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -49,6 +49,8 @@
#include <sfx2/viewsh.hxx>
#include <vcl/svapp.hxx>
+#include <tools/json_writer.hxx>
+
using namespace com::sun::star;
LOKInteractionHandler::LOKInteractionHandler(
@@ -99,7 +101,7 @@ void SAL_CALL LOKInteractionHandler::handle(
void LOKInteractionHandler::postError(css::task::InteractionClassification classif, const char* kind, ErrCode code, const OUString &message)
{
- const char *classification = "error";
+ std::string classification = "error";
switch (classif)
{
case task::InteractionClassification_ERROR: break;
@@ -110,21 +112,18 @@ void LOKInteractionHandler::postError(css::task::InteractionClassification class
}
// create the JSON representation
- boost::property_tree::ptree aTree;
- aTree.put("classification", classification);
- aTree.put("cmd", m_command.getStr());
- aTree.put("kind", kind);
- aTree.put("code", code);
- aTree.put("message", message.toUtf8());
-
- std::stringstream aStream;
- boost::property_tree::write_json(aStream, aTree);
+ tools::JsonWriter aJson;
+ aJson.put("classification", classification);
+ aJson.put("cmd", m_command.getStr());
+ aJson.put("kind", kind);
+ aJson.put("code", static_cast<sal_uInt32>(code));
+ aJson.put("message", message.toUtf8());
std::size_t nView = SfxViewShell::Current() ? SfxLokHelper::getView() : 0;
if (m_pLOKDocument && m_pLOKDocument->mpCallbackFlushHandlers.count(nView))
- m_pLOKDocument->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_ERROR, aStream.str().c_str());
+ m_pLOKDocument->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_ERROR, aJson.extractAsOString().getStr());
else if (m_pLOKit->mpCallback)
- m_pLOKit->mpCallback(LOK_CALLBACK_ERROR, aStream.str().c_str(), m_pLOKit->mpCallbackData);
+ m_pLOKit->mpCallback(LOK_CALLBACK_ERROR, aJson.extractAsOString().getStr(), m_pLOKit->mpCallbackData);
}
namespace {