mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
support pasting magnet links into the torrent table
This commit is contained in:
parent
22a5e885ba
commit
2a670d54a9
1 changed files with 10 additions and 3 deletions
|
@ -553,8 +553,14 @@
|
|||
NSDataDetector * detector = [NSDataDetectorLion dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
|
||||
for (NSString * pbItem in items)
|
||||
{
|
||||
for (NSTextCheckingResult * result in [detector matchesInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
|
||||
[fController openURL: [[result URL] absoluteString]];
|
||||
if ([pbItem rangeOfString: @"magnet:" options: (NSAnchoredSearch | NSCaseInsensitiveSearch)].location != NSNotFound)
|
||||
[fController openURL: pbItem];
|
||||
else
|
||||
{
|
||||
#warning only accept full text?
|
||||
for (NSTextCheckingResult * result in [detector matchesInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
|
||||
[fController openURL: [[result URL] absoluteString]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -577,7 +583,8 @@
|
|||
NSDataDetector * detector = [NSDataDetectorLion dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
|
||||
for (NSString * pbItem in items)
|
||||
{
|
||||
if ([detector firstMatchInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
|
||||
if (([pbItem rangeOfString: @"magnet:" options: (NSAnchoredSearch | NSCaseInsensitiveSearch)].location != NSNotFound)
|
||||
|| [detector firstMatchInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue