mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-08 16:18:48 +01:00
Restore functionality to mark older as read using keyboard shortcut. Issue #2451
This commit is contained in:
parent
cb714d6781
commit
e575aeca3c
@ -402,7 +402,11 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||||||
sidebarViewController?.focus()
|
sidebarViewController?.focus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IBAction func markOlderArticlesAsRead(_ sender: Any?) {
|
||||||
|
currentTimelineViewController?.markOlderArticlesRead()
|
||||||
|
}
|
||||||
|
|
||||||
@IBAction func markAboveArticlesAsRead(_ sender: Any?) {
|
@IBAction func markAboveArticlesAsRead(_ sender: Any?) {
|
||||||
currentTimelineViewController?.markAboveArticlesRead()
|
currentTimelineViewController?.markAboveArticlesRead()
|
||||||
}
|
}
|
||||||
|
@ -460,6 +460,10 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
|||||||
return .canDoNothing
|
return .canDoNothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func markOlderArticlesRead() {
|
||||||
|
markOlderArticlesRead(selectedArticles)
|
||||||
|
}
|
||||||
|
|
||||||
func markAboveArticlesRead() {
|
func markAboveArticlesRead() {
|
||||||
markAboveArticlesRead(selectedArticles)
|
markAboveArticlesRead(selectedArticles)
|
||||||
}
|
}
|
||||||
@ -478,6 +482,33 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
|||||||
return articles.articlesBelow(article: last).canMarkAllAsRead()
|
return articles.articlesBelow(article: last).canMarkAllAsRead()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func markOlderArticlesRead(_ selectedArticles: [Article]) {
|
||||||
|
// Mark articles older than the selectedArticles(s) as read.
|
||||||
|
|
||||||
|
var cutoffDate: Date? = nil
|
||||||
|
for article in selectedArticles {
|
||||||
|
if cutoffDate == nil {
|
||||||
|
cutoffDate = article.logicalDatePublished
|
||||||
|
}
|
||||||
|
else if cutoffDate! > article.logicalDatePublished {
|
||||||
|
cutoffDate = article.logicalDatePublished
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if cutoffDate == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let articlesToMark = articles.filter { $0.logicalDatePublished < cutoffDate! }
|
||||||
|
if articlesToMark.isEmpty {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let undoManager = undoManager, let markReadCommand = MarkStatusCommand(initialArticles: articlesToMark, markingRead: true, undoManager: undoManager) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
runCommand(markReadCommand)
|
||||||
|
}
|
||||||
|
|
||||||
func markAboveArticlesRead(_ selectedArticles: [Article]) {
|
func markAboveArticlesRead(_ selectedArticles: [Article]) {
|
||||||
guard let first = selectedArticles.first else { return }
|
guard let first = selectedArticles.first else { return }
|
||||||
let articlesToMark = articles.articlesAbove(article: first)
|
let articlesToMark = articles.articlesAbove(article: first)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user