summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-04 11:45:47 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-08-04 16:28:40 +0200
commitd84f7217b25bd3766497b17a8e057e3cbf4c8db8 (patch)
tree21ca700f6f54dd894d1749612f937f16a10b573a /framework/source
parent7f5cab0cf4aa25cf3b84a39b0f9e41de51928fbc (diff)
tdf#150249 close of popover not detected
the popover listened to here isn't the one that ends up getting actually used, its contents are transferred to another one, so the OnPopoverClosed wasn't called, its sufficient to just use the SubToolbarControl dtor to detect what is wanted here Change-Id: I3f4a038acfc183b863457919bf89d600517ddc01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137792 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/uielement/subtoolbarcontroller.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx
index c5aed8f7bf59..de345f545497 100644
--- a/framework/source/uielement/subtoolbarcontroller.cxx
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -46,7 +46,6 @@ namespace {
class SubToolBarController : public ToolBarBase
{
- DECL_LINK(OnPopoverClose, weld::Popover&, void);
OUString m_aSubTbName;
OUString m_aLastCommand;
css::uno::Reference< css::ui::XUIElement > m_xUIElement;
@@ -56,6 +55,8 @@ public:
const css::uno::Sequence< css::uno::Any >& rxArgs );
virtual ~SubToolBarController() override;
+ void PopoverDestroyed();
+
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rxArgs ) override;
@@ -209,22 +210,24 @@ namespace {
class SubToolbarControl final : public WeldToolbarPopup
{
public:
- explicit SubToolbarControl(css::uno::Reference< css::frame::XFrame > xFrame,
- weld::Widget* pParent);
+ explicit SubToolbarControl(SubToolBarController& rController, weld::Widget* pParent);
+ virtual ~SubToolbarControl() override;
virtual void GrabFocus() override;
weld::Container* GetContainer() { return m_xTargetContainer.get(); }
private:
+ SubToolBarController& m_rController;
std::unique_ptr<weld::Container> m_xTargetContainer;
};
}
-SubToolbarControl::SubToolbarControl(css::uno::Reference< css::frame::XFrame > xFrame,
+SubToolbarControl::SubToolbarControl(SubToolBarController& rController,
weld::Widget* pParent)
-: WeldToolbarPopup(xFrame, pParent, "svt/ui/subtoolbar.ui", "subtoolbar")
-, m_xTargetContainer(m_xBuilder->weld_container("container"))
+ : WeldToolbarPopup(rController.getFrameInterface(), pParent, "svt/ui/subtoolbar.ui", "subtoolbar")
+ , m_rController(rController)
+ , m_xTargetContainer(m_xBuilder->weld_container("container"))
{
}
@@ -233,11 +236,16 @@ void SubToolbarControl::GrabFocus()
// TODO
}
+SubToolbarControl::~SubToolbarControl()
+{
+ m_rController.PopoverDestroyed();
+}
+
std::unique_ptr<WeldToolbarPopup> SubToolBarController::weldPopupWindow()
{
SolarMutexGuard aGuard;
- auto pPopup = std::make_unique<SubToolbarControl>(getFrameInterface(), m_pToolbar);
+ auto pPopup = std::make_unique<SubToolbarControl>(*this, m_pToolbar);
css::uno::Reference< css::frame::XFrame > xFrame ( getFrameInterface() );
@@ -268,10 +276,6 @@ std::unique_ptr<WeldToolbarPopup> SubToolBarController::weldPopupWindow()
catch ( css::lang::IllegalArgumentException& )
{}
- weld::Popover* pPopover = dynamic_cast<weld::Popover*>(pPopup->getTopLevel());
- if (pPopover)
- pPopover->connect_closed(LINK(this, SubToolBarController, OnPopoverClose));
-
return pPopup;
}
@@ -501,7 +505,7 @@ void SubToolBarController::initialize( const css::uno::Sequence< css::uno::Any >
updateImage();
}
-IMPL_LINK_NOARG(SubToolBarController, OnPopoverClose, weld::Popover&, void)
+void SubToolBarController::PopoverDestroyed()
{
disposeUIElement();
m_xUIElement = nullptr;