PhraseEditorCocoa // Remove isSaved().

- This is to synchronize behaviors with PhraseEditorUI.
This commit is contained in:
ShikiSuen 2022-12-08 17:08:23 +08:00
parent 31ae856530
commit 7e73eab9f2
2 changed files with 0 additions and 9 deletions

View File

@ -55,10 +55,6 @@ class CtlPrefWindow: NSWindowController {
didSet { setPEUIControlAvailability() } didSet { setPEUIControlAvailability() }
} }
var isSaved = false {
didSet { setPEUIControlAvailability() }
}
@IBOutlet var vwrGeneral: NSView! @IBOutlet var vwrGeneral: NSView!
@IBOutlet var vwrExperience: NSView! @IBOutlet var vwrExperience: NSView!
@IBOutlet var vwrDictionary: NSView! @IBOutlet var vwrDictionary: NSView!

View File

@ -40,7 +40,6 @@ extension CtlPrefWindow: NSTextViewDelegate, NSTextFieldDelegate {
tfdPETextEditor.string = NSLocalizedString("Loading…", comment: "") tfdPETextEditor.string = NSLocalizedString("Loading…", comment: "")
DispatchQueue.main.async { [self] in DispatchQueue.main.async { [self] in
tfdPETextEditor.string = LMMgr.retrieveData(mode: selInputMode, type: selUserDataType) tfdPETextEditor.string = LMMgr.retrieveData(mode: selInputMode, type: selUserDataType)
isSaved = true
isLoading = false isLoading = false
} }
} }
@ -176,19 +175,16 @@ extension CtlPrefWindow: NSTextViewDelegate, NSTextFieldDelegate {
LMMgr.shared.tagOverrides(in: &tfdPETextEditor.string, mode: selInputMode) LMMgr.shared.tagOverrides(in: &tfdPETextEditor.string, mode: selInputMode)
} }
isLoading = false isLoading = false
isSaved = false
} }
} }
@IBAction func savePEButtonClicked(_: NSButton) { @IBAction func savePEButtonClicked(_: NSButton) {
// guard !isSaved else { return }
let toSave = tfdPETextEditor.string let toSave = tfdPETextEditor.string
isLoading = true isLoading = true
tfdPETextEditor.string = NSLocalizedString("Loading…", comment: "") tfdPETextEditor.string = NSLocalizedString("Loading…", comment: "")
let newResult = LMMgr.saveData(mode: selInputMode, type: selUserDataType, data: toSave) let newResult = LMMgr.saveData(mode: selInputMode, type: selUserDataType, data: toSave)
tfdPETextEditor.string = newResult tfdPETextEditor.string = newResult
isLoading = false isLoading = false
isSaved = true
} }
@IBAction func openExternallyPEButtonClicked(_: NSButton) { @IBAction func openExternallyPEButtonClicked(_: NSButton) {
@ -224,7 +220,6 @@ extension CtlPrefWindow: NSTextViewDelegate, NSTextFieldDelegate {
arrResult.insert("\n", at: 0) arrResult.insert("\n", at: 0)
} }
tfdPETextEditor.string.append(arrResult.joined(separator: " ") + "\n") tfdPETextEditor.string.append(arrResult.joined(separator: " ") + "\n")
isSaved = false
clearAllFields() clearAllFields()
} }
} }