diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-04-25 14:53:33 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-04-26 10:39:31 +0200 |
commit | 404c51f3664ffd4f7e2c1c8bb8a12ac70954fec2 (patch) | |
tree | b38e7a5088e4c3cbd1b7ea447b03fb595bd8f1ba /sfx2/source/control | |
parent | c51ef466f736c9e0e192d2c7feeda0a39bca2011 (diff) |
officecfg,unotools,framework,sfx2: store ReadOnly for recent docs
Add Office::Histories::HistoryItem::ReadOnly flag to configuration so
that a document that was opened read-only isn't opened as editable from
recent documents.
Change-Id: I6985da287d3337a53a7e41e8e500421038eedb91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133385
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sfx2/source/control')
-rw-r--r-- | sfx2/source/control/recentdocsview.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/control/recentdocsviewitem.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/control/recentdocsviewitem.hxx | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 3c6110c1e8a1..b7a6ba4adcea 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -143,9 +143,9 @@ bool RecentDocsView::isAcceptedFile(const INetURLObject& rURL) const (mnFileTypes & ApplicationType::TYPE_OTHER && typeMatchesExtension(ApplicationType::TYPE_OTHER, aExt)); } -void RecentDocsView::insertItem(const OUString &rURL, const OUString &rTitle, const OUString& rThumbnail, sal_uInt16 nId) +void RecentDocsView::insertItem(const OUString &rURL, const OUString &rTitle, const OUString& rThumbnail, bool isReadOnly, sal_uInt16 nId) { - AppendItem( std::make_unique<RecentDocsViewItem>(*this, rURL, rTitle, rThumbnail, nId, mnItemMaxSize) ); + AppendItem( std::make_unique<RecentDocsViewItem>(*this, rURL, rTitle, rThumbnail, nId, mnItemMaxSize, isReadOnly) ); } void RecentDocsView::Reload() @@ -166,7 +166,7 @@ void RecentDocsView::Reload() //Remove extension from url's last segment and use it as title const OUString aTitle = aURLObj.GetBase(); //DecodeMechanism::WithCharset - insertItem(aURL, aTitle, rRecentEntry.sThumbnail, i+1); + insertItem(aURL, aTitle, rRecentEntry.sThumbnail, rRecentEntry.isReadOnly, i+1); } CalculateItemPositions(); diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx index d58f1a49d562..e9c53faeffcf 100644 --- a/sfx2/source/control/recentdocsviewitem.cxx +++ b/sfx2/source/control/recentdocsviewitem.cxx @@ -121,10 +121,13 @@ BitmapEx getModuleOverlay(const OUString& rURL) }; RecentDocsViewItem::RecentDocsViewItem(sfx2::RecentDocsView &rView, const OUString &rURL, - const OUString &rTitle, std::u16string_view sThumbnailBase64, sal_uInt16 nId, tools::Long nThumbnailSize) + const OUString &rTitle, std::u16string_view const sThumbnailBase64, + sal_uInt16 const nId, tools::Long const nThumbnailSize, + bool const isReadOnly) : ThumbnailViewItem(rView, nId), mrParentView(rView), maURL(rURL), + m_isReadOnly(isReadOnly), m_bRemoveIconHighlighted(false), m_aRemoveRecentBitmap(BMP_RECENTDOC_REMOVE), m_aRemoveRecentBitmapHighlighted(BMP_RECENTDOC_REMOVE_HIGHLIGHTED) @@ -317,6 +320,7 @@ void RecentDocsViewItem::OpenDocument() xTrans->parseStrict(aTargetURL); aArgsList = { comphelper::makePropertyValue("Referer", OUString("private:user")), + comphelper::makePropertyValue("ReadOnly", m_isReadOnly), // documents will never be opened as templates comphelper::makePropertyValue("AsTemplate", false) }; diff --git a/sfx2/source/control/recentdocsviewitem.hxx b/sfx2/source/control/recentdocsviewitem.hxx index 41225e68c21b..3f5f6d3faab2 100644 --- a/sfx2/source/control/recentdocsviewitem.hxx +++ b/sfx2/source/control/recentdocsviewitem.hxx @@ -21,7 +21,7 @@ class RecentDocsViewItem final : public ThumbnailViewItem { public: RecentDocsViewItem(sfx2::RecentDocsView &rView, const OUString &rURL, - const OUString &rTitle, std::u16string_view sThumbnailBase64, sal_uInt16 nId, tools::Long nThumbnailSize); + const OUString &rTitle, std::u16string_view sThumbnailBase64, sal_uInt16 nId, tools::Long nThumbnailSize, bool isReadOnly); /** Updates own highlight status based on the aPoint position. @@ -50,6 +50,8 @@ private: OUString maURL; + bool m_isReadOnly = false; + OUString m_sHelpText; /// Is the icon that the user can click to remove the document from the recent documents highlighted? |