UserDef // +filterNonCNSReadingsForCHTInput.

This commit is contained in:
ShikiSuen 2024-02-16 03:04:12 +08:00
parent 58815d7c54
commit 0e4651e70e
10 changed files with 60 additions and 24 deletions

View File

@ -178,6 +178,7 @@ public class LMMgr {
config.isSymbolEnabled = PrefMgr.shared.symbolInputEnabled
config.isSCPCEnabled = PrefMgr.shared.useSCPCTypingMode
config.isCassetteEnabled = PrefMgr.shared.cassetteEnabled
config.filterNonCNSReadings = PrefMgr.shared.filterNonCNSReadingsForCHTInput
config.deltaOfCalendarYears = PrefMgr.shared.deltaOfCalendarYears
}
}

View File

@ -239,6 +239,9 @@ import SwiftExtension
@AppProperty(key: UserDef.kInlineDumpPinyinInLieuOfZhuyin.rawValue, defaultValue: false)
public dynamic var inlineDumpPinyinInLieuOfZhuyin: Bool
@AppProperty(key: UserDef.kFilterNonCNSReadingsForCHTInput.rawValue, defaultValue: false)
public dynamic var filterNonCNSReadingsForCHTInput: Bool
@AppProperty(key: UserDef.kCNS11643Enabled.rawValue, defaultValue: false)
public dynamic var cns11643Enabled: Bool {
didSet {

View File

@ -44,27 +44,41 @@ public extension SettingsPanesCocoa {
"Due to security concerns, we don't consider implementing anything related to shell script execution here. An input method doing this without implementing App Sandbox will definitely have system-wide vulnerabilities, considering that its related UserDefaults are easily tamperable to execute malicious shell scripts. vChewing is designed to be invulnerable from this kind of attack. Also, official releases of vChewing are Sandboxed.".makeNSLabel(descriptive: true, fixWidth: contentWidth)
}
}?.boxed()
NSTabView.build {
NSTabView.TabPage(title: "") {
NSStackView.buildSection(width: innerContentWidth) {
UserDef.kFetchSuggestionsFromUserOverrideModel.render(fixWidth: innerContentWidth)
UserDef.kFilterNonCNSReadingsForCHTInput.render(fixWidth: innerContentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrSyncLMPrefs(_:))
}
UserDef.kCNS11643Enabled.render(fixWidth: innerContentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrSyncLMPrefs(_:))
}
UserDef.kSymbolInputEnabled.render(fixWidth: innerContentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrSyncLMPrefs(_:))
}
}?.boxed()
NSView()
}
NSTabView.TabPage(title: "") {
NSStackView.buildSection(width: innerContentWidth) {
UserDef.kUseExternalFactoryDict.render(fixWidth: innerContentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrConnectCoreDB(_:))
}
UserDef.kPhraseReplacementEnabled.render(fixWidth: innerContentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrSyncLMPrefsWithReplacementTable(_:))
}
UserDef.kAllowBoostingSingleKanjiAsUserPhrase.render(fixWidth: innerContentWidth)
}?.boxed()
NSView()
}
}?.makeSimpleConstraint(.width, relation: .equal, value: tabContainerWidth)
NSStackView.buildSection(width: contentWidth) {
UserDef.kUseExternalFactoryDict.render(fixWidth: contentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrConnectCoreDB(_:))
}
UserDef.kFetchSuggestionsFromUserOverrideModel.render(fixWidth: contentWidth)
UserDef.kCNS11643Enabled.render(fixWidth: contentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrSyncLMPrefs(_:))
}
UserDef.kSymbolInputEnabled.render(fixWidth: contentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrSyncLMPrefs(_:))
}
UserDef.kPhraseReplacementEnabled.render(fixWidth: contentWidth) { renderable in
renderable.currentControl?.target = self
renderable.currentControl?.action = #selector(self.lmmgrSyncLMPrefsWithReplacementTable(_:))
}
}?.boxed()
NSStackView.buildSection(width: contentWidth) {
UserDef.kAllowBoostingSingleKanjiAsUserPhrase.render(fixWidth: contentWidth)
NSStackView.build(.horizontal) {
"i18n:settings.importFromKimoTxt.label".makeNSLabel(fixWidth: contentWidth)
NSView()

View File

@ -41,6 +41,9 @@ public struct VwrSettingsPaneDictionary: View {
@AppStorage(wrappedValue: false, UserDef.kAllowBoostingSingleKanjiAsUserPhrase.rawValue)
private var allowBoostingSingleKanjiAsUserPhrase: Bool
@AppStorage(wrappedValue: false, UserDef.kFilterNonCNSReadingsForCHTInput.rawValue)
private var filterNonCNSReadingsForCHTInput: Bool
// MARK: - Main View
@State var keykeyImportButtonDisabled = false
@ -164,6 +167,11 @@ public struct VwrSettingsPaneDictionary: View {
LMMgr.connectCoreDB()
}
).render()
UserDef.kFilterNonCNSReadingsForCHTInput.bind(
$filterNonCNSReadingsForCHTInput.didChange {
LMMgr.connectCoreDB()
}
).render()
UserDef.kCNS11643Enabled.bind(
$cns11643Enabled.didChange {
LMMgr.syncLMPrefs()

View File

@ -69,6 +69,7 @@ public protocol PrefMgrProtocol {
var shareAlphanumericalModeStatusAcrossClients: Bool { get set }
var phraseEditorAutoReloadExternalModifications: Bool { get set }
var classicHaninKeyboardSymbolModeShortcutEnabled: Bool { get set }
var filterNonCNSReadingsForCHTInput: Bool { get set }
var cns11643Enabled: Bool { get set }
var cassetteEnabled: Bool { get set }
var symbolInputEnabled: Bool { get set }

View File

@ -102,6 +102,7 @@ public enum UserDef: String, CaseIterable, Identifiable {
case kShareAlphanumericalModeStatusAcrossClients = "ShareAlphanumericalModeStatusAcrossClients"
case kPhraseEditorAutoReloadExternalModifications = "PhraseEditorAutoReloadExternalModifications"
case kClassicHaninKeyboardSymbolModeShortcutEnabled = "ClassicHaninKeyboardSymbolModeShortcutEnabled"
case kFilterNonCNSReadingsForCHTInput = "FilterNonCNSReadingsForCHTInput"
case kUseSpaceToCommitHighlightedSCPCCandidate = "UseSpaceToCommitHighlightedSCPCCandidate"
case kEnableMouseScrollingForTDKCandidatesCocoa = "EnableMouseScrollingForTDKCandidatesCocoa"
@ -225,6 +226,7 @@ public extension UserDef {
case .kShareAlphanumericalModeStatusAcrossClients: return .bool
case .kPhraseEditorAutoReloadExternalModifications: return .bool
case .kClassicHaninKeyboardSymbolModeShortcutEnabled: return .bool
case .kFilterNonCNSReadingsForCHTInput: return .bool
case .kUseSpaceToCommitHighlightedSCPCCandidate: return .bool
case .kEnableMouseScrollingForTDKCandidatesCocoa: return .bool
case .kDisableSegmentedThickUnderlineInMarkingModeForManagedClients: return .bool
@ -545,6 +547,9 @@ public extension UserDef {
case .kClassicHaninKeyboardSymbolModeShortcutEnabled: return .init(
userDef: self, shortTitle: "Also use “\\” or “¥” key for Hanin Keyboard Symbol Input"
)
case .kFilterNonCNSReadingsForCHTInput: return .init(
userDef: self, shortTitle: "i18n:UserDef.kFilterNonCNSReadingsForCHTInput.shortTitle"
)
case .kUseSpaceToCommitHighlightedSCPCCandidate: return .init(
userDef: self, shortTitle: "Use Space to confirm highlighted candidate in Per-Char Select Mode"
)

View File

@ -201,9 +201,9 @@
"i18n:securityAgentHelper.warningMessage.footer" = "When this message shows up, vChewing has already attempted to call DisableSecureEventInput() trying to make itself selectable in the input method menu again. Your suggested further steps:\n\n0. Keep a screenshot of this dialog (if you don't have one) for further purposes.\n\n1. If vChewing is still not selectable in the input method menu, you are suggested to manually terminate the processes listed above to force-release their SecureEventInput states. This will make vChewing available immediately.\n\n2. If the process belongs to an app from Mac App Store, please report its abuse of SecureEventInput to Apple. Apple may take actions to such apps if necessary, including pulling them off from the Mac App Store until the problem gets solved by the developers of such apps.\n\n3. Whether this process is from Mac App Store or not, you report this abuse to the related app vendor / developer. You may give them the screenshot of this alert message since it should have enough information to help the vendor / developer troubleshoot the issue.";
"i18n:securityAgentHelper.warningMessage.header" = "vChewing has detected that the following background processes are abusing the SecureEventInput, hindering all 3rd-party input methods from being able to switch to.\n\nIt is fine to use SecureEventInput for sensitive input fields. However, an app calling EnableSecureEventInput() is responsible to call DisableSecureEventInput() immediately right after the input field loses focus. This situation may also happen if an app is hanging in the background (or working as a helper application in the background) with its SecureEventInput left enabled.\n\nThe found processes are:";
"i18n:securityAgentHelper.warningMessage.title" = "SecureEventInput Abuse Detected";
"i18n:settings.importFromKimoTxt.label" = "Import Yahoo! KeyKey User Dictionary file";
"i18n:settings.importFromKimoTxt.DirectlyImport" = "Directly Import";
"i18n:settings.importFromKimoTxt.finishedCount:%@" = "Imported %@ new records.";
"i18n:settings.importFromKimoTxt.label" = "Import Yahoo! KeyKey User Dictionary file";
"i18n:settings.shiftKeyASCIITogle.description" = "This feature only needs to parse consecutive NSEvents passed by macOS built-in InputMethodKit framework, hence no necessity of asking end-users for extra privileges of monitoring global keyboard inputs. You are free to investigate our codebase or reverse-engineer this input method to see whether the above statement is trustable. Also, this Shift-key toggle won't work if CapsLock is ON.";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.description" = "This won't affect the same feature offered by macOS since 10.14 Mojave and later.";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.shortTitle" = "Bypass the vChewing built-in Caps Lock handling";
@ -211,6 +211,7 @@
"i18n:UserDef.kCheckAbusersOfSecureEventInputAPI.shortTitle" = "Actively check those processes abusing the SecureEventInput API";
"i18n:UserDef.kCNS11643Enabled.shortTitle" = "Enable CNS11643 Support (2024-01-23)";
"i18n:UserDef.kDodgeInvalidEdgeCandidateCursorPosition.shortTitle" = "Dodge Invalid Edge Candidate Cursor Position";
"i18n:UserDef.kFilterNonCNSReadingsForCHTInput.shortTitle" = "Filter Non-CNS11643 factory readings (CHT input only)";
"i18n:UserDef.kNumPadCharInputBehavior.description" = "Choose the behavior of numeric pad inputs.";
"i18n:UserDef.kNumPadCharInputBehavior.option.0" = "Always directly commit half-width chars";
"i18n:UserDef.kNumPadCharInputBehavior.option.1" = "Always directly commit full-width chars";

View File

@ -201,9 +201,9 @@
"i18n:securityAgentHelper.warningMessage.footer" = "このメッセージが出た時に、威注音がすでに「DisableSecureEventInput()」を実行してみました。これで入力ソースメニューで威注音は利用できる状態になったかもしれませんが、下記のステップはおすすめです:\n\nイ今のこのメッセージの画面のスクリーンショットを撮って置いてください。後ほど使えます。\n\nロもし、今でも入力ソースメニューで威注音は利用できぬ状態でしたら、上記のプロセスを強制中止してください。そうすれば、それぞれのSecureEventInput状態は解消できて、入力ソースメニューで威注音はすぐ利用できることになります。\n\nハもし、該当プロセスは Mac App Store のアプリからのものでしたら、該当アプリを Apple 社にご通報ください。状況と必要性次第、該当アプリは Mac App Store からしばらく取り下がて、支障解決まで Mac App Store 提供中止になるかもしれません。\n\nニ該当プロセスは Mac App Store からダウンロードしたものか否か、それぞれの開発元にこの支障をご通報ください。今のこのメッセージの画面のスクリーンショットを該当開発元に送れば、必要なる情報は該当開発元に全部お知らせすることができます。";
"i18n:securityAgentHelper.warningMessage.header" = "威注音入力アプリ略称「威注音」は「他のバックグラウンド・プロセスがSecureEventInputを正しく利用していない」と検出しました。このような不正利用は「システム内蔵入力以外の全ての入力アプリがメニューで灰色状態で選べなくて使えない」の元凶です。\n\nセンシティブな資料の記入どころでSecureEventInputをEnableSecureEventInput()で使うのは当然ですが、「入力中」状態が終わった後必ずDisableSecureEventInput()で状態解消すべきだと義務です。いくつかヘルパーアプリも、あるいはSecureEventInputを呼び起こしてからすぐ固まったアプリも、この状態になりやすいです。特に、他のアプリの画面へ切り替えたとしても、固まったアプリのSecureEventInput状態は自動的に解消できません。\n\n検出した該当プロセスは:";
"i18n:securityAgentHelper.warningMessage.title" = "SecureEventInput の不正利用が検出";
"i18n:settings.importFromKimoTxt.label" = "Yahoo! KeyKey ユーザー辞書ファイルを読込";
"i18n:settings.importFromKimoTxt.DirectlyImport" = "直接読込";
"i18n:settings.importFromKimoTxt.finishedCount:%@" = "新しい記録は %@ つ読み込みました。";
"i18n:settings.importFromKimoTxt.label" = "Yahoo! KeyKey ユーザー辞書ファイルを読込";
"i18n:settings.shiftKeyASCIITogle.description" = "この機能の利用する NSEvent は、macOS 内蔵の入力アプリ共用モジュール「InputMethodKit」から提供した NSEvent のみであり、その NSEvent 文脈関係で「Shift キーは1回押したかどうか」と判断することはできる。この事実に疑いを持つ者は、本アプリのソースコードを審査するか、あるいは本アプリを逆向工程(分解工学, いわゆる「Reverse-Engineering」するがよい。なお、Shiftキーによるこの切り替えは、CapsLockがONの時には効かぬ。";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.description" = "macOS 10.14 からのシステム内蔵機能としての同じ機能に影響しません。";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.shortTitle" = "威注音入力アプリの内蔵CapsLock処理を不使用";
@ -211,6 +211,7 @@
"i18n:UserDef.kCheckAbusersOfSecureEventInputAPI.shortTitle" = "SecureEventInput API を不正利用しているバクグラウンド・プロセスを自動検知";
"i18n:UserDef.kCNS11643Enabled.shortTitle" = "全字庫モード // 入力可能な漢字数を倍増す (2024-01-23)";
"i18n:UserDef.kDodgeInvalidEdgeCandidateCursorPosition.shortTitle" = "端末での不合理的な候補選択用カーソル位置を是正";
"i18n:UserDef.kFilterNonCNSReadingsForCHTInput.shortTitle" = "全字庫以外の音読みを内蔵辞書繁体中国語検索結果から除く";
"i18n:UserDef.kNumPadCharInputBehavior.description" = "テンキー文字の入力行為をご指定ください。";
"i18n:UserDef.kNumPadCharInputBehavior.option.0" = "いつでも半角で直接出力";
"i18n:UserDef.kNumPadCharInputBehavior.option.1" = "いつでも全角で直接出力";

View File

@ -201,9 +201,9 @@
"i18n:securityAgentHelper.warningMessage.footer" = "当这则讯息呈现出来的时候,威注音已经尝试呼叫 `DisableSecureEventInput()` 来试图解除这个状态。以下是威注音建议您采取的行动:\n\n0. 将这则讯息视窗留一份屏幕撷图、以备接下来的需要。\n\n1. 如果输入法选单内的威注音仍旧处于无法选取的状态(下文简称「灰色不可用状态」),则请考虑结束上述进程、以迫使其释放各自的 SecureEventInput 状态。这将立刻解除威注音的灰色不可用状态。\n\n2. 如果该进程所属的 App 来自于 Mac App Store 的话,请向 Apple 检举其对 SecureEventInput 的滥用。Apple 会在必要的情况下对这类 App 采取措施,比如:临时下架,直至软件开发者解决相关故障。\n\n3. 无论该进程是否来自于 Mac App Store也都请您向相关的开发者/提供方提报该故障。您可以将这则讯息的屏幕撷图给他们看,因为里面已经包含了用以检测该故障的必要资讯。";
"i18n:securityAgentHelper.warningMessage.header" = "威注音有检测到下述后台进程有在滥用 SecureEventInput。这种滥用会导致系统内的所有第三方输入法全都无法正常使用在输入法选单内会变成灰色。\n\n针对需要填写敏感数据的场合使用 SecureEventInput 无可厚非。但是,用 EnableSecureEventInput() 开启该模式之后,就有义务在输入窗格失焦的那一刻呼叫 DisableSecureEventInput() 来结束这种状态。这种状态还常见于后台辅助 App 当中、或者某个 App 在叫出该模式之后失去响应这样的话哪怕被切换到后台SecureEventInput 也不会自动解除)。\n\n被侦测到的进程如下:";
"i18n:securityAgentHelper.warningMessage.title" = "检测到对 SecureEventInput 的滥用行为";
"i18n:settings.importFromKimoTxt.label" = "汇入奇摩输入法自订词资料库";
"i18n:settings.importFromKimoTxt.DirectlyImport" = "直接汇入";
"i18n:settings.importFromKimoTxt.finishedCount:%@" = "汇入了 %@ 笔新记录。";
"i18n:settings.importFromKimoTxt.label" = "汇入奇摩输入法自订词资料库";
"i18n:settings.shiftKeyASCIITogle.description" = "该功能只需要对借由 macOS 内建的输入法框架传来的 NSEvent 做上下文分析,自然没有「向使用者寻求系统全局键盘事件监听权限」之必要。您可自行审视敝输入法的原始程式码仓库、或对敝输入法逆向工程,以自行证实此处所言之真假。另注:这个 Shift 键切换开关在 CapsLock 灯亮时无效。";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.description" = "这不会影响到自 macOS 10.14 开始的系统内建的同名功能。";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.shortTitle" = "不使用威注音输入法内建的 Caps Lock 处理";
@ -211,6 +211,7 @@
"i18n:UserDef.kCheckAbusersOfSecureEventInputAPI.shortTitle" = "主动检测正在滥用 SecureEventInput API 的后台进程";
"i18n:UserDef.kCNS11643Enabled.shortTitle" = "启用 CNS11643 全字库支援 (2024-01-23)";
"i18n:UserDef.kDodgeInvalidEdgeCandidateCursorPosition.shortTitle" = "糾正不合理的端点选字游标位置";
"i18n:UserDef.kFilterNonCNSReadingsForCHTInput.shortTitle" = "仅繁体中文: 原厂辞典仅返回符合全字库读音的结果";
"i18n:UserDef.kNumPadCharInputBehavior.description" = "指定数字小键盘的输入行为。";
"i18n:UserDef.kNumPadCharInputBehavior.option.0" = "始终以半形文字直接递交";
"i18n:UserDef.kNumPadCharInputBehavior.option.1" = "始终以全形文字直接递交";

View File

@ -201,9 +201,9 @@
"i18n:securityAgentHelper.warningMessage.footer" = "當這則訊息呈現出來的時候,威注音已經嘗試呼叫 `DisableSecureEventInput()` 來試圖解除這個狀態。以下是威注音建議您採取的行動:\n\n0. 將這則訊息視窗留一份螢幕擷圖、以備接下來的需要。\n\n1. 如果輸入法選單內的威注音仍舊處於無法選取的狀態(下文簡稱「灰色不可用狀態」),則請考慮結束上述執行緒、以迫使其釋放各自的 SecureEventInput 狀態。這將立刻解除威注音的灰色不可用狀態。\n\n2. 如果該執行緒所屬的 App 來自於 Mac App Store 的話,請向 Apple 檢舉其對 SecureEventInput 的濫用。Apple 會在必要的情況下對這類 App 採取措施,比如:臨時下架,直至軟體研發方解決相關故障。\n\n3. 無論該執行緒是否來自於 Mac App Store也都請您向相關的研發方/提供方提報該故障。您可以將這則訊息的螢幕擷圖給他們看,因為裡面已經包含了用以偵測該故障的必要資訊。";
"i18n:securityAgentHelper.warningMessage.header" = "威注音有偵測到下述後檯執行緒有在濫用 SecureEventInput。這種濫用會導致系統內的所有第三方輸入法全都無法正常使用在輸入法選單內會變成灰色。\n\n針對需要填寫敏感資料的場合使用 SecureEventInput 無可厚非。但是,用 EnableSecureEventInput() 開啟該模式之後,就有義務在輸入窗格失焦的那一刻呼叫 DisableSecureEventInput() 來結束這種狀態。這種狀態還常見於後檯輔助 App 當中、或者某個 App 在叫出該模式之後失去回應這樣的話哪怕被切換到後檯SecureEventInput 也不會自動解除)。\n\n被偵測到的執行緒如下:";
"i18n:securityAgentHelper.warningMessage.title" = "偵測到對 SecureEventInput 的濫用行為";
"i18n:settings.importFromKimoTxt.label" = "匯入奇摩輸入法自訂詞資料庫";
"i18n:settings.importFromKimoTxt.DirectlyImport" = "直接匯入";
"i18n:settings.importFromKimoTxt.finishedCount:%@" = "匯入了 %@ 筆新記錄。";
"i18n:settings.importFromKimoTxt.label" = "匯入奇摩輸入法自訂詞資料庫";
"i18n:settings.shiftKeyASCIITogle.description" = "該功能只需要對藉由 macOS 內建的輸入法框架傳來的 NSEvent 做上下文分析,自然沒有「向使用者尋求系統全局鍵盤事件監聽權限」之必要。您可自行審視敝輸入法的原始程式碼倉庫、或對敝輸入法逆向工程,以自行證實此處所言之真假。另註:這個 Shift 鍵切換開關在 CapsLock 燈亮時無效。";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.description" = "這不會影響到自 macOS 10.14 開始的系統內建的同名功能。";
"i18n:UserDef.kBypassNonAppleCapsLockHandling.shortTitle" = "不使用威注音輸入法內建的 Caps Lock 處理";
@ -211,6 +211,7 @@
"i18n:UserDef.kCheckAbusersOfSecureEventInputAPI.shortTitle" = "主動偵測正在濫用 SecureEventInput API 的後檯執行緒";
"i18n:UserDef.kCNS11643Enabled.shortTitle" = "啟用 CNS11643 全字庫支援 (2024-01-23)";
"i18n:UserDef.kDodgeInvalidEdgeCandidateCursorPosition.shortTitle" = "糾正不合理的端點選字游標位置";
"i18n:UserDef.kFilterNonCNSReadingsForCHTInput.shortTitle" = "僅繁體中文: 原廠辭典僅返回符合全字庫讀音的結果";
"i18n:UserDef.kNumPadCharInputBehavior.description" = "指定數字小鍵盤的輸入行為。";
"i18n:UserDef.kNumPadCharInputBehavior.option.0" = "始終以半形文字直接遞交";
"i18n:UserDef.kNumPadCharInputBehavior.option.1" = "始終以全形文字直接遞交";