macOS: Stop using the deprecated [NSWorkspace openFile:] API
We can use openURL instead, which also opens local files in the associated application. Pick-to: 6.5 Change-Id: Ieddc6fb68d6b9e64195ed261953b9fffb6b0b73e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
7a37114af9
commit
351d3e50f9
@ -12,18 +12,12 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
bool QCocoaServices::openUrl(const QUrl &url)
|
||||
{
|
||||
const QString scheme = url.scheme();
|
||||
if (scheme.isEmpty())
|
||||
return openDocument(url);
|
||||
return [[NSWorkspace sharedWorkspace] openURL:url.toNSURL()];
|
||||
}
|
||||
|
||||
bool QCocoaServices::openDocument(const QUrl &url)
|
||||
{
|
||||
if (!url.isValid())
|
||||
return false;
|
||||
|
||||
return [[NSWorkspace sharedWorkspace] openFile:url.toLocalFile().toNSString()];
|
||||
return openUrl(url);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -118,7 +118,7 @@ QT_USE_NAMESPACE
|
||||
// happen synchronously after the dialog is accepted, so we can defer
|
||||
// the opening of the file to the next runloop pass.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSWorkspace.sharedWorkspace openFile:fileName.toNSString()];
|
||||
[NSWorkspace.sharedWorkspace openURL:[NSURL fileURLWithPath:fileName.toNSString()]];
|
||||
});
|
||||
} else if (dest == kPMDestinationProcessPDF) {
|
||||
qWarning("Printing workflows are not supported");
|
||||
|
Loading…
Reference in New Issue
Block a user