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:
parent
3e4bf1348f
commit
c38b8cb01f
2 changed files with 24 additions and 1 deletions
BIN
macosx/English.lproj/MessageWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MessageWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue