sfx2/source/view/viewfrm.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+)
New commits: commit df9adfc95429bdaf085e9927ec5b326cee6b7a2a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Jul 11 22:24:41 2019 +1000 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Jul 11 15:25:57 2019 +0200 Restore original value of SID_DOC_READONLY item on cancel or SID_EDITDOC Otherwise, SfxObjectShell::DoSaveCompleted later calls SfxMedium::LockOrigFileOnDemand, which sets error state for the medium reopened in read-only mode, as if it were opened in read-write mode. Change-Id: Ib2df62470878ea609552ccc76df84a3fdde30646 Reviewed-on: https://gerrit.libreoffice.org/75413 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e26587be9cb4..495b640c7856 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -460,6 +460,13 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) bool bOK = false; bool bRetryIgnoringLock = false; bool bOpenTemplate = false; + boost::optional<bool> aOrigROVal; + if (!pVersionItem) + { + auto pRO = pMed->GetItemSet()->GetItem<SfxBoolItem>(SID_DOC_READONLY, false); + if (pRO) + aOrigROVal = pRO->GetValue(); + } do { LockFileEntry aLockData; if ( !pVersionItem ) @@ -524,6 +531,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { pMed->ResetError(); pMed->SetOpenMode( SFX_STREAM_READONLY ); + if (aOrigROVal) + pMed->GetItemSet()->Put(SfxBoolItem(SID_DOC_READONLY, *aOrigROVal)); + else + pMed->GetItemSet()->ClearItem(SID_DOC_READONLY); pMed->ReOpen(); pSh->DoSaveCompleted( pMed ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits