2019-03-21 06:10:22 +01:00
|
|
|
//
|
|
|
|
// LocalAccountPreferencesViewController.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 3/20/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import AppKit
|
|
|
|
import Account
|
|
|
|
|
2019-05-01 13:49:50 +02:00
|
|
|
final class AccountDetailViewController: NSViewController, NSTextFieldDelegate {
|
2019-03-21 06:10:22 +01:00
|
|
|
|
2019-04-30 13:38:18 +02:00
|
|
|
@IBOutlet weak var typeLabel: NSTextField!
|
|
|
|
@IBOutlet weak var nameTextField: NSTextField!
|
|
|
|
|
2019-03-21 06:10:22 +01:00
|
|
|
private weak var account: Account?
|
|
|
|
|
|
|
|
init(account: Account) {
|
2019-05-01 13:49:50 +02:00
|
|
|
super.init(nibName: "AccountDetail", bundle: nil)
|
2019-03-21 06:10:22 +01:00
|
|
|
self.account = account
|
|
|
|
}
|
|
|
|
|
|
|
|
public required init?(coder: NSCoder) {
|
|
|
|
super.init(coder: coder)
|
|
|
|
}
|
2019-04-30 13:38:18 +02:00
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
|
|
|
nameTextField.delegate = self
|
|
|
|
typeLabel.stringValue = account?.defaultName ?? ""
|
|
|
|
nameTextField.stringValue = account?.name ?? ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func controlTextDidEndEditing(_ obj: Notification) {
|
|
|
|
if !nameTextField.stringValue.isEmpty {
|
|
|
|
account?.name = nameTextField.stringValue
|
|
|
|
} else {
|
|
|
|
account?.name = nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-21 06:10:22 +01:00
|
|
|
}
|