summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-04 11:45:47 +0100
committerAndras Timar <andras.timar@collabora.com>2022-08-04 19:20:35 +0200
commit8d43e3bd3ee403600a1edf1c9624eb75ce3f3021 (patch)
treec3cde4a7a4811e85b5c21de801bd1d1aa60f7b2b
parente7c016e42b6c33774b28c3b10d0cc424137db9f7 (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/+/137732 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
-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 e02e4631bd6b..8731f311b7b0 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;