src/gui/kernel/qcocoaapplicationdelegate_mac.mm
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm	Tue Feb 02 00:43:10 2010 +0200
@@ -83,6 +83,7 @@
 #include <private/qt_cocoa_helpers_mac_p.h>
 #include <private/qdesktopwidget_mac_p.h>
 #include <qevent.h>
+#include <qurl.h>
 #include <qapplication.h>
 
 QT_BEGIN_NAMESPACE
@@ -177,6 +178,9 @@
     return [[qtMenuLoader retain] autorelease];
 }
 
+// This function will only be called when NSApp is actually running. Before
+// that, the kAEQuitApplication apple event will be sendt to 
+// QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
 {
     Q_UNUSED(sender);
@@ -303,5 +307,15 @@
         [self doesNotRecognizeSelector:invocationSelector];
 }
 
+- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
+{
+    Q_UNUSED(replyEvent);
+
+    NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
+    QUrl url(qt_mac_NSStringToQString(urlString));
+    QFileOpenEvent qtEvent(url);
+    qt_sendSpontaneousEvent(qAppInstance(), &qtEvent);
+}
+
 @end
 #endif