summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qapplication_mac.mm')
-rw-r--r--src/gui/kernel/qapplication_mac.mm26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 84e0d506fc..84da56e5b9 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -104,6 +104,7 @@
#include "qdir.h"
#include "qdebug.h"
#include "qtimer.h"
+#include "qurl.h"
#include "private/qmacinputcontext_p.h"
#include "private/qpaintengine_mac_p.h"
#include "private/qcursor_p.h"
@@ -966,7 +967,8 @@ struct QMacAppleEventTypeSpec {
AEEventID mac_id;
} app_apple_events[] = {
{ kCoreEventClass, kAEQuitApplication },
- { kCoreEventClass, kAEOpenDocuments }
+ { kCoreEventClass, kAEOpenDocuments },
+ { kInternetEventClass, kAEGetURL },
};
#ifndef QT_MAC_USE_COCOA
@@ -1201,7 +1203,7 @@ void qt_init(QApplicationPrivate *priv, int)
app_proc_ae_handlerUPP = AEEventHandlerUPP(QApplicationPrivate::globalAppleEventProcessor);
for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i)
AEInstallEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id,
- app_proc_ae_handlerUPP, SRefCon(qApp), true);
+ app_proc_ae_handlerUPP, SRefCon(qApp), false);
}
if (QApplicationPrivate::app_style) {
@@ -1237,6 +1239,10 @@ void qt_init(QApplicationPrivate *priv, int)
[cocoaApp setMenu:[qtMenuLoader menu]];
[newDelegate setMenuLoader:qtMenuLoader];
[qtMenuLoader release];
+
+ NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
+ [eventManager setEventHandler:newDelegate andSelector:@selector(getUrl:withReplyEvent:)
+ forEventClass:kInternetEventClass andEventID:kAEGetURL];
}
#endif
// Register for Carbon tablet proximity events on the event monitor target.
@@ -2477,6 +2483,22 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap
default:
break;
}
+ } else if (aeClass == kInternetEventClass) {
+ switch (aeID) {
+ case kAEGetURL: {
+ char urlData[1024];
+ Size actualSize;
+ if (AEGetParamPtr(ae, keyDirectObject, typeChar, 0, urlData,
+ sizeof(urlData) - 1, &actualSize) == noErr) {
+ urlData[actualSize] = 0;
+ QFileOpenEvent ev(QUrl(QString::fromUtf8(urlData)));
+ QApplication::sendSpontaneousEvent(app, &ev);
+ }
+ break;
+ }
+ default:
+ break;
+ }
}
#ifdef DEBUG_EVENTS
qDebug("Qt: internal: %shandled Apple event! %c%c%c%c %c%c%c%c", handled_event ? "(*)" : "",