1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00

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

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,13 +554,11 @@
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
{ {