diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-16 20:23:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-08-17 16:31:11 +0200 |
commit | d30ab819b80e67119e17d3e4243cab88c508ebae (patch) | |
tree | 89ae80196607983dd43645917639e5779c5a9018 /forms | |
parent | cd963fe2f8607dc829a529adfe3a8a7464835070 (diff) |
tdf#125340 transport preferred dialog parent down the migration dialog
Change-Id: Icb7bab35eac3ae08fb82d73f559ef161dd1820c3
Reviewed-on: https://gerrit.libreoffice.org/77606
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 4f621a7d5e60..41e94e519762 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2719,6 +2719,21 @@ void ODatabaseForm::stopSharingConnection( ) } } +namespace +{ + Reference<css::awt::XWindow> GetDialogParentWindow(const Reference<XModel>& rModel) + { + if (!rModel.is()) + return nullptr; + Reference<XController> xController(rModel->getCurrentController()); + if (!xController.is()) + return nullptr; + Reference<XFrame> xFrame(xController->getFrame()); + if (!xFrame.is()) + return nullptr; + return xFrame->getContainerWindow(); + } +} bool ODatabaseForm::implEnsureConnection() { @@ -2760,9 +2775,15 @@ bool ODatabaseForm::implEnsureConnection() if (m_xAggregateSet.is()) { + //Dig out a suitable parent for any warning dialogs + Reference<css::awt::XWindow> m_xDialogParent; + Reference<XChild> xParent(m_xParent, UNO_QUERY); + if (xParent.is()) + m_xDialogParent = GetDialogParentWindow(getXModel(xParent->getParent())); + Reference< XConnection > xConnection = connectRowset( Reference<XRowSet> (m_xAggregate, UNO_QUERY), - m_xContext + m_xContext, m_xDialogParent ); return xConnection.is(); } |