Changeset 13119


Ignore:
Timestamp:
Dec 27, 2011, 11:19:14 PM (9 years ago)
Author:
livings124
Message:

support pasting magnet links into the torrent table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentTableView.m

    r13118 r13119  
    554554            for (NSString * pbItem in items)
    555555            {
    556                 for (NSTextCheckingResult * result in [detector matchesInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
    557                     [fController openURL: [[result URL] absoluteString]];
     556                if ([pbItem rangeOfString: @"magnet:" options: (NSAnchoredSearch | NSCaseInsensitiveSearch)].location != NSNotFound)
     557                    [fController openURL: pbItem];
     558                else
     559                {
     560                    #warning only accept full text?
     561                    for (NSTextCheckingResult * result in [detector matchesInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
     562                        [fController openURL: [[result URL] absoluteString]];
     563                }
    558564            }
    559565        }
     
    578584                for (NSString * pbItem in items)
    579585                {
    580                     if ([detector firstMatchInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
     586                    if (([pbItem rangeOfString: @"magnet:" options: (NSAnchoredSearch | NSCaseInsensitiveSearch)].location != NSNotFound)
     587                        || [detector firstMatchInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
    581588                        return YES;
    582589                }
Note: See TracChangeset for help on using the changeset viewer.