1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 07:42:37 +00:00

Add ⌘C support (#3072)

This commit is contained in:
Antoine Cœur 2022-05-14 05:03:07 +08:00 committed by GitHub
parent 7b34c09f26
commit 5026d43920
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;