summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-06-30 22:23:30 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-07-01 09:03:59 +0200
commit184a45c4176d96bf799a8f8a0fba290a8c851948 (patch)
treedb9990c2f8ff686138795b47d0bca6aeac22d4a2
parent010d420acc5b43b68458d0289b45c718deb8ca2f (diff)
tdf#149603 macOS: fix workaround to use web help if Safari is the default browser
Safari won't access the local helpfiles from LO's app folder unless you enable Safari's webdeveloper menu. The workaround broke since f31f0038f5fd9254584a06665066faf9715d1cd8 switched from window to widget references and hence using a different codepath, skipping the workaround added in 44893662d510c4173e55ba27af02d0258a697a5d Change-Id: I0c59066fe1cef1514c6595e0439d31d3e60e02f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136685 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sfx2/source/appl/sfxhelp.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 4aa13c6f2c64..d11c99b30b12 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -1281,6 +1281,22 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt
impl_showOnlineHelp(aHelpURL, pWidget);
return true;
}
+#ifdef MACOSX
+ if (@available(macOS 10.14, *)) {
+ // Workaround: Safari sandboxing prevents it from accessing files in the LibreOffice.app folder
+ // force online-help instead if Safari is default browser.
+ CFURLRef pBrowser = LSCopyDefaultApplicationURLForURL(
+ CFURLCreateWithString(
+ kCFAllocatorDefault,
+ static_cast<CFStringRef>(@"https://www.libreoffice.org"),
+ nullptr),
+ kLSRolesAll, nullptr);
+ if([static_cast<NSString*>(CFURLGetString(pBrowser)) isEqualToString:@"file:///Applications/Safari.app/"]) {
+ impl_showOnlineHelp(aHelpURL, pWidget);
+ return true;
+ }
+ }
+#endif
// If the HTML or no help is installed, but aHelpURL nevertheless references valid help content,
// that implies that help content belongs to an extension (and thus would not be available