PrefWindow & PrefUI // Maintenance fix.
This commit is contained in:
parent
f38db788a5
commit
2a5f02601c
|
@ -221,16 +221,17 @@ private struct VwrPrefPaneCandidates_SelectionKeys: View {
|
||||||
items: CandidateKey.suggestions,
|
items: CandidateKey.suggestions,
|
||||||
text: $candidateKeys.onChange {
|
text: $candidateKeys.onChange {
|
||||||
let value = candidateKeys
|
let value = candidateKeys
|
||||||
let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicated
|
let keys = value.trimmingCharacters(in: .whitespacesAndNewlines).lowercased().deduplicated
|
||||||
// Start Error Handling.
|
// Start Error Handling.
|
||||||
if let errorResult = CandidateKey.validate(keys: keys) {
|
if let errorResult = CandidateKey.validate(keys: keys) {
|
||||||
if let window = CtlPrefUIShared.sharedWindow, !keys.isEmpty {
|
if let window = CtlPrefUIShared.sharedWindow, !keys.isEmpty {
|
||||||
IMEApp.buzz()
|
IMEApp.buzz()
|
||||||
let alert = NSAlert(error: NSLocalizedString("Invalid Selection Keys.", comment: ""))
|
let alert = NSAlert(error: NSLocalizedString("Invalid Selection Keys.", comment: ""))
|
||||||
alert.informativeText = errorResult
|
alert.informativeText = errorResult
|
||||||
alert.beginSheetModal(for: window)
|
alert.beginSheetModal(for: window) { _ in
|
||||||
|
candidateKeys = PrefMgr.kDefaultCandidateKeys
|
||||||
|
}
|
||||||
}
|
}
|
||||||
candidateKeys = PrefMgr.kDefaultCandidateKeys
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).frame(width: 180).disabled(useIMKCandidateWindow)
|
).frame(width: 180).disabled(useIMKCandidateWindow)
|
||||||
|
|
|
@ -296,19 +296,13 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
|
||||||
IMEApp.buzz()
|
IMEApp.buzz()
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func changeSelectionKeyAction(_ sender: Any) {
|
@IBAction func changeSelectionKeyAction(_: Any) {
|
||||||
guard
|
let keys = selectionKeyComboBox.stringValue.trimmingCharacters(
|
||||||
let keys = (sender as AnyObject).stringValue?.trimmingCharacters(
|
in: .whitespacesAndNewlines
|
||||||
in: .whitespacesAndNewlines
|
).lowercased().deduplicated
|
||||||
)
|
// Start Error Handling.
|
||||||
.deduplicated
|
|
||||||
else {
|
|
||||||
selectionKeyComboBox.stringValue = PrefMgr.shared.candidateKeys
|
|
||||||
return
|
|
||||||
}
|
|
||||||
guard let errorResult = CandidateKey.validate(keys: keys) else {
|
guard let errorResult = CandidateKey.validate(keys: keys) else {
|
||||||
PrefMgr.shared.candidateKeys = keys
|
PrefMgr.shared.candidateKeys = keys
|
||||||
selectionKeyComboBox.stringValue = PrefMgr.shared.candidateKeys
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let window = window {
|
if let window = window {
|
||||||
|
|
|
@ -674,6 +674,7 @@
|
||||||
</comboBoxCell>
|
</comboBoxCell>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="changeSelectionKeyAction:" target="-2" id="REj-7y-bbQ"/>
|
<action selector="changeSelectionKeyAction:" target="-2" id="REj-7y-bbQ"/>
|
||||||
|
<binding destination="32" name="value" keyPath="values.CandidateKeys" id="5Fv-A4-QY5"/>
|
||||||
<binding destination="32" name="enabled" keyPath="values.UseIMKCandidateWindow" id="BDQ-gl-txA">
|
<binding destination="32" name="enabled" keyPath="values.UseIMKCandidateWindow" id="BDQ-gl-txA">
|
||||||
<dictionary key="options">
|
<dictionary key="options">
|
||||||
<string key="NSValueTransformerName">NSNegateBoolean</string>
|
<string key="NSValueTransformerName">NSNegateBoolean</string>
|
||||||
|
@ -1862,7 +1863,7 @@ DQ
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="70" id="g7o-3C-NrU"/>
|
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="70" id="g7o-3C-NrU"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<connections>
|
<connections>
|
||||||
<binding destination="32" name="value" keyPath="values.AutoCombineLongestPossibleCassetteKey" id="VUF-y7-K67"/>
|
<binding destination="32" name="value" keyPath="values.AutoCompositeWithLongestPossibleCassetteKey" id="OSk-i5-Mdr"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3eW-vq-tFr">
|
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3eW-vq-tFr">
|
||||||
|
|
Loading…
Reference in New Issue