Change the name of the Show/Hide Sidebar command as needed. Fix #98.
This commit is contained in:
parent
a3a9d467dc
commit
78530dbb96
|
@ -13,7 +13,7 @@ import Account
|
||||||
private let kWindowFrameKey = "MainWindow"
|
private let kWindowFrameKey = "MainWindow"
|
||||||
|
|
||||||
class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
|
|
||||||
var isOpen: Bool {
|
var isOpen: Bool {
|
||||||
return isWindowLoaded && window!.isVisible
|
return isWindowLoaded && window!.isVisible
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
|
|
||||||
static var didPositionWindowOnFirstRun = false
|
static var didPositionWindowOnFirstRun = false
|
||||||
|
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
|
|
||||||
super.windowDidLoad()
|
super.windowDidLoad()
|
||||||
|
|
||||||
if !AppDefaults.shared.showTitleOnMainWindow {
|
if !AppDefaults.shared.showTitleOnMainWindow {
|
||||||
window?.titleVisibility = .hidden
|
window?.titleVisibility = .hidden
|
||||||
|
@ -82,12 +82,12 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
return sidebarViewController?.selectedObjects
|
return sidebarViewController?.selectedObjects
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Notifications
|
// MARK: Notifications
|
||||||
|
|
||||||
@objc func applicationWillTerminate(_ note: Notification) {
|
@objc func applicationWillTerminate(_ note: Notification) {
|
||||||
|
|
||||||
window?.saveFrame(usingName: windowAutosaveName)
|
window?.saveFrame(usingName: windowAutosaveName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func appNavigationKeyPressed(_ note: Notification) {
|
@objc func appNavigationKeyPressed(_ note: Notification) {
|
||||||
|
|
||||||
|
@ -152,7 +152,22 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
if item.action == #selector(toolbarShowShareMenu(_:)) {
|
if item.action == #selector(toolbarShowShareMenu(_:)) {
|
||||||
return canShowShareMenu()
|
return canShowShareMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.action == #selector(toggleSidebar(_:)) {
|
||||||
|
|
||||||
|
guard let splitViewItem = sidebarSplitViewItem else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
let sidebarIsShowing = !splitViewItem.isCollapsed
|
||||||
|
if let menuItem = item as? NSMenuItem {
|
||||||
|
let title = sidebarIsShowing ? NSLocalizedString("Hide Sidebar", comment: "Menu item") : NSLocalizedString("Show Sidebar", comment: "Menu item")
|
||||||
|
menuItem.title = title
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,10 +186,10 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@IBAction func showAddFolderWindow(_ sender: Any) {
|
@IBAction func showAddFolderWindow(_ sender: Any) {
|
||||||
|
|
||||||
appDelegate.showAddFolderSheetOnWindow(window!)
|
appDelegate.showAddFolderSheetOnWindow(window!)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func showAddFeedWindow(_ sender: Any) {
|
@IBAction func showAddFeedWindow(_ sender: Any) {
|
||||||
|
|
||||||
|
@ -390,59 +405,47 @@ extension MainWindowController: NSToolbarDelegate {
|
||||||
private extension MainWindowController {
|
private extension MainWindowController {
|
||||||
|
|
||||||
var splitViewController: NSSplitViewController? {
|
var splitViewController: NSSplitViewController? {
|
||||||
get {
|
guard let viewController = contentViewController else {
|
||||||
guard let viewController = contentViewController else {
|
return nil
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return viewController.childViewControllers.first as? NSSplitViewController
|
|
||||||
}
|
}
|
||||||
|
return viewController.childViewControllers.first as? NSSplitViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
var sidebarViewController: SidebarViewController? {
|
var sidebarViewController: SidebarViewController? {
|
||||||
get {
|
return splitViewController?.splitViewItems[0].viewController as? SidebarViewController
|
||||||
return splitViewController?.splitViewItems[0].viewController as? SidebarViewController
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var timelineViewController: TimelineViewController? {
|
var timelineViewController: TimelineViewController? {
|
||||||
get {
|
return splitViewController?.splitViewItems[1].viewController as? TimelineViewController
|
||||||
return splitViewController?.splitViewItems[1].viewController as? TimelineViewController
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sidebarSplitViewItem: NSSplitViewItem? {
|
||||||
|
return splitViewController?.splitViewItems[0]
|
||||||
|
}
|
||||||
|
|
||||||
var detailSplitViewItem: NSSplitViewItem? {
|
var detailSplitViewItem: NSSplitViewItem? {
|
||||||
get {
|
return splitViewController?.splitViewItems[2]
|
||||||
return splitViewController?.splitViewItems[2]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var detailViewController: DetailViewController? {
|
var detailViewController: DetailViewController? {
|
||||||
get {
|
return splitViewController?.splitViewItems[2].viewController as? DetailViewController
|
||||||
return splitViewController?.splitViewItems[2].viewController as? DetailViewController
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectedArticles: [Article]? {
|
var selectedArticles: [Article]? {
|
||||||
get {
|
return timelineViewController?.selectedArticles
|
||||||
return timelineViewController?.selectedArticles
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var oneSelectedArticle: Article? {
|
var oneSelectedArticle: Article? {
|
||||||
get {
|
if let articles = selectedArticles {
|
||||||
if let articles = selectedArticles {
|
return articles.count == 1 ? articles[0] : nil
|
||||||
return articles.count == 1 ? articles[0] : nil
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentLink: String? {
|
var currentLink: String? {
|
||||||
get {
|
return oneSelectedArticle?.preferredLink
|
||||||
return oneSelectedArticle?.preferredLink
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func canGoToNextUnread() -> Bool {
|
func canGoToNextUnread() -> Bool {
|
||||||
|
|
||||||
guard let timelineViewController = timelineViewController, let sidebarViewController = sidebarViewController else {
|
guard let timelineViewController = timelineViewController, let sidebarViewController = sidebarViewController else {
|
||||||
|
|
Loading…
Reference in New Issue