1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 14:13:23 +00:00

on 10.6, use the new copying methods in the message window

This commit is contained in:
Mitchell Livingston 2009-10-19 03:14:49 +00:00
parent c2f8e82c3d
commit 3ae277af17

View file

@ -249,16 +249,25 @@
- (void) copy: (id) sender
{
NSPasteboard * pb = [NSPasteboard generalPasteboard];
[pb declareTypes: [NSArray arrayWithObject: NSStringPboardType] owner: self];
NSIndexSet * indexes = [fMessageTable selectedRowIndexes];
NSMutableArray * messageStrings = [NSMutableArray arrayWithCapacity: [indexes count]];
for (NSDictionary * message in [fMessages objectsAtIndexes: indexes])
[messageStrings addObject: [self stringForMessage: message]];
[pb setString: [messageStrings componentsJoinedByString: @"\n"] forType: NSStringPboardType];
NSString * messageString = [messageStrings componentsJoinedByString: @"\n"];
NSPasteboard * pb = [NSPasteboard generalPasteboard];
if ([NSApp isOnSnowLeopardOrBetter])
{
[pb clearContents];
[pb writeObjects: [NSArray arrayWithObject: messageString]];
}
else
{
[pb declareTypes: [NSArray arrayWithObject: NSStringPboardType] owner: nil];
[pb setString: messageString forType: NSStringPboardType];
}
}
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem