Show add account after delete account

This commit is contained in:
Maurice Parker 2019-05-02 06:57:45 -05:00
parent 137f061169
commit c25680ca5d
2 changed files with 10 additions and 3 deletions

View File

@ -28,9 +28,9 @@ class AccountsDeleteWindowController: NSWindowController {
// MARK: API
func runSheetOnWindow(_ hostWindow: NSWindow) {
func runSheetOnWindow(_ hostWindow: NSWindow, completionHandler handler: ((NSApplication.ModalResponse) -> Void)? = nil) {
self.hostWindow = hostWindow
hostWindow.beginSheet(window!)
hostWindow.beginSheet(window!, completionHandler: handler)
}
// MARK: Actions

View File

@ -38,12 +38,19 @@ final class AccountsPreferencesViewController: NSViewController {
}
@IBAction func removeAccount(_ sender: Any) {
guard tableView.selectedRow != -1 else {
return
}
let account = sortedAccounts[tableView.selectedRow]
deleteController = AccountsDeleteWindowController(account: account)
deleteController!.runSheetOnWindow(view.window!)
deleteController!.runSheetOnWindow(view.window!) { [weak self] result in
if result == NSApplication.ModalResponse.OK {
self?.showController(AccountsAddViewController())
}
}
}
@objc func displayNameDidChange(_ note: Notification) {