Make progress on editing names in the inspectors.
This commit is contained in:
parent
2cf0dbd96e
commit
b2d3084313
|
@ -110,7 +110,14 @@ private extension FeedInspectorViewController {
|
|||
|
||||
func updateName() {
|
||||
|
||||
nameTextField?.stringValue = feed?.editedName ?? feed?.name ?? ""
|
||||
guard let nameTextField = nameTextField else {
|
||||
return
|
||||
}
|
||||
|
||||
let name = feed?.editedName ?? feed?.name ?? ""
|
||||
if nameTextField.stringValue != name {
|
||||
nameTextField.stringValue = name
|
||||
}
|
||||
}
|
||||
|
||||
func updateHomePageURL() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import AppKit
|
||||
import Account
|
||||
import RSCore
|
||||
|
||||
final class FolderInspectorViewController: NSViewController, Inspector {
|
||||
|
||||
|
@ -43,6 +44,29 @@ final class FolderInspectorViewController: NSViewController, Inspector {
|
|||
override func viewDidLoad() {
|
||||
|
||||
updateUI()
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
|
||||
@objc func displayNameDidChange(_ note: Notification) {
|
||||
|
||||
guard let updatedFolder = note.object as? Folder, updatedFolder == folder else {
|
||||
return
|
||||
}
|
||||
updateUI()
|
||||
}
|
||||
}
|
||||
|
||||
extension FolderInspectorViewController: NSTextFieldDelegate {
|
||||
|
||||
override func controlTextDidChange(_ note: Notification) {
|
||||
|
||||
guard let folder = folder, let nameTextField = nameTextField else {
|
||||
return
|
||||
}
|
||||
folder.name = nameTextField.stringValue
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +88,13 @@ private extension FolderInspectorViewController {
|
|||
|
||||
func updateUI() {
|
||||
|
||||
nameTextField?.stringValue = folder?.nameForDisplay ?? ""
|
||||
}
|
||||
guard let nameTextField = nameTextField else {
|
||||
return
|
||||
}
|
||||
|
||||
let name = folder?.nameForDisplay ?? ""
|
||||
if nameTextField.stringValue != name {
|
||||
nameTextField.stringValue = name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,6 +155,9 @@ Field</string>
|
|||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="ylq-Dz-pnT" id="30z-5n-OpR"/>
|
||||
</connections>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
|
|
@ -111,12 +111,18 @@ private extension InspectorWindowController {
|
|||
|
||||
func show(_ inspector: InspectorViewController) {
|
||||
|
||||
guard let window = window, inspector !== window.contentViewController else {
|
||||
guard let window = window else {
|
||||
return
|
||||
}
|
||||
|
||||
let flippedOrigin = window.flippedOrigin
|
||||
window.contentViewController = inspector
|
||||
|
||||
if window.contentViewController != inspector {
|
||||
window.contentViewController = inspector
|
||||
window.makeFirstResponder(nil)
|
||||
}
|
||||
|
||||
window.layoutIfNeeded()
|
||||
if let flippedOrigin = flippedOrigin {
|
||||
window.setFlippedOriginAdjustingForScreen(flippedOrigin)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue