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

run on Snow Leopard again

This commit is contained in:
Mitchell Livingston 2011-12-26 02:39:30 +00:00
parent aafb346abd
commit 5339d25dca
2 changed files with 11 additions and 7 deletions

View file

@ -23,6 +23,7 @@
*****************************************************************************/
#define NSPopoverLion NSClassFromString(@"NSPopover")
#define NSDataDetectorLion NSClassFromString(@"NSDataDetector")
@interface NSApplication (NSApplicationAdditions)

View file

@ -551,7 +551,7 @@
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
if (items)
{
NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
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])])
@ -572,14 +572,17 @@
if ([[[NSPasteboard generalPasteboard] types] containsObject: NSURLPboardType])
return YES;
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
if (items)
if ([NSApp isOnLionOrBetter])
{
NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
for (NSString * pbItem in items)
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
if (items)
{
if ([detector firstMatchInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
return YES;
NSDataDetector * detector = [NSDataDetectorLion dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
for (NSString * pbItem in items)
{
if ([detector firstMatchInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
return YES;
}
}
}