From b5b27f017b08ad4fbc67222a36f71933aa5a47dd Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Tue, 6 Apr 2021 16:54:51 +0200 Subject: Following 6fcabbd6199869753fd6a266f23901962a77f556 ...tdf#129153: Show MIME type icon in main menu File>Recent documents list No need to call n times aIconSettings ctr + GetUseImagesInMenus() since it won't change in the loop + rename "aIsIconsAllowed" to "bIsIconsAllowed" since it's a bool Change-Id: I5729f0cdba9a0973afe4d0188f11361877300193 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113682 Tested-by: Jenkins Reviewed-by: Julien Nabet --- framework/source/uielement/recentfilesmenucontroller.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'framework') diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index ee22dd306a5e..343d719c1741 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -158,6 +158,9 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > if ( !m_aRecentFilesItems.empty() ) { const sal_uInt32 nCount = m_aRecentFilesItems.size(); + StyleSettings aIconSettings; + bool bIsIconsAllowed = aIconSettings.GetUseImagesInMenus(); + for ( sal_uInt32 i = 0; i < nCount; i++ ) { @@ -185,9 +188,6 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > INetURLObject aURL( m_aRecentFilesItems[i] ); OUString aTipHelpText( aURL.getFSysPath( FSysStyle::Detect ) ); - StyleSettings aIconSettings; - bool aIsIconsAllowed = aIconSettings.GetUseImagesInMenus(); - if ( aURL.GetProtocol() == INetProtocol::File ) { // Do handle file URL differently: don't show the protocol, just the file name @@ -203,7 +203,7 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > pVCLPopupMenu->InsertItem( sal_uInt16( i+1 ), aMenuShortCut.makeStringAndClear() ); - if ( aIsIconsAllowed ) { + if ( bIsIconsAllowed ) { Image aThumbnail = SvFileInformationManager::GetImage(aURL); pVCLPopupMenu->SetItemImage(sal_uInt16 ( i+1 ), aThumbnail); } -- cgit