SessionCtl_Menu // Hide some items if serving `com.apple.SecurityAgent`.
This commit is contained in:
parent
f1cfe67c97
commit
5a1826c3bd
|
@ -26,6 +26,7 @@ extension SessionCtl {
|
||||||
|
|
||||||
override public func menu() -> NSMenu! {
|
override public func menu() -> NSMenu! {
|
||||||
let menu = NSMenu(title: "Input Method Menu")
|
let menu = NSMenu(title: "Input Method Menu")
|
||||||
|
var silentMode: Bool { clientBundleIdentifier == "com.apple.SecurityAgent" }
|
||||||
|
|
||||||
let switchInputModeItem = menu.addItem(
|
let switchInputModeItem = menu.addItem(
|
||||||
withTitle: String(
|
withTitle: String(
|
||||||
|
@ -115,39 +116,41 @@ extension SessionCtl {
|
||||||
|
|
||||||
menu.addItem(NSMenuItem.separator()) // ---------------------
|
menu.addItem(NSMenuItem.separator()) // ---------------------
|
||||||
|
|
||||||
menu.addItem(
|
if !silentMode {
|
||||||
withTitle: "Open User Dictionary Folder".localized,
|
menu.addItem(
|
||||||
action: #selector(openUserDataFolder(_:)), keyEquivalent: ""
|
withTitle: "Open User Dictionary Folder".localized,
|
||||||
)
|
action: #selector(openUserDataFolder(_:)), keyEquivalent: ""
|
||||||
menu.addItem(
|
)
|
||||||
withTitle: "Edit vChewing User Phrases…".localized,
|
menu.addItem(
|
||||||
action: #selector(openUserPhrases(_:)), keyEquivalent: ""
|
withTitle: "Edit vChewing User Phrases…".localized,
|
||||||
)
|
action: #selector(openUserPhrases(_:)), keyEquivalent: ""
|
||||||
menu.addItem(
|
)
|
||||||
withTitle: "Edit Excluded Phrases…".localized,
|
menu.addItem(
|
||||||
action: #selector(openExcludedPhrases(_:)), keyEquivalent: ""
|
withTitle: "Edit Excluded Phrases…".localized,
|
||||||
)
|
action: #selector(openExcludedPhrases(_:)), keyEquivalent: ""
|
||||||
|
)
|
||||||
|
|
||||||
if optionKeyPressed || PrefMgr.shared.associatedPhrasesEnabled {
|
if optionKeyPressed || PrefMgr.shared.associatedPhrasesEnabled {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
withTitle: "Edit Associated Phrases…".localized,
|
withTitle: "Edit Associated Phrases…".localized,
|
||||||
action: #selector(openAssociatedPhrases(_:)), keyEquivalent: ""
|
action: #selector(openAssociatedPhrases(_:)), keyEquivalent: ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if optionKeyPressed {
|
if optionKeyPressed {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
withTitle: "Edit Phrase Replacement Table…".localized,
|
withTitle: "Edit Phrase Replacement Table…".localized,
|
||||||
action: #selector(openPhraseReplacement(_:)), keyEquivalent: ""
|
action: #selector(openPhraseReplacement(_:)), keyEquivalent: ""
|
||||||
)
|
)
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
withTitle: "Edit User Symbol & Emoji Data…".localized,
|
withTitle: "Edit User Symbol & Emoji Data…".localized,
|
||||||
action: #selector(openUserSymbols(_:)), keyEquivalent: ""
|
action: #selector(openUserSymbols(_:)), keyEquivalent: ""
|
||||||
)
|
)
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
withTitle: "Open App Support Folder".localized.withEllipsis,
|
withTitle: "Open App Support Folder".localized.withEllipsis,
|
||||||
action: #selector(openAppSupportFolderFromContainer(_:)), keyEquivalent: ""
|
action: #selector(openAppSupportFolderFromContainer(_:)), keyEquivalent: ""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if optionKeyPressed || !PrefMgr.shared.shouldAutoReloadUserDataFiles {
|
if optionKeyPressed || !PrefMgr.shared.shouldAutoReloadUserDataFiles {
|
||||||
|
@ -173,39 +176,40 @@ extension SessionCtl {
|
||||||
action: #selector(clearUOM(_:)), keyEquivalent: ""
|
action: #selector(clearUOM(_:)), keyEquivalent: ""
|
||||||
)
|
)
|
||||||
|
|
||||||
menu.addItem(NSMenuItem.separator()) // ---------------------
|
if !silentMode {
|
||||||
|
menu.addItem(NSMenuItem.separator()) // ---------------------
|
||||||
menu.addItem(
|
|
||||||
withTitle: "vChewing Preferences…".localized,
|
|
||||||
action: #selector(showPreferences(_:)), keyEquivalent: ""
|
|
||||||
)
|
|
||||||
menu.addItem(
|
|
||||||
withTitle: "Client Manager".localized.withEllipsis,
|
|
||||||
action: #selector(showClientListMgr(_:)), keyEquivalent: ""
|
|
||||||
)
|
|
||||||
if !optionKeyPressed {
|
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
withTitle: "Check for Updates…".localized,
|
withTitle: "vChewing Preferences…".localized,
|
||||||
action: #selector(checkForUpdate(_:)), keyEquivalent: ""
|
action: #selector(showPreferences(_:)), keyEquivalent: ""
|
||||||
)
|
)
|
||||||
}
|
|
||||||
menu.addItem(
|
|
||||||
withTitle: "Reboot vChewing…".localized,
|
|
||||||
action: #selector(selfTerminate(_:)), keyEquivalent: ""
|
|
||||||
)
|
|
||||||
menu.addItem(
|
|
||||||
withTitle: "About vChewing…".localized,
|
|
||||||
action: #selector(showAbout(_:)), keyEquivalent: ""
|
|
||||||
)
|
|
||||||
menu.addItem(
|
|
||||||
withTitle: "CheatSheet".localized.withEllipsis,
|
|
||||||
action: #selector(showCheatSheet(_:)), keyEquivalent: ""
|
|
||||||
)
|
|
||||||
if optionKeyPressed {
|
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
withTitle: "Uninstall vChewing…".localized,
|
withTitle: "Client Manager".localized.withEllipsis,
|
||||||
action: #selector(selfUninstall(_:)), keyEquivalent: ""
|
action: #selector(showClientListMgr(_:)), keyEquivalent: ""
|
||||||
)
|
)
|
||||||
|
if !optionKeyPressed {
|
||||||
|
menu.addItem(
|
||||||
|
withTitle: "Check for Updates…".localized,
|
||||||
|
action: #selector(checkForUpdate(_:)), keyEquivalent: ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
menu.addItem(
|
||||||
|
withTitle: "Reboot vChewing…".localized,
|
||||||
|
action: #selector(selfTerminate(_:)), keyEquivalent: ""
|
||||||
|
)
|
||||||
|
menu.addItem(
|
||||||
|
withTitle: "About vChewing…".localized,
|
||||||
|
action: #selector(showAbout(_:)), keyEquivalent: ""
|
||||||
|
)
|
||||||
|
menu.addItem(
|
||||||
|
withTitle: "CheatSheet".localized.withEllipsis,
|
||||||
|
action: #selector(showCheatSheet(_:)), keyEquivalent: ""
|
||||||
|
)
|
||||||
|
if optionKeyPressed {
|
||||||
|
menu.addItem(
|
||||||
|
withTitle: "Uninstall vChewing…".localized,
|
||||||
|
action: #selector(selfUninstall(_:)), keyEquivalent: ""
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return menu
|
return menu
|
||||||
|
|
Loading…
Reference in New Issue