summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-05-27 19:31:01 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-05-27 20:26:52 +0200
commit34eea317c5929d640aa43477c737d26d6b700bdb (patch)
tree7c91f1d48d95c2cfad6e0a35700db267b72c54f3
parent855a56fea4561135a63cb729d7a625a950b210e7 (diff)
tdf#149170 framework,sfx2: don't add ReadOnly=false
There is a non-obvious difference in error handling when opening the file read/write for type-detection fails in utl::MediaDescriptor::impl_openStreamWithURL() - if ReadOnly=false is given, it will abort the file loading, whereas without any ReadOnly it will fall-back to a read-only opening of the file for type detection. At this point a StillReadWriteInteraction is used, so the user is never notified of the failure. (regression from commit 404c51f3664ffd4f7e2c1c8bb8a12ac70954fec2) Change-Id: I8c06fe23cc0bc0767df83f680a1a59e3700bbbbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135045 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--framework/source/uielement/recentfilesmenucontroller.cxx7
-rw-r--r--sfx2/source/control/recentdocsviewitem.cxx6
2 files changed, 10 insertions, 3 deletions
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 2fbad67becd9..dc4001a1f645 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -264,14 +264,17 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex )
Sequence< PropertyValue > aArgsList{
comphelper::makePropertyValue("Referer", OUString( "private:user" )),
- comphelper::makePropertyValue("ReadOnly", m_aRecentFilesItems[nIndex].second),
-
// documents in the picklist will never be opened as templates
comphelper::makePropertyValue("AsTemplate", false),
// Type detection needs to know which app we are opening it from.
comphelper::makePropertyValue("DocumentService", m_aModuleName)
};
+ if (m_aRecentFilesItems[nIndex].second) // tdf#149170 only add if true
+ {
+ aArgsList.realloc(aArgsList.size()+1);
+ aArgsList.getArray()[aArgsList.size()-1] = comphelper::makePropertyValue("ReadOnly", true);
+ }
dispatchCommand(m_aRecentFilesItems[nIndex].first, aArgsList, "_default");
}
diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index 0cdf74418d05..44f103dfbfa4 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -320,9 +320,13 @@ 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) };
+ if (m_isReadOnly) // tdf#149170 only add if true
+ {
+ aArgsList.realloc(aArgsList.size()+1);
+ aArgsList.getArray()[aArgsList.size()-1] = comphelper::makePropertyValue("ReadOnly", true);
+ }
xDispatch = xDesktop->queryDispatch(aTargetURL, "_default", 0);