Support the Copy command in the timeline. Fix #114.
This commit is contained in:
parent
81e56ba84b
commit
09b8cd7811
@ -8,6 +8,14 @@
|
||||
|
||||
import AppKit
|
||||
import Data
|
||||
import RSCore
|
||||
|
||||
extension Article: PasteboardWriterOwner {
|
||||
|
||||
public var pasteboardWriter: NSPasteboardWriting {
|
||||
return ArticlePasteboardWriter(article: self)
|
||||
}
|
||||
}
|
||||
|
||||
@objc final class ArticlePasteboardWriter: NSObject, NSPasteboardWriting {
|
||||
|
||||
|
@ -214,6 +214,11 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||
runCommand(markUnreadCommand)
|
||||
}
|
||||
|
||||
@IBAction func copy(_ sender: Any?) {
|
||||
|
||||
NSPasteboard.general.copyObjects(selectedArticles)
|
||||
}
|
||||
|
||||
func markOlderArticlesAsRead() {
|
||||
|
||||
// Mark articles the same age or older than the selected article(s) as read.
|
||||
@ -422,6 +427,19 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: NSUserInterfaceValidations
|
||||
|
||||
extension TimelineViewController: NSUserInterfaceValidations {
|
||||
|
||||
func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||
|
||||
if item.action == #selector(copy(_:)) {
|
||||
return NSPasteboard.general.canCopyAtLeastOneObject(selectedArticles)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - NSTableViewDataSource
|
||||
|
||||
extension TimelineViewController: NSTableViewDataSource {
|
||||
|
Loading…
x
Reference in New Issue
Block a user