src/gui/kernel/qcocoaapplicationdelegate_mac.mm
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    81 #include <private/qapplication_p.h>
    81 #include <private/qapplication_p.h>
    82 #include <private/qt_mac_p.h>
    82 #include <private/qt_mac_p.h>
    83 #include <private/qt_cocoa_helpers_mac_p.h>
    83 #include <private/qt_cocoa_helpers_mac_p.h>
    84 #include <private/qdesktopwidget_mac_p.h>
    84 #include <private/qdesktopwidget_mac_p.h>
    85 #include <qevent.h>
    85 #include <qevent.h>
       
    86 #include <qurl.h>
    86 #include <qapplication.h>
    87 #include <qapplication.h>
    87 
    88 
    88 QT_BEGIN_NAMESPACE
    89 QT_BEGIN_NAMESPACE
    89 extern void onApplicationChangedActivation(bool); // qapplication_mac.mm
    90 extern void onApplicationChangedActivation(bool); // qapplication_mac.mm
    90 extern void qt_release_apple_event_handler(); //qapplication_mac.mm
    91 extern void qt_release_apple_event_handler(); //qapplication_mac.mm
   175 - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
   176 - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
   176 {
   177 {
   177     return [[qtMenuLoader retain] autorelease];
   178     return [[qtMenuLoader retain] autorelease];
   178 }
   179 }
   179 
   180 
       
   181 // This function will only be called when NSApp is actually running. Before
       
   182 // that, the kAEQuitApplication apple event will be sendt to 
       
   183 // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm
   180 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
   184 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
   181 {
   185 {
   182     Q_UNUSED(sender);
   186     Q_UNUSED(sender);
   183     // The reflection delegate gets precedence
   187     // The reflection delegate gets precedence
   184     if (reflectionDelegate
   188     if (reflectionDelegate
   301         [invocation invokeWithTarget:reflectionDelegate];
   305         [invocation invokeWithTarget:reflectionDelegate];
   302     else
   306     else
   303         [self doesNotRecognizeSelector:invocationSelector];
   307         [self doesNotRecognizeSelector:invocationSelector];
   304 }
   308 }
   305 
   309 
       
   310 - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
       
   311 {
       
   312     Q_UNUSED(replyEvent);
       
   313 
       
   314     NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
       
   315     QUrl url(qt_mac_NSStringToQString(urlString));
       
   316     QFileOpenEvent qtEvent(url);
       
   317     qt_sendSpontaneousEvent(qAppInstance(), &qtEvent);
       
   318 }
       
   319 
   306 @end
   320 @end
   307 #endif
   321 #endif