summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-07-06 14:15:17 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-07-06 14:50:59 +0200
commit74e69e555cc2b93df6b2be166aa1c70a99afa177 (patch)
tree07c9d39b9997fd242c6ff4e633e22babc0d4c4b4 /sfx2
parentbf9e72399e65ec6fc2a9149fa2ba884732362bd8 (diff)
jsdialog: sidebar: send message on sidebar close
Revert needed code removed in 64bd4dd Change-Id: If45facbd68ea8f3af433b78e127fbb0745e62c25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118483 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 0f46d910d2cc..64dbe4343b14 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -44,6 +44,7 @@
#include <vcl/svapp.hxx>
#include <splitwin.hxx>
#include <tools/diagnose_ex.h>
+#include <tools/json_writer.hxx>
#include <tools/link.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
@@ -1209,6 +1210,31 @@ IMPL_LINK(SidebarController, OnSubMenuItemSelected, const OString&, rCurItemId,
void SidebarController::RequestCloseDeck()
{
+ if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck)
+ {
+ const SfxViewShell* pViewShell = SfxViewShell::Current();
+ if (pViewShell && pViewShell->isLOKMobilePhone())
+ {
+ // Mobile phone - TODO: unify with desktop
+ tools::JsonWriter aJsonWriter;
+ aJsonWriter.put("id", mpParentWindow->get_id());
+ aJsonWriter.put("type", "dockingwindow");
+ aJsonWriter.put("text", mpParentWindow->GetText());
+ aJsonWriter.put("enabled", false);
+ const std::string message = aJsonWriter.extractAsStdString();
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
+ }
+ else if (pViewShell)
+ {
+ tools::JsonWriter aJsonWriter;
+ aJsonWriter.put("id", mpParentWindow->get_id());
+ aJsonWriter.put("action", "close");
+ aJsonWriter.put("jsontype", "sidebar");
+ const std::string message = aJsonWriter.extractAsStdString();
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
+ }
+ }
+
mbIsDeckRequestedOpen = false;
UpdateDeckOpenState();