diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-06-08 13:37:27 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-12 11:19:29 +0200 |
commit | 46abc9138bc4b7a0d3b53ea542db5b94f91adf88 (patch) | |
tree | 751e81be22c2ab231a88f3f0325d1cd50e7a0e45 /src/plugins/platforms/cocoa/qcocoaintegration.mm | |
parent | b0e0671152ed204547fca9dfd7a0235bb3a62cfd (diff) |
Cocoa: re-enable getUrl: and appleEventQuit: AppleEvent handlers
The getUrl: and appleEventQuit: handlers are only called if we register
them with the NSAppleEventManager. The Cocoa documentation says the best
place to do this is in the applicationWillFinishLaunching: delegate
method, so add this method and move the code from
qcocoaeventdispatcher.mm to there. Since QCocoaApplicationDelegate is
only used when AA_MacPluginApplication is not set, we do not need to
check again in the delegate code. Be sure to remove these event handlers
when shutting down the application.
For the getUrl: handler, send file open events when receiving this
event. This restores Qt 4 behavior.
Remove the qDebug() from the appleEventQuit: handler.
Change-Id: Ibcbdd541695176e3d236366d4d541e4811882d6c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 9ea00d3c65..29c5ec7e3c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -148,7 +148,13 @@ QCocoaIntegration::QCocoaIntegration() QCocoaIntegration::~QCocoaIntegration() { - [[NSApplication sharedApplication] setDelegate: 0]; + if (!QCoreApplication::testAttribute(Qt::AA_MacPluginApplication)) { + // remove the apple event handlers installed by QCocoaApplicationDelegate + QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *delegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate]; + [delegate removeAppleEventHandlers]; + // reset the application delegate + [[NSApplication sharedApplication] setDelegate: 0]; + } // Delete the clipboard integration and destroy mime type converters. // Deleting the clipboard integration flushes promised pastes using |