Mark Read command now works.

This commit is contained in:
Brent Simmons 2017-11-05 21:27:34 -08:00
parent 11aa68fd6f
commit a7464daf15
5 changed files with 31 additions and 9 deletions

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16F73" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13770" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12118"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13770"/>
</dependencies>
<scenes>
<!--Application-->
@ -412,7 +411,11 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Article" id="57V-gv-vEw">
<items>
<menuItem title="Mark as Read" keyEquivalent="U" id="Fc9-c7-2AY"/>
<menuItem title="Mark as Read" keyEquivalent="U" id="Fc9-c7-2AY">
<connections>
<action selector="markRead:" target="Ady-hI-5gd" id="RQv-jl-2Nv"/>
</connections>
</menuItem>
<menuItem title="Mark All as Read" keyEquivalent="k" id="HdN-Ks-cwh">
<connections>
<action selector="markAllAsRead:" target="Ady-hI-5gd" id="154-2D-ONk"/>

View File

@ -141,6 +141,9 @@
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<connections>
<action selector="markRead:" target="Oky-zY-oP4" id="yFY-gd-FOd"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="4DED27B7-8961-48F3-A995-9C961E2C0257" label="Open in Browser" paletteLabel="Open in Browser" image="ToolbarPlaceholder" id="tid-SB-me3" customClass="RSToolbarItem" customModule="RSCore">
<nil key="toolTip"/>

View File

@ -101,7 +101,11 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
if item.action == #selector(markAllAsRead(_:)) {
return canMarkAllAsRead()
}
if item.action == #selector(markRead(_:)) {
return canMarkRead()
}
return true
}
@ -139,6 +143,11 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
timelineViewController?.markAllAsRead()
}
@IBAction func markRead(_ sender: AnyObject?) {
timelineViewController?.markSelectedArticlesAsRead(sender!)
}
@IBAction func toggleSidebar(_ sender: AnyObject?) {
@ -218,6 +227,11 @@ private extension MainWindowController {
return timelineViewController?.canMarkAllAsRead() ?? false
}
func canMarkRead() -> Bool {
return timelineViewController?.canMarkSelectedArticlesAsRead() ?? false
}
func updateWindowTitle() {
if unreadCount < 1 {

View File

@ -81,9 +81,6 @@ final class StatusBarView: NSView {
guard let window = window, let notificationWindow = appInfo.view?.window, window === notificationWindow else {
return
}
guard let link = appInfo.url else {
return
}
mouseoverLink = nil
}

View File

@ -127,6 +127,11 @@ class TimelineViewController: NSViewController, KeyboardDelegate, UndoableComman
return articles.canMarkAllAsRead()
}
func canMarkSelectedArticlesAsRead() -> Bool {
return selectedArticles.canMarkAllAsRead()
}
// MARK: - Actions
@objc func openArticleInBrowser(_ sender: AnyObject) {
@ -153,7 +158,7 @@ class TimelineViewController: NSViewController, KeyboardDelegate, UndoableComman
}
}
@IBAction func markSelectedArticlesAsRead(_ sender: AnyObject) {
@IBAction func markSelectedArticlesAsRead(_ sender: AnyObject?) {
guard let undoManager = undoManager, let markReadCommand = MarkReadOrUnreadCommand(initialArticles: selectedArticles, markingRead: true, undoManager: undoManager) else {
return