desktop/source/deployment/gui/dp_gui_dialog2.cxx | 22 +++++----- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 7 --- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 41 ++++++++------------ desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 3 - 4 files changed, 31 insertions(+), 42 deletions(-)
New commits: commit 9a5bc78071e24c841f44ce7f9e082d997889dc0d Author: Michael Weghorn <[email protected]> AuthorDate: Thu Oct 16 12:37:18 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 17 12:13:01 2025 +0200 extension mgr: Use class member instead of passing as param There's no need to pass the dialog's weld::Window to DialogHelper::continueOnSharedExtension because it already has that one set as its DialogHelper::m_pWindow member. Use the member and drop the param. Change-Id: Icb0cb93efce2cb729bb783a12dada9012b69fe14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192492 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 4943cfc8a240..e2a1b6693a21 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -298,17 +298,15 @@ bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > return xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER; } -bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackage > &xPackage, - weld::Widget* pParent, - TranslateId pResID, - bool &bHadWarning ) +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(pParent, - VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(pResID))); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( + m_pWindow, VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(pResID))); bHadWarning = true; bool bRet = RET_OK == xBox->run(); @@ -569,12 +567,14 @@ void ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > & if ( bEnable ) { - if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_ENABLE_SHARED_EXTENSION, m_bEnableWarning)) + if (!continueOnSharedExtension(xPackage, RID_STR_WARNING_ENABLE_SHARED_EXTENSION, + m_bEnableWarning)) return; } else { - if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_DISABLE_SHARED_EXTENSION, m_bDisableWarning)) + if (!continueOnSharedExtension(xPackage, RID_STR_WARNING_DISABLE_SHARED_EXTENSION, + m_bDisableWarning)) return; } @@ -593,7 +593,8 @@ void ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > & return; } - if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_REMOVE_SHARED_EXTENSION, m_bDeleteWarning)) + if (!continueOnSharedExtension(xPackage, RID_STR_WARNING_REMOVE_SHARED_EXTENSION, + m_bDeleteWarning)) return; m_pManager->getCmdQueue()->removeExtension( xPackage ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 6a848e9aff4c..38996444f2a5 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -73,10 +73,8 @@ public: virtual void checkEntries() = 0; static bool IsSharedPkgMgr( const css::uno::Reference< css::deployment::XPackage > &); - bool continueOnSharedExtension( const css::uno::Reference< css::deployment::XPackage > &, - weld::Widget* pParent, - TranslateId pResID, - bool &bHadWarning ); + bool continueOnSharedExtension(const css::uno::Reference<css::deployment::XPackage>&, + TranslateId pResID, bool& bHadWarning); void incBusy() { m_aBusy.incBusy(m_pWindow); } void decBusy() { m_aBusy.decBusy(); } commit b7a2de2bb886ed230364dca6d29c088018978ed5 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Oct 16 12:20:14 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 17 12:12:54 2025 +0200 extension mgr: Translate file dialog title on demand Drop ExtMgrDialog::m_sAddPackages and instead translate the string used for the "Add Extension(s") dialog title when the "Add" button in the extension manager dialog gets clicked. Change-Id: If9b577797d0ed0951ec2e4ca99719eef80fcf119 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192491 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 5e34e4d18065..4943cfc8a240 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -407,7 +407,6 @@ void DialogHelper::PostUserEvent( const Link<void*,void>& rLink, void* pCaller ) ExtMgrDialog::ExtMgrDialog(weld::Window *pParent, TheExtensionManager *pManager) : GenericDialogController(pParent, u"desktop/ui/extensionmanager.ui"_ustr, u"ExtensionManagerDialog"_ustr) , DialogHelper(pManager->getContext(), m_xDialog.get()) - , m_sAddPackages(DpResId(RID_STR_ADD_PACKAGES)) , m_bHasProgress(false) , m_bProgressChanged(false) , m_bStartProgress(false) @@ -634,7 +633,7 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker() { sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); aDlgHelper.SetContext(sfx2::FileDialogHelper::ExtensionManager); - aDlgHelper.SetTitle( m_sAddPackages ); + aDlgHelper.SetTitle(DpResId(RID_STR_ADD_PACKAGES)); // collect and set filter list: typedef std::map< OUString, OUString > t_string2string; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 5bfa8ba0aca2..6a848e9aff4c 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -88,7 +88,6 @@ public: class ExtMgrDialog : public weld::GenericDialogController , public DialogHelper { - const OUString m_sAddPackages; OUString m_sProgressText; bool m_bHasProgress; bool m_bProgressChanged; commit 6b899c47d0e704585bf0371646cdf5859c31751d Author: Michael Weghorn <[email protected]> AuthorDate: Thu Oct 16 11:47:27 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 17 12:12:47 2025 +0200 extension mgr: Use -1 to indicate non-selected entry Instead of having two different members, ExtensionBox_Impl::m_bHasActive and ExtensionBox_Impl::m_nActive to track whether an entry is currently active/selected, and if so, which one, use only ExtensionBox_Impl::m_nActive and assign a special value of -1 when no entry is selected. That also matches the ExtensionBox_Impl::getSelIndex logic which was already returning -1 in case of no entry being selected. No change in behavior intended. Change-Id: Iecdb7ce22680a42f100d5e71dc36432f037c65f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192490 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index ad3f9b2213d6..7c00d51a0e8b 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -181,12 +181,11 @@ ExtensionRemovedListener::~ExtensionRemovedListener() // ExtensionBox_Impl ExtensionBox_Impl::ExtensionBox_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll) : m_bHasScrollBar( false ) - , m_bHasActive( false ) , m_bNeedsRecalc( true ) , m_bInCheckMode( false ) , m_bAdjustActive( false ) , m_bInDelete( false ) - , m_nActive( 0 ) + , m_nActive(-1) , m_nTopIndex( 0 ) , m_nStdHeight( 0 ) , m_nActiveHeight( 0 ) @@ -251,13 +250,8 @@ sal_Int32 ExtensionBox_Impl::getItemCount() const sal_Int32 ExtensionBox_Impl::getSelIndex() const { - if ( m_bHasActive ) - { - assert(m_nActive >= -1); - return static_cast< sal_Int32 >( m_nActive ); - } - else - return ENTRY_NOTFOUND; + assert(m_nActive >= -1); + return static_cast<sal_Int32>(m_nActive); } @@ -311,7 +305,7 @@ tools::Rectangle ExtensionBox_Impl::GetEntryRect( const tools::Long nPos ) const aSize.setHeight( m_nStdHeight ); Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight ); - if ( m_bHasActive && ( nPos < m_nActive ) ) + if (m_nActive >= 0 && nPos < m_nActive) aPos.AdjustY(m_nActiveHeight - m_nStdHeight ); return tools::Rectangle( aPos, aSize ); @@ -346,18 +340,17 @@ void ExtensionBox_Impl::selectEntry( const tools::Long nPos ) if ( m_bInCheckMode ) return; - if ( m_bHasActive ) + if (m_nActive >= 0) { if ( nPos == m_nActive ) return; - m_bHasActive = false; m_vEntries[ m_nActive ]->m_bActive = false; + m_nActive = -1; } if ( ( nPos >= 0 ) && ( o3tl::make_unsigned(nPos) < m_vEntries.size() ) ) { - m_bHasActive = true; m_nActive = nPos; m_vEntries[ nPos ]->m_bActive = true; @@ -538,12 +531,12 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools: void ExtensionBox_Impl::RecalcAll() { - if ( m_bHasActive ) + if (m_nActive >= 0) CalcActiveHeight( m_nActive ); SetupScrollBar(); - if ( m_bHasActive ) + if (m_nActive >= 0) { tools::Rectangle aEntryRect = GetEntryRect( m_nActive ); @@ -594,7 +587,7 @@ bool ExtensionBox_Impl::HandleCursorKey( sal_uInt16 nKeyCode ) tools::Long nSelect = 0; - if ( m_bHasActive ) + if (HasActive()) { tools::Long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight; if ( nPageSize < 2 ) @@ -659,7 +652,7 @@ tools::Long ExtensionBox_Impl::GetTotalHeight() const { tools::Long nHeight = m_vEntries.size() * m_nStdHeight; - if ( m_bHasActive ) + if (HasActive()) { nHeight += m_nActiveHeight - m_nStdHeight; } @@ -715,7 +708,7 @@ tools::Long ExtensionBox_Impl::PointToPos( const Point& rPos ) { tools::Long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight; - if ( m_bHasActive && ( nPos > m_nActive ) ) + if (m_nActive >= 0 && (nPos > m_nActive)) { if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight ) nPos = m_nActive; @@ -767,7 +760,7 @@ bool ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt ) if ( !rMEvt.IsLeft() ) return false; - if (rMEvt.IsMod1() && m_bHasActive) + if (rMEvt.IsMod1() && m_nActive >= 0) selectEntry(ExtensionBox_Impl::ENTRY_NOTFOUND); // Selecting a not existing entry will deselect the current one else { @@ -929,7 +922,7 @@ void ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & pEntry->m_sErrorText = DpResId(RID_STR_ERROR_MISSING_LICENSE); //access to m_nActive must be guarded - if (!m_bInCheckMode && m_bHasActive && (m_nActive >= nPos)) + if (!m_bInCheckMode && (m_nActive >= nPos)) m_nActive += 1; } @@ -1000,7 +993,7 @@ void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage if ( IsReallyVisible() ) invalidate = true; - if ( m_bHasActive ) + if (m_nActive >= 0) { if ( nPos < m_nActive ) m_nActive -= 1; @@ -1008,10 +1001,11 @@ void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage ( nPos == static_cast<tools::Long>(m_vEntries.size()) ) ) m_nActive -= 1; - m_bHasActive = false; + const tools::Long nActive = m_nActive; + m_nActive = -1; //clear before calling out of this method aGuard.clear(); - selectEntry( m_nActive ); + selectEntry(nActive); } } } @@ -1101,7 +1095,6 @@ void ExtensionBox_Impl::checkEntries() { nChangedActivePos = nPos; m_nActive = -1; - m_bHasActive = false; } m_vRemovedEntries.push_back(*iIndex); (*iIndex)->m_xPackage->removeEventListener(m_xRemoveListener); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 8fe0c6b5e04f..39d7e7619b8c 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -104,7 +104,6 @@ public: class ExtensionBox_Impl : public weld::CustomWidgetController { bool m_bHasScrollBar : 1; - bool m_bHasActive : 1; bool m_bNeedsRecalc : 1; bool m_bInCheckMode : 1; bool m_bAdjustActive : 1; @@ -173,7 +172,7 @@ public: TEntry_Impl const & GetEntryData( tools::Long nPos ) { return m_vEntries[ nPos ]; } tools::Long GetEntryCount() const { return static_cast<tools::Long>(m_vEntries.size()); } tools::Rectangle GetEntryRect( const tools::Long nPos ) const; - bool HasActive() const { return m_bHasActive; } + bool HasActive() const { return m_nActive >= 0; } tools::Long PointToPos( const Point& rPos ); virtual void RecalcAll(); void RemoveUnlocked();
