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,
|
||||
text: $candidateKeys.onChange {
|
||||
let value = candidateKeys
|
||||
let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicated
|
||||
let keys = value.trimmingCharacters(in: .whitespacesAndNewlines).lowercased().deduplicated
|
||||
// Start Error Handling.
|
||||
if let errorResult = CandidateKey.validate(keys: keys) {
|
||||
if let window = CtlPrefUIShared.sharedWindow, !keys.isEmpty {
|
||||
IMEApp.buzz()
|
||||
let alert = NSAlert(error: NSLocalizedString("Invalid Selection Keys.", comment: ""))
|
||||
alert.informativeText = errorResult
|
||||
alert.beginSheetModal(for: window)
|
||||
alert.beginSheetModal(for: window) { _ in
|
||||
candidateKeys = PrefMgr.kDefaultCandidateKeys
|
||||
}
|
||||
}
|
||||
candidateKeys = PrefMgr.kDefaultCandidateKeys
|
||||
}
|
||||
}
|
||||
).frame(width: 180).disabled(useIMKCandidateWindow)
|
||||
|
|
|
@ -296,19 +296,13 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
|
|||
IMEApp.buzz()
|
||||
}
|
||||
|
||||
@IBAction func changeSelectionKeyAction(_ sender: Any) {
|
||||
guard
|
||||
let keys = (sender as AnyObject).stringValue?.trimmingCharacters(
|
||||
in: .whitespacesAndNewlines
|
||||
)
|
||||
.deduplicated
|
||||
else {
|
||||
selectionKeyComboBox.stringValue = PrefMgr.shared.candidateKeys
|
||||
return
|
||||
}
|
||||
@IBAction func changeSelectionKeyAction(_: Any) {
|
||||
let keys = selectionKeyComboBox.stringValue.trimmingCharacters(
|
||||
in: .whitespacesAndNewlines
|
||||
).lowercased().deduplicated
|
||||
// Start Error Handling.
|
||||
guard let errorResult = CandidateKey.validate(keys: keys) else {
|
||||
PrefMgr.shared.candidateKeys = keys
|
||||
selectionKeyComboBox.stringValue = PrefMgr.shared.candidateKeys
|
||||
return
|
||||
}
|
||||
if let window = window {
|
||||
|
|
|
@ -674,6 +674,7 @@
|
|||
</comboBoxCell>
|
||||
<connections>
|
||||
<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">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">NSNegateBoolean</string>
|
||||
|
@ -1862,7 +1863,7 @@ DQ
|
|||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="70" id="g7o-3C-NrU"/>
|
||||
</constraints>
|
||||
<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>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3eW-vq-tFr">
|
||||
|
|
Loading…
Reference in New Issue