Use TreeController.normalizedSelectedNodes in the delete action.

This commit is contained in:
Brent Simmons 2017-10-21 12:14:45 -07:00
parent edea37dba6
commit 595af2561d
1 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import Account
@objc class SidebarViewController: NSViewController, NSOutlineViewDelegate, NSOutlineViewDataSource { @objc class SidebarViewController: NSViewController, NSOutlineViewDelegate, NSOutlineViewDataSource {
@IBOutlet var outlineView: NSOutlineView! @IBOutlet var outlineView: SidebarOutlineView!
let treeControllerDelegate = SidebarTreeControllerDelegate() let treeControllerDelegate = SidebarTreeControllerDelegate()
lazy var treeController: TreeController = { lazy var treeController: TreeController = {
TreeController(delegate: treeControllerDelegate) TreeController(delegate: treeControllerDelegate)
@ -23,6 +23,8 @@ import Account
override func viewDidLoad() { override func viewDidLoad() {
outlineView.sidebarViewController = self
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(userDidAddFeed(_:)), name: UserDidAddFeedNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userDidAddFeed(_:)), name: UserDidAddFeedNotification, object: nil)
@ -69,7 +71,7 @@ import Account
return return
} }
let nodesToDelete = selectedNodes let nodesToDelete = treeController.normalizedSelectedNodes(selectedNodes)
let selectedRows = outlineView.selectedRowIndexes let selectedRows = outlineView.selectedRowIndexes
outlineView.beginUpdates() outlineView.beginUpdates()