Show add account after delete account
This commit is contained in:
parent
137f061169
commit
c25680ca5d
|
@ -28,9 +28,9 @@ class AccountsDeleteWindowController: NSWindowController {
|
||||||
|
|
||||||
// MARK: API
|
// MARK: API
|
||||||
|
|
||||||
func runSheetOnWindow(_ hostWindow: NSWindow) {
|
func runSheetOnWindow(_ hostWindow: NSWindow, completionHandler handler: ((NSApplication.ModalResponse) -> Void)? = nil) {
|
||||||
self.hostWindow = hostWindow
|
self.hostWindow = hostWindow
|
||||||
hostWindow.beginSheet(window!)
|
hostWindow.beginSheet(window!, completionHandler: handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Actions
|
// MARK: Actions
|
||||||
|
|
|
@ -38,12 +38,19 @@ final class AccountsPreferencesViewController: NSViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func removeAccount(_ sender: Any) {
|
@IBAction func removeAccount(_ sender: Any) {
|
||||||
|
|
||||||
guard tableView.selectedRow != -1 else {
|
guard tableView.selectedRow != -1 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let account = sortedAccounts[tableView.selectedRow]
|
let account = sortedAccounts[tableView.selectedRow]
|
||||||
deleteController = AccountsDeleteWindowController(account: account)
|
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) {
|
@objc func displayNameDidChange(_ note: Notification) {
|
||||||
|
|
Loading…
Reference in New Issue