|
@@ -313,9 +313,13 @@ extension AppDelegate {
|
|
|
} else if action == NSSelectorFromString("menuItemAction_addPassword:") {
|
|
|
|
|
|
} else if action == NSSelectorFromString("menuItemAction_removePassword:") {
|
|
|
-
|
|
|
+ if mainVC.listView.document.isLocked || mainVC.listView.document.password.count > 0 {
|
|
|
+ return true
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
} else if action == NSSelectorFromString("menuItemAction_unlockFunction:") {
|
|
|
-
|
|
|
+ return mainVC.listView.document.isEncrypted
|
|
|
} else if action == NSSelectorFromString("menuItemAction_searchPDF:") {
|
|
|
|
|
|
} else if action == NSSelectorFromString("menuItemAction_performFindPanelAction:") {
|
|
@@ -549,18 +553,11 @@ extension AppDelegate {
|
|
|
guard let selector = sel else {
|
|
|
return false
|
|
|
}
|
|
|
- let selectors = [NSSelectorFromString("menuItemAction_undo:"),
|
|
|
- NSSelectorFromString("menuItemAction_redo:"),
|
|
|
- NSSelectorFromString("menuItemAction_Copy:"),
|
|
|
- NSSelectorFromString("menuItemAction_Cut:"),
|
|
|
- NSSelectorFromString("menuItemAction_Paste:"),
|
|
|
- NSSelectorFromString("menuItemAction_PasteAndMatch:"),
|
|
|
- NSSelectorFromString("menuItemAction_Delete:"),
|
|
|
- NSSelectorFromString("menuItemAction_SelectAll:"),
|
|
|
- NSSelectorFromString("menuItemAction_ShowFont:"),
|
|
|
- NSSelectorFromString("menuItemAction_FontAction:"),
|
|
|
- NSSelectorFromString("menuItemAction_CustomFont:"),
|
|
|
- NSSelectorFromString("menuItemAction_FontAlign:")]
|
|
|
+ let selectors = [ NSSelectorFromString("menuItemAction_PasteAndMatch:"),
|
|
|
+ NSSelectorFromString("menuItemAction_ShowFont:"),
|
|
|
+ NSSelectorFromString("menuItemAction_FontAction:"),
|
|
|
+ NSSelectorFromString("menuItemAction_CustomFont:"),
|
|
|
+ NSSelectorFromString("menuItemAction_FontAlign:")]
|
|
|
if selectors.contains(selector) {
|
|
|
return true
|
|
|
}
|
|
@@ -570,21 +567,7 @@ extension AppDelegate {
|
|
|
func validateEditMenuItem(_ menuItem: NSMenuItem) -> Bool {
|
|
|
let action = menuItem.action
|
|
|
if let mainVC = self.mainViewController() {
|
|
|
- if action == NSSelectorFromString("menuItemAction_undo:") {
|
|
|
-
|
|
|
- } else if action == NSSelectorFromString("menuItemAction_redo:") {
|
|
|
-
|
|
|
- } else if action == NSSelectorFromString("menuItemAction_Copy:") {
|
|
|
-
|
|
|
- } else if action == NSSelectorFromString("menuItemAction_Cut:") {
|
|
|
-
|
|
|
- } else if action == NSSelectorFromString("menuItemAction_Paste:") {
|
|
|
-
|
|
|
- } else if action == NSSelectorFromString("menuItemAction_PasteAndMatch:") {
|
|
|
-
|
|
|
- } else if action == NSSelectorFromString("menuItemAction_Delete:") {
|
|
|
-
|
|
|
- } else if action == NSSelectorFromString("menuItemAction_SelectAll:") {
|
|
|
+ if action == NSSelectorFromString("menuItemAction_PasteAndMatch:") {
|
|
|
|
|
|
} else if action == NSSelectorFromString("menuItemAction_ShowFont:") {
|
|
|
|
|
@@ -601,38 +584,12 @@ extension AppDelegate {
|
|
|
}
|
|
|
|
|
|
//MARK: -IBAction
|
|
|
- @IBAction func menuItemAction_undo(_ sender: NSMenuItem) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @IBAction func menuItemAction_redo(_ sender: NSMenuItem) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @IBAction func menuItemAction_Copy(_ sender: NSMenuItem) {
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
- @IBAction func menuItemAction_Cut(_ sender: NSMenuItem) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @IBAction func menuItemAction_Paste(_ sender: NSMenuItem) {
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
@IBAction func menuItemAction_PasteAndMatch(_ sender: NSMenuItem) {
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- @IBAction func menuItemAction_Delete(_ sender: NSMenuItem) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @IBAction func menuItemAction_SelectAll(_ sender: NSMenuItem) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
@IBAction func menuItemAction_ShowFont(_ sender: NSMenuItem) {
|
|
|
NSFontManager.shared.orderFrontFontPanel(nil)
|
|
|
}
|