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

add ability to copy to the message window, and allow multiple selection

This commit is contained in:
Mitchell Livingston 2007-09-11 00:44:15 +00:00
parent 3e4bf1348f
commit c38b8cb01f
2 changed files with 24 additions and 1 deletions

View file

@ -164,10 +164,33 @@
- (void) tableView: (NSTableView *) tableView sortDescriptorsDidChange: (NSArray *) oldDescriptors
{
[fMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
[fMessageTable reloadData];
}
- (void) copy: (id) sender
{
NSIndexSet * indexes = [fMessageTable selectedRowIndexes];
NSMutableArray * messageStrings = [NSMutableArray arrayWithCapacity: [indexes count]];
unsigned int i;
for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
[messageStrings addObject: [self stringForMessage: [fMessages objectAtIndex: i]]];
NSPasteboard * pb = [NSPasteboard generalPasteboard];
[pb declareTypes: [NSArray arrayWithObject: NSStringPboardType] owner: self];
[pb setString: [messageStrings componentsJoinedByString: @"\n"] forType: NSStringPboardType];
}
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
{
SEL action = [menuItem action];
if (action == @selector(copy:))
return [fMessageTable numberOfSelectedRows] > 0;
return YES;
}
- (void) changeLevel: (id) sender
{
[self updateLog: nil];