If we have a url and string in the clipboard, only use the url when trying to open as a torrent file. This way we avoid opening the same URL twice

This commit is contained in:
Mitchell Livingston 2011-12-26 02:46:27 +00:00
parent 5339d25dca
commit 22a5e885ba
1 changed files with 1 additions and 4 deletions

View File

@ -545,8 +545,7 @@
NSURL * url; NSURL * url;
if ((url = [NSURL URLFromPasteboard: [NSPasteboard generalPasteboard]])) if ((url = [NSURL URLFromPasteboard: [NSPasteboard generalPasteboard]]))
[fController openURL: [url absoluteString]]; [fController openURL: [url absoluteString]];
else if ([NSApp isOnLionOrBetter])
if ([NSApp isOnLionOrBetter])
{ {
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
if (items) if (items)
@ -555,12 +554,10 @@
for (NSString * pbItem in items) for (NSString * pbItem in items)
{ {
for (NSTextCheckingResult * result in [detector matchesInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])]) for (NSTextCheckingResult * result in [detector matchesInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
{
[fController openURL: [[result URL] absoluteString]]; [fController openURL: [[result URL] absoluteString]];
} }
} }
} }
}
} }
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem - (BOOL) validateMenuItem: (NSMenuItem *) menuItem