From 3ae277af172b3dd9a689904507f317a147f8845d Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 19 Oct 2009 03:14:49 +0000 Subject: [PATCH] on 10.6, use the new copying methods in the message window --- macosx/MessageWindowController.m | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/macosx/MessageWindowController.m b/macosx/MessageWindowController.m index aa322e807..0b7f570f8 100644 --- a/macosx/MessageWindowController.m +++ b/macosx/MessageWindowController.m @@ -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