mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add optional toolbar items for Mark Above as Read and Mark Below as Read. Fixes #3686
This commit is contained in:
@@ -150,6 +150,14 @@ struct AppAssets {
|
||||
return NSImage(systemSymbolName: "arrow.up.arrow.down.circle", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
static var markAboveAsReadImage: RSImage = {
|
||||
return NSImage(systemSymbolName: "arrow.up.circle", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
static var markBelowAsReadImage: RSImage = {
|
||||
return NSImage(systemSymbolName: "arrow.down.circle", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
static var nextUnreadImage: RSImage = {
|
||||
return NSImage(systemSymbolName: "chevron.down.circle", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
@@ -223,6 +223,14 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
return canMarkAllAsRead()
|
||||
}
|
||||
|
||||
if item.action == #selector(markAboveAsRead(_:)) {
|
||||
return canMarkAboveAsRead()
|
||||
}
|
||||
|
||||
if item.action == #selector(markBelowAsRead(_:)) {
|
||||
return canMarkBelowAsRead()
|
||||
}
|
||||
|
||||
if item.action == #selector(toggleRead(_:)) {
|
||||
return validateToggleRead(item)
|
||||
}
|
||||
@@ -373,6 +381,14 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
currentTimelineViewController?.markAllAsRead()
|
||||
}
|
||||
|
||||
@IBAction func markAboveAsRead(_ sender: Any?) {
|
||||
currentTimelineViewController?.markAboveArticlesRead()
|
||||
}
|
||||
|
||||
@IBAction func markBelowAsRead(_ sender: Any?) {
|
||||
currentTimelineViewController?.markBelowArticlesRead()
|
||||
}
|
||||
|
||||
@IBAction func toggleRead(_ sender: Any?) {
|
||||
currentTimelineViewController?.toggleReadStatusForSelectedArticles()
|
||||
}
|
||||
@@ -763,6 +779,8 @@ extension NSToolbarItem.Identifier {
|
||||
static let timelineTrackingSeparator = NSToolbarItem.Identifier("timelineTrackingSeparator")
|
||||
static let search = NSToolbarItem.Identifier("search")
|
||||
static let markAllAsRead = NSToolbarItem.Identifier("markAllAsRead")
|
||||
static let markAboveAsRead = NSToolbarItem.Identifier("markAboveAsRead")
|
||||
static let markBelowAsRead = NSToolbarItem.Identifier("markBelowAsRead")
|
||||
static let toggleReadArticlesFilter = NSToolbarItem.Identifier("toggleReadArticlesFilter")
|
||||
static let nextUnread = NSToolbarItem.Identifier("nextUnread")
|
||||
static let markRead = NSToolbarItem.Identifier("markRead")
|
||||
@@ -800,6 +818,14 @@ extension MainWindowController: NSToolbarDelegate {
|
||||
let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
|
||||
return buildToolbarButton(.markAllAsRead, title, AppAssets.markAllAsReadImage, "markAllAsRead:")
|
||||
|
||||
case .markAboveAsRead:
|
||||
let title = NSLocalizedString("Mark Above as Read", comment: "Mark Above as Read")
|
||||
return buildToolbarButton(.markAboveAsRead, title, AppAssets.markAboveAsReadImage, "markAboveAsRead:")
|
||||
|
||||
case .markBelowAsRead:
|
||||
let title = NSLocalizedString("Mark Below as Read", comment: "Mark Below as Read")
|
||||
return buildToolbarButton(.markBelowAsRead, title, AppAssets.markBelowAsReadImage, "markBelowAsRead:")
|
||||
|
||||
case .toggleReadArticlesFilter:
|
||||
let title = NSLocalizedString("Read Articles Filter", comment: "Read Articles Filter")
|
||||
return buildToolbarButton(.toggleReadArticlesFilter, title, AppAssets.filterInactive, "toggleReadArticlesFilter:")
|
||||
@@ -868,6 +894,8 @@ extension MainWindowController: NSToolbarDelegate {
|
||||
.newSidebarItemMenu,
|
||||
.sidebarTrackingSeparator,
|
||||
.markAllAsRead,
|
||||
.markAboveAsRead,
|
||||
.markBelowAsRead,
|
||||
.toggleReadArticlesFilter,
|
||||
.timelineTrackingSeparator,
|
||||
.flexibleSpace,
|
||||
@@ -1021,7 +1049,6 @@ private extension MainWindowController {
|
||||
}
|
||||
|
||||
func canGoToNextUnread(wrappingToTop wrapping: Bool = false) -> Bool {
|
||||
|
||||
guard let timelineViewController = currentTimelineViewController, let sidebarViewController = sidebarViewController else {
|
||||
return false
|
||||
}
|
||||
@@ -1030,10 +1057,17 @@ private extension MainWindowController {
|
||||
}
|
||||
|
||||
func canMarkAllAsRead() -> Bool {
|
||||
|
||||
return currentTimelineViewController?.canMarkAllAsRead() ?? false
|
||||
}
|
||||
|
||||
func canMarkAboveAsRead() -> Bool {
|
||||
return currentTimelineViewController?.canMarkAboveArticlesAsRead() ?? false
|
||||
}
|
||||
|
||||
func canMarkBelowAsRead() -> Bool {
|
||||
return currentTimelineViewController?.canMarkBelowArticlesAsRead() ?? false
|
||||
}
|
||||
|
||||
func validateToggleRead(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||
|
||||
let validationStatus = currentTimelineViewController?.markReadCommandStatus() ?? .canDoNothing
|
||||
|
||||
Reference in New Issue
Block a user