[subversion:60] registering HTTPClient.app as an application that can open 'http' and 'h
- From: itod@kenai.com
- To: commits@mac-httpclient.kenai.com
- Subject: [subversion:60] registering HTTPClient.app as an application that can open 'http' and 'h
- Date: Sat, 3 Jan 2009 00:09:47 +0000 (GMT)
Repository: subversion
Revision: 60
Author: itod
Date: 2009-01-03 00:09:42 UTC
Log Message:
-----------
registering HTTPClient.app as an application that can open 'http' and
'https' getURL apple events.
and also handling those events by opening a new doc, putting in the
URL/method, and executing the request
*** improvement to that feature. it wasn't working if HTTPClient.app
was not already running (apple event registration happend too late
after startup)
also, added alert pane if a document cannot be opened (shouldnt ever
happen hopefully)
Modified Paths:
--------------
HTTPClient/src/HCAppDelegate.m
Diffs:
-----
Index: HTTPClient/src/HCAppDelegate.m
===================================================================
--- HTTPClient/src/HCAppDelegate.m (revision 59)
+++ HTTPClient/src/HCAppDelegate.m (revision 60)
@@ -33,6 +33,10 @@
- (id)init {
self = [super init];
if (self) {
+ [[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
+
andSelector:@selector(getURLEvent:withReplyEvent:)
+
forEventClass:kInternetEventClass
+
andEventID:kAEGetURL];
}
return self;
}
@@ -48,10 +52,6 @@
#pragma mark NSApplicationDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)n {
- [[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
-
andSelector:@selector(getURLEvent:withReplyEvent:)
-
forEventClass:kInternetEventClass
-
andEventID:kAEGetURL];
}
@@ -70,20 +70,23 @@
NSString *URLString = [[event
paramDescriptorForKeyword:keyDirectObject] stringValue];
NSError *err = nil;
- id doc = [[NSDocumentController sharedDocumentController]
openUntitledDocumentAndDisplay:YES error:&err];
+ HCDocument *doc = [[NSDocumentController sharedDocumentController]
openUntitledDocumentAndDisplay:YES error:&err];
if (err) {
- NSBeep();
- NSLog(@"%@", err);
+ NSString *title = NSLocalizedString(@"Can't open URL sent from
other application.", @"");
+ NSString *msgFormat = NSLocalizedString(@"URL: %@\nError:%@",
@"");
+ NSString *defaultButton = NSLocalizedString(@"OK", @"");
+ NSRunAlertPanel(title, msgFormat, defaultButton, nil, nil,
URLString, err);
return;
}
- HCWindowController *winController = [doc windowController];
+ HCWindowController *winController = doc.windowController;
id cmd = [NSMutableDictionary dictionaryWithObjectsAndKeys:
URLString, @"URLString",
@"GET", @"method",
nil];
winController.command = cmd;
+
[winController execute:self];
}
|
[subversion:60] registering HTTPClient.app as an application that can open 'http' and 'h |
itod | 01/03/2009 |





