mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-09 08:23:42 +01:00
Add Mark Older as Read command to timeline contextual menu. Fix #336.
This commit is contained in:
parent
4db22b60c7
commit
26cca9e6e9
@ -261,7 +261,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
|
||||
@IBAction func markOlderArticlesAsRead(_ sender: Any?) {
|
||||
|
||||
timelineViewController?.markOlderArticlesAsRead()
|
||||
timelineViewController?.markOlderArticlesRead()
|
||||
}
|
||||
|
||||
@IBAction func navigateToTimeline(_ sender: Any?) {
|
||||
|
@ -44,7 +44,15 @@ extension TimelineViewController {
|
||||
guard let articles = articles(from: sender) else {
|
||||
return
|
||||
}
|
||||
markArticles(articles, read: false)
|
||||
markOlderArticlesRead(articles)
|
||||
}
|
||||
|
||||
@objc func markOlderArticlesReadFromContextualMenu(_ sender: Any?) {
|
||||
|
||||
guard let articles = articles(from: sender) else {
|
||||
return
|
||||
}
|
||||
markOlderArticlesRead(articles)
|
||||
}
|
||||
|
||||
@objc func markArticlesStarredFromContextualMenu(_ sender: Any?) {
|
||||
@ -134,6 +142,9 @@ private extension TimelineViewController {
|
||||
if articles.anyArticleIsStarred() {
|
||||
menu.addItem(markUnstarredMenuItem(articles))
|
||||
}
|
||||
if articles.count > 0 {
|
||||
menu.addItem(markOlderReadMenuItem(articles))
|
||||
}
|
||||
menu.addSeparatorIfNeeded()
|
||||
|
||||
if articles.count == 1, let link = articles.first!.preferredLink {
|
||||
@ -195,6 +206,10 @@ private extension TimelineViewController {
|
||||
return menuItem(NSLocalizedString("Mark as Unstarred", comment: "Command"), #selector(markArticlesUnstarredFromContextualMenu(_:)), articles)
|
||||
}
|
||||
|
||||
func markOlderReadMenuItem(_ articles: [Article]) -> NSMenuItem {
|
||||
return menuItem(NSLocalizedString("Mark Older as Read", comment: "Command"), #selector(markOlderArticlesReadFromContextualMenu(_:)), articles)
|
||||
}
|
||||
|
||||
func openInBrowserMenuItem(_ urlString: String) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Open in Browser", comment: "Command"), #selector(openInBrowserFromContextualMenu(_:)), urlString)
|
||||
|
@ -240,9 +240,16 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||
return MarkCommandValidationStatus.statusFor(selectedArticles) { $0.anyArticleIsUnread() }
|
||||
}
|
||||
|
||||
func markOlderArticlesAsRead() {
|
||||
func markOlderArticlesRead() {
|
||||
markOlderArticlesRead(selectedArticles)
|
||||
}
|
||||
|
||||
// Mark articles the same age or older than the selected article(s) as read.
|
||||
func canMarkOlderArticlesAsRead() -> Bool {
|
||||
return !selectedArticles.isEmpty
|
||||
}
|
||||
|
||||
func markOlderArticlesRead(_ selectedArticles: [Article]) {
|
||||
// Mark articles the same age or older than the selectedArticles(s) as read.
|
||||
|
||||
var cutoffDate: Date? = nil
|
||||
for article in selectedArticles {
|
||||
@ -268,11 +275,6 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||
runCommand(markReadCommand)
|
||||
}
|
||||
|
||||
func canMarkOlderArticlesAsRead() -> Bool {
|
||||
|
||||
return !selectedArticles.isEmpty
|
||||
}
|
||||
|
||||
// MARK: - Navigation
|
||||
|
||||
func goToNextUnread() {
|
||||
|
Loading…
Reference in New Issue
Block a user