aboutsummaryrefslogtreecommitdiffstats
path: root/CopyMailto/AppDelegate.m
diff options
context:
space:
mode:
Diffstat (limited to 'CopyMailto/AppDelegate.m')
-rw-r--r--CopyMailto/AppDelegate.m15
1 files changed, 13 insertions, 2 deletions
diff --git a/CopyMailto/AppDelegate.m b/CopyMailto/AppDelegate.m
index 3ea136a..281d151 100644
--- a/CopyMailto/AppDelegate.m
+++ b/CopyMailto/AppDelegate.m
@@ -15,8 +15,12 @@
@implementation AppDelegate
-- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
- // Insert code here to initialize your application
+- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
+ [[NSAppleEventManager sharedAppleEventManager]
+ setEventHandler:self
+ andSelector:@selector(handleURLEvent:withReplyEvent:)
+ forEventClass:kInternetLocationMail
+ andEventID:kAEOpenApplication];
}
@@ -24,5 +28,12 @@
// Insert code here to tear down your application
}
+- (void)handleURLEvent:(NSAppleEventDescriptor *)event
+ withReplyEvent: (NSAppleEventDescriptor *)replyEvent
+{
+ NSString *url = [[event paramDescriptorForKeyword:keyDirectObject]
+ stringValue];
+ NSLog(@"%@", url);
+}
@end