Make Go > Today, Unread, Starred commands work. Fix #310.

This commit is contained in:
Brent Simmons 2018-01-27 12:39:07 -08:00
parent 1a53e59c3a
commit 3ff00b7eb0
4 changed files with 66 additions and 6 deletions

View File

@ -50,7 +50,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
private let windowControllers = NSMutableArray() private let windowControllers = NSMutableArray()
private var preferencesWindowController: NSWindowController? private var preferencesWindowController: NSWindowController?
private var mainWindowController: NSWindowController? private var mainWindowController: MainWindowController?
private var readerWindows = [NSWindowController]() private var readerWindows = [NSWindowController]()
private var feedListWindowController: NSWindowController? private var feedListWindowController: NSWindowController?
private var addFeedController: AddFeedController? private var addFeedController: AddFeedController?
@ -442,13 +442,31 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
AccountManager.shared.accounts.forEach{ $0.debugDropConditionalGetInfo() } AccountManager.shared.accounts.forEach{ $0.debugDropConditionalGetInfo() }
#endif #endif
} }
@IBAction func gotoToday(_ sender: Any?) {
createAndShowMainWindow()
mainWindowController!.gotoToday(sender)
}
@IBAction func gotoAllUnread(_ sender: Any?) {
createAndShowMainWindow()
mainWindowController!.gotoAllUnread(sender)
}
@IBAction func gotoStarred(_ sender: Any?) {
createAndShowMainWindow()
mainWindowController!.gotoStarred(sender)
}
} }
private extension AppDelegate { private extension AppDelegate {
func createReaderWindow() -> NSWindowController { func createReaderWindow() -> MainWindowController {
return windowControllerWithName("MainWindow") return windowControllerWithName("MainWindow") as! MainWindowController
} }
func objectsForInspector() -> [Any]? { func objectsForInspector() -> [Any]? {

View File

@ -372,9 +372,21 @@
</connections> </connections>
</menuItem> </menuItem>
<menuItem isSeparatorItem="YES" id="xbe-2a-mp4"/> <menuItem isSeparatorItem="YES" id="xbe-2a-mp4"/>
<menuItem title="Today" keyEquivalent="1" id="L20-jv-7c9"/> <menuItem title="Today" keyEquivalent="1" id="L20-jv-7c9">
<menuItem title="All Unread" keyEquivalent="2" id="8ZT-ew-JNc"/> <connections>
<menuItem title="Starred" keyEquivalent="3" id="ZRx-me-QXO"/> <action selector="gotoToday:" target="Ady-hI-5gd" id="GyO-dW-XCy"/>
</connections>
</menuItem>
<menuItem title="All Unread" keyEquivalent="2" id="8ZT-ew-JNc">
<connections>
<action selector="gotoAllUnread:" target="Ady-hI-5gd" id="xGb-dU-hH7"/>
</connections>
</menuItem>
<menuItem title="Starred" keyEquivalent="3" id="ZRx-me-QXO">
<connections>
<action selector="gotoStarred:" target="Ady-hI-5gd" id="p7p-rP-Ezb"/>
</connections>
</menuItem>
</items> </items>
</menu> </menu>
</menuItem> </menuItem>

View File

@ -277,6 +277,21 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
sidebarViewController?.outlineView.selectNextRow(sender) sidebarViewController?.outlineView.selectNextRow(sender)
} }
@IBAction func gotoToday(_ sender: Any?) {
sidebarViewController?.gotoToday(sender)
}
@IBAction func gotoAllUnread(_ sender: Any?) {
sidebarViewController?.gotoAllUnread(sender)
}
@IBAction func gotoStarred(_ sender: Any?) {
sidebarViewController?.gotoStarred(sender)
}
@IBAction func toolbarShowShareMenu(_ sender: Any?) { @IBAction func toolbarShowShareMenu(_ sender: Any?) {
guard let selectedArticles = selectedArticles, !selectedArticles.isEmpty else { guard let selectedArticles = selectedArticles, !selectedArticles.isEmpty else {

View File

@ -146,6 +146,21 @@ import RSCore
Browser.open(homePageURL) Browser.open(homePageURL)
} }
@IBAction func gotoToday(_ sender: Any?) {
outlineView.revealAndSelectRepresentedObject(SmartFeedsController.shared.todayFeed, treeController)
}
@IBAction func gotoAllUnread(_ sender: Any?) {
outlineView.revealAndSelectRepresentedObject(SmartFeedsController.shared.unreadFeed, treeController)
}
@IBAction func gotoStarred(_ sender: Any?) {
outlineView.revealAndSelectRepresentedObject(SmartFeedsController.shared.starredFeed, treeController)
}
// MARK: Navigation // MARK: Navigation
func canGoToNextUnread() -> Bool { func canGoToNextUnread() -> Bool {