LOK: Do not try to show an "update links" dialog
In commit f8528cdda9 (LOK: don't crash
when trying to show a dialog during file load, 2024-12-26), all not
yet async / not properly set up dialogs made to fail gracefully. In
the follow-up https://gerrit.libreoffice.org/c/core/+/180334, an
assert is added to still fail in debug builds.
The specific "update links" dialog case, that triggered the original
change in the first place, does not need to appear at all in the LOK
case, because there is no external documents available for updating.
This change avoids the dialog in that case.
Change-Id: I7c6bc755d87656f002829460f4768fed34dc2f17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180335
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <comphelper/lok.hxx>
|
||||
#include <comphelper/string.hxx>
|
||||
#include <sfx2/linkmgr.hxx>
|
||||
#include <sfx2/sfxsids.hrc>
|
||||
@@ -278,6 +281,12 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink,
|
||||
return bRet;
|
||||
}
|
||||
|
||||
static void disallowAllLinksUpdate(SvBaseLink* pShellProvider)
|
||||
{
|
||||
if (SfxObjectShell* pShell = pShellProvider->GetLinkManager()->GetPersist())
|
||||
pShell->getEmbeddedObjectContainer().setUserAllowsLinkUpdate(false);
|
||||
}
|
||||
|
||||
void LinkManager::UpdateAllLinks(
|
||||
bool bAskUpdate,
|
||||
bool bUpdateGrfLinks,
|
||||
@@ -325,6 +334,13 @@ void LinkManager::UpdateAllLinks(
|
||||
|
||||
if( bAskUpdate )
|
||||
{
|
||||
if (comphelper::LibreOfficeKit::isActive())
|
||||
{
|
||||
// only one document in jail, no update possible
|
||||
disallowAllLinksUpdate(pLink);
|
||||
return;
|
||||
}
|
||||
|
||||
OUString aMsg = SfxResId(STR_QUERY_UPDATE_LINKS);
|
||||
INetURLObject aURL(pPersist->getDocumentBaseURL());
|
||||
aMsg = aMsg.replaceFirst("%{filename}", aURL.GetLastName());
|
||||
@@ -336,14 +352,7 @@ void LinkManager::UpdateAllLinks(
|
||||
int nRet = xQueryBox->run();
|
||||
if( RET_YES != nRet )
|
||||
{
|
||||
SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist();
|
||||
|
||||
if(pShell)
|
||||
{
|
||||
comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = pShell->getEmbeddedObjectContainer();
|
||||
rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
|
||||
}
|
||||
|
||||
disallowAllLinksUpdate(pLink);
|
||||
return ; // nothing should be updated
|
||||
}
|
||||
bAskUpdate = false; // once is enough
|
||||
|
||||
Reference in New Issue
Block a user