diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-07-26 17:05:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-27 08:43:31 +0200 |
commit | ae34c3fe49267be34f9fb055ea1cb92240796a26 (patch) | |
tree | c9c5250268b5d574c45f6c7fa3fda1c2e4481063 /sfx2/source/control | |
parent | df2b617b612f24b1dd394faf6fd605bdc69790cb (diff) |
use officecfg for SvtHistoryOptions
Change-Id: I5cfd3a51bc4026ccb66ee23eb6f49a5dff5fe042
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119525
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/control')
-rw-r--r-- | sfx2/source/control/recentdocsview.cxx | 44 | ||||
-rw-r--r-- | sfx2/source/control/recentdocsviewitem.cxx | 2 |
2 files changed, 19 insertions, 27 deletions
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<sal_Int8> aDecoded; - comphelper::Base64::decode(aDecoded, aBase64); + Sequence<sal_Int8> 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; } |