Handle openFile and openURL - also don't start with a window open.
This commit is contained in:
parent
c7a7f46b34
commit
4b4bf6efc3
|
@ -132,7 +132,7 @@ static NSMenuItem *menuItemForItem(id item) {
|
|||
object: nil];
|
||||
[self bookmarksUpdated: nil];
|
||||
[self historyUpdated: nil];
|
||||
[self didTapNewWindow: nil];
|
||||
//[self didTapNewWindow: nil];
|
||||
}
|
||||
|
||||
-(void)didTapNewWindow: (id)sender {
|
||||
|
@ -298,6 +298,50 @@ static NSMenuItem *menuItemForItem(id item) {
|
|||
}
|
||||
}
|
||||
|
||||
- (BOOL) application: (NSApplication *)application
|
||||
openFile: (NSString *)fileName
|
||||
{
|
||||
NSArray *args;
|
||||
NSString *path;
|
||||
NSTask *task;
|
||||
|
||||
[self openDeveloperFileAtPath: fileName];
|
||||
return YES;
|
||||
|
||||
}
|
||||
|
||||
- (void) openURL: (NSPasteboard*)pb
|
||||
userData: (NSString*)ud
|
||||
error: (NSString**)err
|
||||
{
|
||||
NSString *url;
|
||||
NSArray *types;
|
||||
NSArray *args;
|
||||
NSString *path;
|
||||
NSTask *task;
|
||||
NSString *pboardString;
|
||||
|
||||
*err = nil;
|
||||
types = [pb types];
|
||||
|
||||
if (![types containsObject:NSStringPboardType] || !(pboardString = [pb stringForType:NSStringPboardType]))
|
||||
{
|
||||
*err = NSLocalizedString(@"Error: Pasteboard doesn't contain a string.",
|
||||
@"Pasteboard couldn't give string.");
|
||||
return;
|
||||
}
|
||||
|
||||
url = [pb stringForType: NSStringPboardType];
|
||||
if (url == nil)
|
||||
{
|
||||
*err = @"No string value supplied on pasteboard";
|
||||
return;
|
||||
}
|
||||
|
||||
[self openDeveloperFileAtPath: url];
|
||||
return;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
|
Loading…
Reference in New Issue