From ae34c3fe49267be34f9fb055ea1cb92240796a26 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 26 Jul 2021 17:05:26 +0200 Subject: use officecfg for SvtHistoryOptions Change-Id: I5cfd3a51bc4026ccb66ee23eb6f49a5dff5fe042 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119525 Tested-by: Noel Grandin Reviewed-by: Noel Grandin --- sfx2/source/control/recentdocsview.cxx | 44 ++++++++++++------------------ sfx2/source/control/recentdocsviewitem.cxx | 2 +- 2 files changed, 19 insertions(+), 27 deletions(-) (limited to 'sfx2/source/control') diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 0b01603d3914..3493df385120 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -240,42 +240,34 @@ void RecentDocsView::Reload() { Clear(); - Sequence< Sequence< PropertyValue > > aHistoryList = SvtHistoryOptions().GetList( EHistoryType::PickList ); - for ( int i = 0; i < aHistoryList.getLength(); i++ ) + std::vector< SvtHistoryOptions::HistoryItem > aHistoryList = SvtHistoryOptions::GetList( EHistoryType::PickList ); + for ( size_t i = 0; i < aHistoryList.size(); i++ ) { - const Sequence< PropertyValue >& rRecentEntry = aHistoryList[i]; + const SvtHistoryOptions::HistoryItem& rRecentEntry = aHistoryList[i]; - OUString aURL; + OUString aURL = rRecentEntry.sURL; OUString aTitle; BitmapEx aThumbnail; BitmapEx aModule; - for ( const auto& rProp : rRecentEntry ) + //fdo#74834: only load thumbnail if the corresponding option is not disabled in the configuration + if (officecfg::Office::Common::History::RecentDocsThumbnail::get()) { - Any a = rProp.Value; - - if (rProp.Name == "URL") - a >>= aURL; - //fdo#74834: only load thumbnail if the corresponding option is not disabled in the configuration - else if (rProp.Name == "Thumbnail" && officecfg::Office::Common::History::RecentDocsThumbnail::get()) + OUString aBase64 = rRecentEntry.sThumbnail; + if (!aBase64.isEmpty()) { - OUString aBase64; - a >>= aBase64; - if (!aBase64.isEmpty()) - { - Sequence aDecoded; - comphelper::Base64::decode(aDecoded, aBase64); + Sequence aDecoded; + comphelper::Base64::decode(aDecoded, aBase64); - SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ); - vcl::PngImageReader aReader(aStream); - aThumbnail = aReader.read(); - } else + SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ); + vcl::PngImageReader aReader(aStream); + aThumbnail = aReader.read(); + } else + { + INetURLObject aUrl(aURL); + if (mnFileTypes & ApplicationType::TYPE_DATABASE && typeMatchesExtension(ApplicationType::TYPE_DATABASE, aUrl.getExtension())) { - INetURLObject aUrl(aURL); - if (mnFileTypes & ApplicationType::TYPE_DATABASE && typeMatchesExtension(ApplicationType::TYPE_DATABASE, aUrl.getExtension())) - { - aThumbnail = BitmapEx(ThumbnailView::ItemHeight() > 192 ? SFX_THUMBNAIL_BASE_256 : SFX_THUMBNAIL_BASE_192); - } + aThumbnail = BitmapEx(ThumbnailView::ItemHeight() > 192 ? SFX_THUMBNAIL_BASE_256 : SFX_THUMBNAIL_BASE_192); } } } diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx index 95660738346a..e76c500ecbb0 100644 --- a/sfx2/source/control/recentdocsviewitem.cxx +++ b/sfx2/source/control/recentdocsviewitem.cxx @@ -163,7 +163,7 @@ void RecentDocsViewItem::MouseButtonUp(const MouseEvent& rMEvt) { if (getRemoveIconArea().IsInside(rMEvt.GetPosPixel())) { - SvtHistoryOptions().DeleteItem(EHistoryType::PickList, maURL); + SvtHistoryOptions::DeleteItem(EHistoryType::PickList, maURL); mrParent.Reload(); return; } -- cgit