desktop/source/deployment/gui/dp_gui_dialog2.cxx | 11 ++---- desktop/source/deployment/gui/dp_gui_service.cxx | 9 ++-- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 38 +++++++++------------ desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 14 +++---- 4 files changed, 33 insertions(+), 39 deletions(-)
New commits: commit 162e8e6fecb70a924ad5ca4a4b3c7111bcc3490c Author: Michael Weghorn <[email protected]> AuthorDate: Mon Nov 10 11:04:54 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Nov 10 23:11:32 2025 +0100 tdf#169318 extension mgr: Close dialog on restart, too When the "Close" button in the "Extensions" dialog was pressed after doing modifications, always close the dialog, also when restarting LO. Since the button to close the dialog was pressed, I don't see any reason to not always do it, and not doing so would result in LO not restarting directly any more when using the qt6 VCL plugin after Change-Id: Ieb7d7b564140b34ff5875d2e26a777b9932cfa2d Author: Michael Weghorn <[email protected]> Date: Fri Nov 7 14:23:57 2025 +0100 tdf#169318 tdf#127201 extension mgr: Set dialog parent, make modal Sample scenario: * start Writer * "Tools" -> "Extensions" * click "Add" button * select an extension e.g. a version of the English dictionary [1] downloaded previously * select to install for current user only * click the "Close" button * In the dialog asking whether to restart LO, select "Restart Now" Without this commit in place, the restart wouldn't happen at least with qt6, but LO would still have to be closed manually. [1] https://extensions.libreoffice.org/en/extensions/show/english-dictionaries Change-Id: Ida24edcf7492e7df24e8448d4486e4c818634956 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193731 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 18abf015150b..e56927ae3173 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -554,8 +554,6 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, weld::Button&, void) IMPL_LINK_NOARG(ExtMgrDialog, HandleCloseBtn, weld::Button&, void) { - bool bCallClose = true; - //only suggest restart if modified and this is the first close attempt if (!m_bClosed && m_rManager.isModified()) { @@ -565,14 +563,13 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleCloseBtn, weld::Button&, void) if (dp_misc::office_is_running()) { SolarMutexGuard aGuard; - bCallClose = !::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), + svtools::executeRestartDialog(comphelper::getProcessComponentContext(), m_xDialog.get(), svtools::RESTART_REASON_EXTENSION_INSTALL); } } - if (bCallClose) - m_xDialog->response(RET_CANCEL); + m_xDialog->response(RET_CANCEL); } IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void ) commit 5cf880d64315f295c8d5fb2b99925c81affbedb1 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Nov 7 23:54:33 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Nov 10 23:11:25 2025 +0100 tdf#169318 extension mgr: Pass parent to TheExtensionManager::createDialog So far, TheExtensionManager::m_xParent was holding the parent window passed in the first call to TheExtensionManager::get, and would use that when creating a dialog in TheExtensionManager::createDialog. Refactor this to instead pass the parent directly to TheExtensionManager::createDialog and drop TheExtensionManager::m_xParent. This addresses the problem mentioned in earlier commit Change-Id: Ieb7d7b564140b34ff5875d2e26a777b9932cfa2d commit d5eb72a31ebb3687d9d53dab7e8128825a9bae8f Author: Michael Weghorn <[email protected]> Date: Fri Nov 7 14:23:57 2025 +0100 tdf#169318 tdf#127201 extension mgr: Set dialog parent, make modal : > A remaining problem is that the parent for the > dialog in use is only set the first time the > dialog is opened, which can be seen e.g. as follows: > > 1) start Writer > 2) "Tools" -> "Extensions" > > -> Dialog opens modally on top of the Writer window > as expected > > 3) create another Writer doc > 4) close the first Writer window > 5) "Tools" -> "Extensions" > > -> The dialog doesn't open modally on top of the > Writer window and the problem described in tdf#169318 > is still reproducible. > > Consistently setting the passed parent will have to be > addressed separately in the dialog implementation itself. Now, the dialog opens properly modally on top of the second Writer window in step 5. With this commit in place, it's now also more obvious that no parent is currently set for UpdateRequiredDialog, as UpdateRequiredDialogService::execute passes an empty Reference for the parent (that was previously the default arg used for TheExtensionManager::get). Change-Id: Ifc06f093038812e262b5f35881701601b588bf19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193617 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index b70b7829262a..18abf015150b 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -1189,7 +1189,7 @@ sal_Int16 UpdateRequiredDialogService::execute() { ::rtl::Reference< ::dp_gui::TheExtensionManager > xManager( TheExtensionManager::get( m_xComponentContext) ); - xManager->createDialog( true ); + xManager->createDialog(true, {}); sal_Int16 nRet = xManager->execute(); return nRet; diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 96262006a8f2..ade7cb6fc47e 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -236,9 +236,10 @@ void ServiceImpl::startExecuteModal( { const SolarMutexGuard guard; - rtl::Reference<::dp_gui::TheExtensionManager> myExtMgr(::dp_gui::TheExtensionManager::get( - m_xComponentContext, m_parent ? *m_parent : Reference<awt::XWindow>())); - DialogHelper& rDialog = myExtMgr->createDialog(false); + rtl::Reference<::dp_gui::TheExtensionManager> myExtMgr( + dp_gui::TheExtensionManager::get(m_xComponentContext)); + DialogHelper& rDialog + = myExtMgr->createDialog(false, m_parent ? *m_parent : Reference<awt::XWindow>()); if (m_extensionURL) myExtMgr->installPackage(*m_extensionURL, rDialog, true); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 3554e10c0fd6..04d1e08077db 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -53,13 +53,10 @@ namespace dp_gui { // TheExtensionManager - -TheExtensionManager::TheExtensionManager( uno::Reference< awt::XWindow > xParent, - const uno::Reference< uno::XComponentContext > &xContext ) : - m_xContext( xContext ), - m_xParent(std::move( xParent )), - m_bModified(false), - m_bExtMgrDialogExecuting(false) +TheExtensionManager::TheExtensionManager(const uno::Reference<uno::XComponentContext>& xContext) + : m_xContext(xContext) + , m_bModified(false) + , m_bExtMgrDialogExecuting(false) { m_xExtensionManager = deployment::ExtensionManager::get( xContext ); m_xExtensionManager->addModifyListener( this ); @@ -105,7 +102,9 @@ TheExtensionManager::~TheExtensionManager() Close(); } -DialogHelper& TheExtensionManager::createDialog(const bool bCreateUpdDlg) +DialogHelper& +TheExtensionManager::createDialog(const bool bCreateUpdDlg, + const css::uno::Reference<css::awt::XWindow>& xParent) { const SolarMutexGuard guard; @@ -114,7 +113,7 @@ DialogHelper& TheExtensionManager::createDialog(const bool bCreateUpdDlg) if ( !m_xUpdReqDialog ) { m_xUpdReqDialog.reset( - new UpdateRequiredDialog(Application::GetFrameWeld(m_xParent), *this)); + new UpdateRequiredDialog(Application::GetFrameWeld(xParent), *this)); m_xExecuteCmdQueue.reset(new ExtensionCmdQueue(*m_xUpdReqDialog, *this, m_xContext)); createPackageList(); } @@ -123,8 +122,7 @@ DialogHelper& TheExtensionManager::createDialog(const bool bCreateUpdDlg) if (!m_xExtMgrDialog) { - m_xExtMgrDialog - = std::make_shared<ExtMgrDialog>(Application::GetFrameWeld(m_xParent), *this); + m_xExtMgrDialog = std::make_shared<ExtMgrDialog>(Application::GetFrameWeld(xParent), *this); m_xExecuteCmdQueue.reset(new ExtensionCmdQueue(*m_xExtMgrDialog, *this, m_xContext)); m_xExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL ); createPackageList(); @@ -467,8 +465,7 @@ void TheExtensionManager::modified( ::lang::EventObject const & /*rEvt*/ ) } ::rtl::Reference<TheExtensionManager> -TheExtensionManager::get(const uno::Reference<uno::XComponentContext>& xContext, - const uno::Reference<awt::XWindow>& xParent) +TheExtensionManager::get(const uno::Reference<uno::XComponentContext>& xContext) { if ( s_ExtMgr.is() ) { @@ -476,7 +473,7 @@ TheExtensionManager::get(const uno::Reference<uno::XComponentContext>& xContext, return s_ExtMgr; } - ::rtl::Reference<TheExtensionManager> that( new TheExtensionManager( xParent, xContext ) ); + ::rtl::Reference<TheExtensionManager> that(new TheExtensionManager(xContext)); const SolarMutexGuard guard; if ( ! s_ExtMgr.is() ) diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index eb1886e63b7a..8e85372344df 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -47,7 +47,6 @@ private: css::uno::Reference< css::frame::XDesktop2 > m_xDesktop; css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager; css::uno::Reference< css::container::XNameAccess > m_xNameAccessNodes; - css::uno::Reference< css::awt::XWindow > m_xParent; std::shared_ptr<ExtMgrDialog> m_xExtMgrDialog; std::unique_ptr<UpdateRequiredDialog> m_xUpdReqDialog; std::unique_ptr<ExtensionCmdQueue> m_xExecuteCmdQueue; @@ -59,11 +58,11 @@ private: public: static ::rtl::Reference<TheExtensionManager> s_ExtMgr; - TheExtensionManager( css::uno::Reference< css::awt::XWindow > xParent, - const css::uno::Reference< css::uno::XComponentContext > &xContext ); - virtual ~TheExtensionManager() override; + TheExtensionManager(const css::uno::Reference<css::uno::XComponentContext>& xContext); + virtual ~TheExtensionManager() override; - DialogHelper& createDialog(const bool bCreateUpdDlg); + DialogHelper& createDialog(const bool bCreateUpdDlg, + const css::uno::Reference<css::awt::XWindow>& xParent); sal_Int16 execute(); bool isModified() const { return m_bModified; } @@ -106,8 +105,7 @@ public: bool isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const; static ::rtl::Reference<TheExtensionManager> - get(css::uno::Reference<css::uno::XComponentContext> const& xContext, - css::uno::Reference<css::awt::XWindow> const& xParent = nullptr); + get(css::uno::Reference<css::uno::XComponentContext> const& xContext); // XEventListener virtual void SAL_CALL disposing( css::lang::EventObject const & evt ) override; commit 530c6ccb42cc6a67efe648b6f16ea0c5ce03e14e Author: Michael Weghorn <[email protected]> AuthorDate: Fri Nov 7 23:26:52 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Nov 10 23:11:18 2025 +0100 tdf#169318 extension mgr: Don't create dlg in installPackage() Refactor code a bit to avoid creating a dialog in TheExtensionManager::installPackage, in preparation of letting TheExtensionManager::createDialog take a param for the parent of the dialog to create: * In TheExtensionManager::createDialog, return the dialog of interest. * In TheExtensionManager::installPackage, take a DialogHelper& param, instead of calling TheExtensionManager::createDialog to ensure that one exists. * In ServiceImpl::startExecuteModal, create the dialog first, then pass it as a param when calling TheExtensionManager::installPackage. Change-Id: I935a7378e004d9ec1f88f73ec947f254316f5f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193616 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 80accda30d98..b70b7829262a 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -690,7 +690,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleAddBtn, weld::Button&, void) if ( aFileList.hasElements() ) { - m_rManager.installPackage(aFileList[0]); + m_rManager.installPackage(aFileList[0], *this); } decBusy(); diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index b36c35c78ceb..96262006a8f2 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -238,10 +238,10 @@ void ServiceImpl::startExecuteModal( const SolarMutexGuard guard; rtl::Reference<::dp_gui::TheExtensionManager> myExtMgr(::dp_gui::TheExtensionManager::get( m_xComponentContext, m_parent ? *m_parent : Reference<awt::XWindow>())); + DialogHelper& rDialog = myExtMgr->createDialog(false); if (m_extensionURL) - myExtMgr->installPackage(*m_extensionURL, true); + myExtMgr->installPackage(*m_extensionURL, rDialog, true); - myExtMgr->createDialog( false ); if (!m_sTitle.isEmpty()) { myExtMgr->SetText(m_sTitle); } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 84e003ade12a..3554e10c0fd6 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -105,7 +105,7 @@ TheExtensionManager::~TheExtensionManager() Close(); } -void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) +DialogHelper& TheExtensionManager::createDialog(const bool bCreateUpdDlg) { const SolarMutexGuard guard; @@ -118,8 +118,10 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) m_xExecuteCmdQueue.reset(new ExtensionCmdQueue(*m_xUpdReqDialog, *this, m_xContext)); createPackageList(); } + return *m_xUpdReqDialog; } - else if ( !m_xExtMgrDialog ) + + if (!m_xExtMgrDialog) { m_xExtMgrDialog = std::make_shared<ExtMgrDialog>(Application::GetFrameWeld(m_xParent), *this); @@ -127,6 +129,7 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) m_xExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL ); createPackageList(); } + return *m_xExtMgrDialog; } void TheExtensionManager::Show() @@ -232,20 +235,18 @@ void TheExtensionManager::checkUpdates() m_xExecuteCmdQueue->checkForUpdates( std::move(vEntries) ); } - -bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWarnUser ) +bool TheExtensionManager::installPackage(const OUString& rPackageURL, DialogHelper& rDialog, + bool bWarnUser) { if ( rPackageURL.isEmpty() ) return false; - createDialog( false ); - bool bInstall = true; bool bInstallForAll = false; // DV! missing function is read only repository from extension manager if ( !bWarnUser && ! m_xExtensionManager->isReadOnlyRepository( SHARED_PACKAGE_MANAGER ) ) - bInstall = getDialogHelper()->installForAllUsers( bInstallForAll ); + bInstall = rDialog.installForAllUsers(bInstallForAll); if ( !bInstall ) return false; diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 58aab0112076..eb1886e63b7a 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -63,7 +63,7 @@ public: const css::uno::Reference< css::uno::XComponentContext > &xContext ); virtual ~TheExtensionManager() override; - void createDialog( const bool bCreateUpdDlg ); + DialogHelper& createDialog(const bool bCreateUpdDlg); sal_Int16 execute(); bool isModified() const { return m_bModified; } @@ -93,7 +93,7 @@ public: void checkUpdates(); - bool installPackage( const OUString &rPackageURL, bool bWarnUser = false ); + bool installPackage(const OUString& rPackageURL, DialogHelper& rDialog, bool bWarnUser = false); void createPackageList(); void terminateDialog();
