mirror of
https://github.com/transmission/transmission
synced 2024-12-21 23:32:35 +00:00
Add ⌘C support (#3072)
This commit is contained in:
parent
7b34c09f26
commit
5026d43920
1 changed files with 19 additions and 0 deletions
|
@ -640,6 +640,25 @@
|
|||
return [self.fTorrentCell iconRectForBounds:[self rectOfRow:row]];
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
// add support to `copy:`
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)copy:(id)sender
|
||||
{
|
||||
NSArray<Torrent*>* selectedTorrents = self.selectedTorrents;
|
||||
if (selectedTorrents.count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
NSPasteboard* pasteBoard = NSPasteboard.generalPasteboard;
|
||||
NSString* links = [[selectedTorrents valueForKeyPath:@"magnetLink"] componentsJoinedByString:@"\n"];
|
||||
[pasteBoard declareTypes:@[ NSStringPboardType ] owner:nil];
|
||||
[pasteBoard setString:links forType:NSStringPboardType];
|
||||
}
|
||||
|
||||
- (void)paste:(id)sender
|
||||
{
|
||||
NSURL* url;
|
||||
|
|
Loading…
Reference in a new issue