diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-12-29 08:59:54 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2021-01-20 21:17:22 +0100 |
commit | 90511b3c20be54284eaad1d3c888cf2d1ca16569 (patch) | |
tree | be0241fa3e5349b3daf394d0c2ac16306510dd53 /sfx2 | |
parent | 0e3c9d71c89226f1dbd929e9f6f0fbdcfe14248a (diff) |
lok: send sidebar dialog update to the right view.
SfxViewShell::Current() might point to wrong client,
not the actual owner of the sidebar. Better to use
the LOKNotifier which points to the correct view.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108444
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit a6a3b9b665a874e98cedebbb2566d57285a40772)
Change-Id: I2a3f18eaf51e4bf9a9f811595ec4fc02ce86fa7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109622
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/SidebarDockingWindow.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 302605d6a65a..737b9195b617 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -60,8 +60,12 @@ public: try { - auto pMobileNotifier = SfxViewShell::Current(); - if (pMobileNotifier && pMobileNotifier->isLOKMobilePhone()) + auto pNotifier = m_rSidebarDockingWin.GetLOKNotifier(); + if (!pNotifier) + return; + + const SfxViewShell* pOwnerView = dynamic_cast<const SfxViewShell*>(pNotifier); + if (pOwnerView && pOwnerView->isLOKMobilePhone()) { // Mobile phone. std::stringstream aStream; @@ -72,16 +76,12 @@ public: if (message != m_LastNotificationMessage) { m_LastNotificationMessage = message; - pMobileNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); + pOwnerView->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); } } // Notify the sidebar is created, and its LOKWindowId, which // is needed on mobile phones, tablets, and desktop. - auto pNotifier = m_rSidebarDockingWin.GetLOKNotifier(); - if (!pNotifier) - return; - const Point pos = Point(m_rSidebarDockingWin.GetOutOffXPixel(), m_rSidebarDockingWin.GetOutOffYPixel()); const OString posMessage = pos.toString(); |