Add ⌘C support (#3072)
This commit is contained in:
parent
7b34c09f26
commit
5026d43920
|
@ -640,6 +640,25 @@
|
||||||
return [self.fTorrentCell iconRectForBounds:[self rectOfRow:row]];
|
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
|
- (void)paste:(id)sender
|
||||||
{
|
{
|
||||||
NSURL* url;
|
NSURL* url;
|
||||||
|
|
Loading…
Reference in New Issue