diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 10be0fe658..d642115926 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -359,13 +359,25 @@ QT_USE_NAMESPACE - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { Q_UNUSED(replyEvent); + NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; + const QString qurlString = QString::fromNSString(urlString); + + if (event.eventClass == kInternetEventClass && event.eventID == kAEGetURL) { + // 'GURL' (Get URL) event this application should handle + if (!QGuiApplication::instance()) + return; + QCocoaIntegration *cocoaIntegration = QCocoaIntegration::instance(); + Q_ASSERT(cocoaIntegration); + cocoaIntegration->services()->handleUrl(QUrl(qurlString)); + return; + } + // The string we get from the requesting application might not necessarily meet // QUrl's requirement for a IDN-compliant host. So if we can't parse into a QUrl, // then we pass the string on to the application as the name of a file (and // QFileOpenEvent::file is not guaranteed to be the path to a local, open'able // file anyway). - const QString qurlString = QString::fromNSString(urlString); if (const QUrl url(qurlString); url.isValid()) QWindowSystemInterface::handleFileOpenEvent(url); else