desktop/source/deployment/gui/dp_gui.h | 2 - desktop/source/deployment/gui/dp_gui_dialog2.cxx | 19 +++++----- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 4 +- desktop/source/deployment/gui/dp_gui_extensionboxwithbuttons.cxx | 12 +++--- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 14 ++++--- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 13 +++--- 6 files changed, 35 insertions(+), 29 deletions(-)
New commits: commit 2c0098af9178cb0d0c6f14cc20839f86a6a55cef Author: Michael Weghorn <[email protected]> AuthorDate: Thu Oct 16 15:25:08 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 17 12:13:57 2025 +0200 extension mgr: Switch UpdateRequiredDialog::m_pManager to ref ... and rename accordingly. Change-Id: Iff05edba1475a10c5133eaf01dda39b8ad291953 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192513 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 660752f69474..25ca0b42a9f2 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -786,9 +786,10 @@ void ExtMgrDialog::Close() } //UpdateRequiredDialog -UpdateRequiredDialog::UpdateRequiredDialog(weld::Window *pParent, TheExtensionManager *pManager) - : GenericDialogController(pParent, u"desktop/ui/updaterequireddialog.ui"_ustr, u"UpdateRequiredDialog"_ustr) - , DialogHelper(pManager->getContext(), m_xDialog.get()) +UpdateRequiredDialog::UpdateRequiredDialog(weld::Window* pParent, TheExtensionManager& rManager) + : GenericDialogController(pParent, u"desktop/ui/updaterequireddialog.ui"_ustr, + u"UpdateRequiredDialog"_ustr) + , DialogHelper(rManager.getContext(), m_xDialog.get()) , m_sCloseText(DpResId(RID_STR_CLOSE_BTN)) , m_bHasProgress(false) , m_bProgressChanged(false) @@ -797,7 +798,7 @@ UpdateRequiredDialog::UpdateRequiredDialog(weld::Window *pParent, TheExtensionMa , m_bHasLockedEntries(false) , m_nProgress(0) , m_aIdle( "UpdateRequiredDialog m_aIdle TimeOutHdl" ) - , m_pManager(pManager) + , m_rManager(rManager) , m_xExtensionBox(new ExtensionBox(m_xBuilder->weld_scrolled_window(u"scroll"_ustr, true))) , m_xExtensionBoxWnd(new weld::CustomWeld(*m_xBuilder, u"extensions"_ustr, *m_xExtensionBox)) , m_xUpdateNeeded(m_xBuilder->weld_label(u"updatelabel"_ustr)) @@ -807,7 +808,7 @@ UpdateRequiredDialog::UpdateRequiredDialog(weld::Window *pParent, TheExtensionMa , m_xProgressText(m_xBuilder->weld_label(u"progresslabel"_ustr)) , m_xProgressBar(m_xBuilder->weld_progress_bar(u"progress"_ustr)) { - m_xExtensionBox->setExtensionManager(pManager); + m_xExtensionBox->setExtensionManager(&rManager); m_xUpdateBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) ); m_xCloseBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) ); @@ -837,7 +838,7 @@ void UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::X // We will only add entries to the list with unsatisfied dependencies if ( !bLicenseMissing && !checkDependencies( xPackage ) ) { - m_bHasLockedEntries |= m_pManager->isReadOnly( xPackage ); + m_bHasLockedEntries |= m_rManager.isReadOnly(xPackage); const SolarMutexGuard aGuard; m_xUpdateBtn->set_sensitive(true); m_xExtensionBox->addEntry( xPackage ); @@ -987,7 +988,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void) } } - m_pManager->getCmdQueue()->checkForUpdates( std::move(vUpdateEntries) ); + m_rManager.getCmdQueue()->checkForUpdates(std::move(vUpdateEntries)); } @@ -1131,7 +1132,7 @@ void UpdateRequiredDialog::disableAllEntries() for ( tools::Long nIndex = 0; nIndex < nCount; nIndex++ ) { TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nIndex ); - m_pManager->getCmdQueue()->enableExtension( pEntry->m_xPackage, false ); + m_rManager.getCmdQueue()->enableExtension(pEntry->m_xPackage, false); } decBusy(); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 9f8af56a3adc..109023d05bba 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -185,7 +185,7 @@ class UpdateRequiredDialog : public weld::GenericDialogController bool m_bHasLockedEntries; sal_Int32 m_nProgress; Idle m_aIdle; - TheExtensionManager *m_pManager; + TheExtensionManager& m_rManager; css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel; @@ -210,7 +210,7 @@ class UpdateRequiredDialog : public weld::GenericDialogController void disableAllEntries(); public: - UpdateRequiredDialog(weld::Window * pParent, TheExtensionManager *pManager); + UpdateRequiredDialog(weld::Window* pParent, TheExtensionManager& rManager); virtual ~UpdateRequiredDialog() override; virtual short run() override; diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 95e274f28742..d5ced48ba205 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -126,7 +126,8 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) { if ( !m_xUpdReqDialog ) { - m_xUpdReqDialog.reset(new UpdateRequiredDialog(Application::GetFrameWeld(m_xParent), this)); + m_xUpdReqDialog.reset( + new UpdateRequiredDialog(Application::GetFrameWeld(m_xParent), *this)); m_xExecuteCmdQueue.reset(new ExtensionCmdQueue(*m_xUpdReqDialog, *this, m_xContext)); createPackageList(); } commit aafc34d7ec83b00b302878e70c04e8f1131dff36 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Oct 16 14:43:29 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 17 12:13:50 2025 +0200 extension mgr: Make PackageState an enum class Change-Id: I6f37447b71f74eb3dbfcd19efa63a3ff3593c1ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192509 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/desktop/source/deployment/gui/dp_gui.h b/desktop/source/deployment/gui/dp_gui.h index cb2932ca4f63..d785f846fe01 100644 --- a/desktop/source/deployment/gui/dp_gui.h +++ b/desktop/source/deployment/gui/dp_gui.h @@ -21,7 +21,7 @@ namespace dp_gui { -enum PackageState { REGISTERED, NOT_REGISTERED, AMBIGUOUS, NOT_AVAILABLE }; +enum class PackageState { REGISTERED, NOT_REGISTERED, AMBIGUOUS, NOT_AVAILABLE }; } // namespace dp_gui diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 9927382e28fb..660752f69474 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -720,7 +720,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleEnableBtn, weld::Button&, void) acceptLicense( pEntry->m_xPackage ); else { - const bool bEnable( pEntry->m_eState != REGISTERED ); + const bool bEnable(pEntry->m_eState != PackageState::REGISTERED); enablePackage( pEntry->m_xPackage, bEnable ); } } diff --git a/desktop/source/deployment/gui/dp_gui_extensionboxwithbuttons.cxx b/desktop/source/deployment/gui/dp_gui_extensionboxwithbuttons.cxx index 675856543201..5c41558d4628 100644 --- a/desktop/source/deployment/gui/dp_gui_extensionboxwithbuttons.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensionboxwithbuttons.cxx @@ -85,7 +85,8 @@ void ExtensionBoxWithButtons::SetButtonStatus(const TEntry_Impl& rEntry) bool bShowOptionBtn = true; rEntry->m_bHasButtons = false; - if ( ( rEntry->m_eState == REGISTERED ) || ( rEntry->m_eState == NOT_AVAILABLE ) ) + if ((rEntry->m_eState == PackageState::REGISTERED) + || (rEntry->m_eState == PackageState::NOT_AVAILABLE)) { m_pParent->enableButtontoEnable( false ); } @@ -95,8 +96,9 @@ void ExtensionBoxWithButtons::SetButtonStatus(const TEntry_Impl& rEntry) bShowOptionBtn = false; } - if ( ( !rEntry->m_bUser || ( rEntry->m_eState == NOT_AVAILABLE ) || rEntry->m_bMissingDeps ) - && !rEntry->m_bMissingLic ) + if ((!rEntry->m_bUser || (rEntry->m_eState == PackageState::NOT_AVAILABLE) + || rEntry->m_bMissingDeps) + && !rEntry->m_bMissingLic) { m_pParent->enableEnableButton( false ); } @@ -171,9 +173,9 @@ OUString ExtensionBoxWithButtons::ShowPopupMenu(const Point& rPos, const tools:: { if ( GetEntryData( nPos )->m_bUser ) { - if ( GetEntryData( nPos )->m_eState == REGISTERED ) + if (GetEntryData(nPos)->m_eState == PackageState::REGISTERED) xPopup->append(u"CMD_DISABLE"_ustr, DpResId(RID_CTX_ITEM_DISABLE)); - else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) + else if (GetEntryData(nPos)->m_eState != PackageState::NOT_AVAILABLE) xPopup->append(u"CMD_ENABLE"_ustr, DpResId(RID_CTX_ITEM_ENABLE)); } if (!officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get()) diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 1067e11898d7..05cf1f8b94bc 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -104,9 +104,9 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, if ( xGraphic.is() ) m_aIcon = Image( xGraphic ); - if ( eState == AMBIGUOUS ) + if (eState == PackageState::AMBIGUOUS) m_sErrorText = DpResId( RID_STR_ERROR_UNKNOWN_STATUS ); - else if ( eState == NOT_REGISTERED ) + else if (eState == PackageState::NOT_REGISTERED) checkDependencies(); } catch (const deployment::ExtensionRemovedException &) {} @@ -379,7 +379,8 @@ void ExtensionBox::DrawRow(vcl::RenderContext& rRenderContext, const tools::Rect if (rEntry->m_bActive) rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor()); - else if ((rEntry->m_eState != REGISTERED) && (rEntry->m_eState != NOT_AVAILABLE)) + else if ((rEntry->m_eState != PackageState::REGISTERED) + && (rEntry->m_eState != PackageState::NOT_AVAILABLE)) rRenderContext.SetTextColor(rStyleSettings.GetDisableColor()); else rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor()); @@ -516,7 +517,8 @@ void ExtensionBox::DrawRow(vcl::RenderContext& rRenderContext, const tools::Rect else rRenderContext.DrawImage(aPos, Size(SMALL_ICON_SIZE, SMALL_ICON_SIZE), m_aSharedImage); } - if ((rEntry->m_eState == AMBIGUOUS ) || rEntry->m_bMissingDeps || rEntry->m_bMissingLic) + if ((rEntry->m_eState == PackageState::AMBIGUOUS) || rEntry->m_bMissingDeps + || rEntry->m_bMissingLic) { aPos = rRect.TopRight() + Point(-(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2 * SMALL_ICON_SIZE), TOP_OFFSET); rRenderContext.DrawImage(aPos, Size(SMALL_ICON_SIZE, SMALL_ICON_SIZE), m_aWarningImage); @@ -935,10 +937,10 @@ void ExtensionBox::updateEntry(const uno::Reference<deployment::XPackage>& xPack entry->m_sVersion = xPackage->getVersion(); entry->m_sDescription = xPackage->getDescription(); - if ( eState == REGISTERED ) + if (eState == PackageState::REGISTERED) entry->m_bMissingLic = false; - if ( eState == AMBIGUOUS ) + if (eState == PackageState::AMBIGUOUS) entry->m_sErrorText = DpResId( RID_STR_ERROR_UNKNOWN_STATUS ); else if ( ! entry->m_bMissingLic ) entry->m_sErrorText.clear(); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 7b68b1d34320..95e274f28742 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -317,7 +317,7 @@ void TheExtensionManager::createPackageList() getDialogHelper()->addPackageToList( xPackage ); // When the package is enabled, we can stop here, otherwise we have to look for // another version of this package - if ( ( eState == REGISTERED ) || ( eState == NOT_AVAILABLE ) ) + if ((eState == PackageState::REGISTERED) || (eState == PackageState::NOT_AVAILABLE)) break; } } @@ -345,19 +345,19 @@ PackageState TheExtensionManager::getPackageState( const uno::Reference< deploym { ::beans::Ambiguous< sal_Bool > const & reg = option.Value; if ( reg.IsAmbiguous ) - return AMBIGUOUS; + return PackageState::AMBIGUOUS; else - return reg.Value ? REGISTERED : NOT_REGISTERED; + return reg.Value ? PackageState::REGISTERED : PackageState::NOT_REGISTERED; } else - return NOT_AVAILABLE; + return PackageState::NOT_AVAILABLE; } catch ( const uno::RuntimeException & ) { throw; } catch (const uno::Exception &) { TOOLS_WARN_EXCEPTION( "desktop", "" ); - return NOT_AVAILABLE; + return PackageState::NOT_AVAILABLE; } }
