tdf#149170 sfx2: fix regression about spurious dialog
Open a document that is locked, choose Read-Only, then click "Edit" on
infobar: it is still locked, so a dialog pops up. Click "Cancel".
Now a *second* dialog pops up that *again* asks if you want to open a
copy of the document - this appears pointless so let's remove it.
Change-Id: Id96a1211caea63e7559c67b08a6581d1a0ce9add
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137234
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit a1ca68e91868df51a269682f7c3dac62a88a85ef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137421
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3e09372..da54779 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -765,9 +765,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
// Do not cache the old Document! Is invalid when loading
// another document.
const SfxStringItem* pSavedOptions = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_FILE_FILTEROPTIONS, false);
const SfxStringItem* pSavedReferer = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_REFERER, false);
bool bHasStorage = pMedium->HasStorage_Impl();
if( bHandsOff )
{
@@ -812,29 +809,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
xOldObj->DoSaveCompleted( pMedium );
}
// r/o-Doc couldn't be switched to writing mode
if ( bForEdit && ( SID_EDITDOC == rReq.GetSlot() || SID_READONLYDOC == rReq.GetSlot() ) )
{
// ask user for opening as template
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow().GetFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
SfxResId(STR_QUERY_OPENASTEMPLATE)));
if (RET_YES == xBox->run())
{
SfxAllItemSet aSet( pApp->GetPool() );
aSet.Put( SfxStringItem( SID_FILE_NAME, pMedium->GetName() ) );
aSet.Put( SfxStringItem( SID_TARGETNAME, "_blank" ) );
if ( pSavedOptions )
aSet.Put( *pSavedOptions );
if ( pSavedReferer )
aSet.Put( *pSavedReferer );
aSet.Put( SfxBoolItem( SID_TEMPLATE, true ) );
if( pFilter )
aSet.Put( SfxStringItem( SID_FILTER_NAME, pFilter->GetFilterName() ) );
GetDispatcher()->Execute( SID_OPENDOC, SfxCallMode::ASYNCHRON, aSet );
}
}
}
else
{