[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sfx2/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 15 08:18:04 UTC 2019


 sfx2/source/view/viewfrm.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 46e06cb2e13236f38e0428fc7226c7e1a25bd355
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Jul 11 22:24:41 2019 +1000
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Jul 15 10:17:22 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.kaganski at collabora.com>
    (cherry picked from commit df9adfc95429bdaf085e9927ec5b326cee6b7a2a)
    Reviewed-on: https://gerrit.libreoffice.org/75492
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 42a4fa7ec3c7..7aeac3d8f066 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -459,6 +459,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 )
@@ -523,6 +530,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 );
                     }


More information about the Libreoffice-commits mailing list