desktop/source/deployment/gui/dp_gui_dialog2.cxx | 51 ++++----- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 9 - desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 67 +++++++------ 3 files changed, 70 insertions(+), 57 deletions(-)
New commits: commit 420297eabee8381926a5fbbf6944997c681e343b Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 24 10:30:42 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Feb 24 23:51:35 2026 +0100 extension mgr: Move DialogHelper::continueOnSharedExtension to ExtMgrDialog It's only used by that sublcass, so move it there. Also make it private, as it is internal logic. Move DialogHelper::IsSharedPkgMgr as well, which is now also only used by ExtMgrDialog. Change-Id: Ifaac7e9bdc231d5b26a3184cf6b15d2237d6d734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200154 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 a0e9c006e756..161f95e76d82 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -97,32 +97,6 @@ DialogHelper::~DialogHelper() Application::RemoveUserEvent( m_nEventID ); } - -bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > &xPackage ) -{ - return xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER; -} - -bool DialogHelper::continueOnSharedExtension(const uno::Reference<deployment::XPackage>& xPackage, - TranslateId pResID, bool& bHadWarning) -{ - if ( !bHadWarning && IsSharedPkgMgr( xPackage ) ) - { - const SolarMutexGuard guard; - incBusy(); - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( - m_xDialog.get(), VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(pResID))); - bHadWarning = true; - - bool bRet = RET_OK == xBox->run(); - xBox.reset(); - decBusy(); - return bRet; - } - else - return true; -} - void DialogHelper::openWebBrowser(const OUString& sURL, const OUString& sTitle) { if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty @@ -539,6 +513,31 @@ void ExtMgrDialog::enableButtontoEnable( bool bEnable ) } } +bool ExtMgrDialog::IsSharedPkgMgr(const uno::Reference<deployment::XPackage>& xPackage) +{ + return xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER; +} + +bool ExtMgrDialog::continueOnSharedExtension(const uno::Reference<deployment::XPackage>& xPackage, + TranslateId pResID, bool& bHadWarning) +{ + if (!bHadWarning && IsSharedPkgMgr(xPackage)) + { + const SolarMutexGuard guard; + incBusy(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( + m_xDialog.get(), VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(pResID))); + bHadWarning = true; + + bool bRet = RET_OK == xBox->run(); + xBox.reset(); + decBusy(); + return bRet; + } + else + return true; +} + IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, weld::Button&, void) { if ( m_xAbortChannel.is() ) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 87ec49773f77..1d3496ac6ffb 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -74,10 +74,6 @@ public: virtual void prepareChecking() = 0; virtual void checkEntries() = 0; - static bool IsSharedPkgMgr( const css::uno::Reference< css::deployment::XPackage > &); - bool continueOnSharedExtension(const css::uno::Reference<css::deployment::XPackage>&, - TranslateId pResID, bool& bHadWarning); - void incBusy() { m_aBusy.incBusy(m_xDialog.get()); } void decBusy() { m_aBusy.decBusy(); } bool isBusy() const { return m_aBusy.isBusy(); } @@ -169,6 +165,11 @@ public: * based on the value of bEnable. */ void enableButtontoEnable( bool bEnable ); + +private: + static bool IsSharedPkgMgr(const css::uno::Reference<css::deployment::XPackage>&); + bool continueOnSharedExtension(const css::uno::Reference<css::deployment::XPackage>&, + TranslateId pResID, bool& bHadWarning); }; class UpdateRequiredDialog : public DialogHelper commit e759b0f6eb95fafa570795a62b6b6a5e1c51859a Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 24 10:23:51 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Feb 24 23:51:29 2026 +0100 extension mgr: Make Input an enum class Change-Id: Iebd50ef845ee1ff6c5482f4edaf91d3161975c8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200153 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index bad8dcac47f2..fcaa162b688a 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -245,7 +245,7 @@ private: void _acceptLicense( ::rtl::Reference< ProgressCmdEnv > const &rCmdEnv, const uno::Reference< deployment::XPackage > &xPackage ); - enum Input { NONE, START, STOP }; + enum class Input { NONE, START, STOP }; uno::Reference< uno::XComponentContext > m_xContext; std::queue< TExtensionCmd > m_queue; @@ -597,7 +597,7 @@ ExtensionCmdQueue::Thread::Thread(DialogHelper& rDialogHelper, TheExtensionManag m_sRemovingPackages( DpResId( RID_STR_REMOVING_PACKAGES ) ), m_sDefaultCmd( DpResId( RID_STR_ADD_PACKAGES ) ), m_sAcceptLicense( DpResId( RID_STR_ACCEPT_LICENSE ) ), - m_eInput( NONE ), + m_eInput(Input::NONE), m_bStopped( false ), m_bWorking( false ) { @@ -665,7 +665,7 @@ void ExtensionCmdQueue::Thread::stop() { std::scoped_lock aGuard( m_mutex ); m_bStopped = true; - m_eInput = STOP; + m_eInput = Input::STOP; m_wakeup.notify_all(); } @@ -694,17 +694,17 @@ void ExtensionCmdQueue::Thread::execute() Input eInput; { std::unique_lock aGuard( m_mutex ); - while (m_eInput == NONE) { + while (m_eInput == Input::NONE) { m_wakeup.wait(aGuard); } eInput = m_eInput; - m_eInput = NONE; + m_eInput = Input::NONE; nSize = m_queue.size(); // coverity[missing_lock: FALSE] - maybe due to (by-design) unique_lock vs. scoped_lock? m_bWorking = false; } - if ( eInput == STOP ) + if (eInput == Input::STOP) break; // We only install the extension which are currently in the queue. @@ -1046,7 +1046,7 @@ void ExtensionCmdQueue::Thread::_insert(const TExtensionCmd& rExtCmd) return; m_queue.push( rExtCmd ); - m_eInput = START; + m_eInput = Input::START; m_wakeup.notify_all(); } commit 36fcec7db073f0fd3c5bf902c7a069297d752142 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 24 10:19:37 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Feb 24 23:51:22 2026 +0100 extension mgr: Switch E_CMD_TYPE to an enum class ... and rename to CommandType. Change-Id: I4f2dd33b746954f629ab2e938752a3ef32ee4912 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200152 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 373e0dfe902f..bad8dcac47f2 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -165,16 +165,24 @@ public: struct ExtensionCmd { - enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES, ACCEPT_LICENSE }; - - E_CMD_TYPE m_eCmdType; + enum class CommandType + { + Add, + Enable, + Disable, + Remove, + CheckForUpdates, + AcceptLicense + }; + + CommandType m_eCmdType; bool m_bWarnUser; OUString m_sExtensionURL; OUString m_sRepository; uno::Reference< deployment::XPackage > m_xPackage; std::vector< uno::Reference< deployment::XPackage > > m_vExtensionList; - ExtensionCmd( const E_CMD_TYPE eCommand, + ExtensionCmd( const CommandType eCommand, OUString aExtensionURL, OUString aRepository, const bool bWarnUser ) @@ -182,12 +190,12 @@ struct ExtensionCmd m_bWarnUser( bWarnUser ), m_sExtensionURL(std::move( aExtensionURL )), m_sRepository(std::move( aRepository )) {}; - ExtensionCmd( const E_CMD_TYPE eCommand, + ExtensionCmd( const CommandType eCommand, uno::Reference< deployment::XPackage > xPackage ) : m_eCmdType( eCommand ), m_bWarnUser( false ), m_xPackage(std::move( xPackage )) {}; - ExtensionCmd( const E_CMD_TYPE eCommand, + ExtensionCmd( const CommandType eCommand, std::vector<uno::Reference<deployment::XPackage > >&&vExtensionList ) : m_eCmdType( eCommand ), m_bWarnUser( false ), @@ -601,7 +609,8 @@ void ExtensionCmdQueue::Thread::addExtension( const OUString &rExtensionURL, { if ( !rExtensionURL.isEmpty() ) { - TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( ExtensionCmd::ADD, rExtensionURL, rRepository, bWarnUser ); + TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( + ExtensionCmd::CommandType::Add, rExtensionURL, rRepository, bWarnUser); _insert( pEntry ); } } @@ -611,7 +620,8 @@ void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deploymen { if ( rPackage.is() ) { - TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( ExtensionCmd::REMOVE, rPackage ); + TExtensionCmd pEntry + = std::make_shared<ExtensionCmd>(ExtensionCmd::CommandType::Remove, rPackage); _insert( pEntry ); } } @@ -621,7 +631,8 @@ void ExtensionCmdQueue::Thread::acceptLicense( const uno::Reference< deployment: { if ( rPackage.is() ) { - TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( ExtensionCmd::ACCEPT_LICENSE, rPackage ); + TExtensionCmd pEntry + = std::make_shared<ExtensionCmd>(ExtensionCmd::CommandType::AcceptLicense, rPackage); _insert( pEntry ); } } @@ -632,9 +643,9 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen { if ( rPackage.is() ) { - TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( bEnable ? ExtensionCmd::ENABLE : - ExtensionCmd::DISABLE, - rPackage ); + TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( + bEnable ? ExtensionCmd::CommandType::Enable : ExtensionCmd::CommandType::Disable, + rPackage); _insert( pEntry ); } } @@ -643,7 +654,8 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen void ExtensionCmdQueue::Thread::checkForUpdates( std::vector<uno::Reference<deployment::XPackage > > && vExtensionList ) { - TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( ExtensionCmd::CHECK_FOR_UPDATES, std::move(vExtensionList) ); + TExtensionCmd pEntry = std::make_shared<ExtensionCmd>( + ExtensionCmd::CommandType::CheckForUpdates, std::move(vExtensionList)); _insert( pEntry ); } @@ -725,29 +737,30 @@ void ExtensionCmdQueue::Thread::execute() m_queue.pop(); } - if ( bStartProgress && ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATES ) ) + if (bStartProgress + && (pEntry->m_eCmdType != ExtensionCmd::CommandType::CheckForUpdates)) { currentCmdEnv->startProgress(); bStartProgress = false; } switch ( pEntry->m_eCmdType ) { - case ExtensionCmd::ADD : + case ExtensionCmd::CommandType::Add: _addExtension( currentCmdEnv, pEntry->m_sExtensionURL, pEntry->m_sRepository, pEntry->m_bWarnUser ); break; - case ExtensionCmd::REMOVE : + case ExtensionCmd::CommandType::Remove: _removeExtension( currentCmdEnv, pEntry->m_xPackage ); break; - case ExtensionCmd::ENABLE : + case ExtensionCmd::CommandType::Enable: _enableExtension( currentCmdEnv, pEntry->m_xPackage ); break; - case ExtensionCmd::DISABLE : + case ExtensionCmd::CommandType::Disable: _disableExtension( currentCmdEnv, pEntry->m_xPackage ); break; - case ExtensionCmd::CHECK_FOR_UPDATES : + case ExtensionCmd::CommandType::CheckForUpdates: _checkForUpdates( std::vector(pEntry->m_vExtensionList) ); break; - case ExtensionCmd::ACCEPT_LICENSE : + case ExtensionCmd::CommandType::AcceptLicense: _acceptLicense( currentCmdEnv, pEntry->m_xPackage ); break; }
