mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-29 00:31:14 +00:00
Support the Copy command in the timeline. Fix #114.
This commit is contained in:
1 parent
81e56ba84b
commit
09b8cd7811
2 files changed
+26
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user