Add new-feed and new-folder commands to the sidebar gear menu when there’s no selection.

This commit is contained in:
Brent Simmons
2018-02-03 21:30:30 -08:00
parent 68d0885b0d
commit 27c5ffa5eb
3 changed files with 25 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ extension MainWindowController {
func menu(for objects: [Any]?) -> NSMenu? {
guard let objects = objects, objects.count > 0 else {
return nil
return menuForNoSelection()
}
if objects.count == 1 {
@@ -55,6 +55,7 @@ extension MainWindowController {
@objc func markObjectsReadFromContextualMenu(_ sender: Any?) {
}
@objc func deleteFromContextualMenu(_ sender: Any?) {
@@ -92,6 +93,16 @@ extension MainWindowController: RenameWindowControllerDelegate {
private extension MainWindowController {
func menuForNoSelection() -> NSMenu {
let menu = NSMenu(title: "")
menu.addItem(withTitle: NSLocalizedString("New Feed", comment: "Command"), action: #selector(showAddFeedWindow(_:)), keyEquivalent: "")
menu.addItem(withTitle: NSLocalizedString("New Folder", comment: "Command"), action: #selector(showAddFolderWindow(_:)), keyEquivalent: "")
return menu
}
func menuForFeed(_ feed: Feed) -> NSMenu? {
let menu = NSMenu(title: "")

View File

@@ -177,7 +177,12 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
appDelegate.showAddFolderSheetOnWindow(window!)
}
@IBAction func showAddFeedWindow(_ sender: Any) {
appDelegate.showAddFeedSheetOnWindow(window!, urlString: nil, name: nil)
}
@IBAction func openArticleInBrowser(_ sender: Any?) {
if let link = currentLink {