|
@@ -162,12 +162,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
}
|
|
|
|
|
|
let PDFOfficeMenu = mainMenu?.item(at: 0)?.submenu
|
|
|
- // VERSION_DMG=1
|
|
|
- // VERSION_FREE=1
|
|
|
- // VERSION_PRO=1
|
|
|
- #if VERSION_DMG
|
|
|
- PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
|
|
|
- #endif
|
|
|
+ let appTarget = KMTools_OC.getAppTarget()
|
|
|
+ if (appTarget == .DMG) {
|
|
|
+ PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
|
|
|
+ }
|
|
|
|
|
|
let fileMenu = mainMenu?.item(at: 1)?.submenu
|
|
|
let shareItem: NSMenuItem = NSMenuItem(title: NSLocalizedString("Share", comment: ""), action: nil, target: nil)
|
|
@@ -214,51 +212,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
represent.perform(withItems: [document.fileURL as Any])
|
|
|
}
|
|
|
|
|
|
- func updateAccountMenus() {
|
|
|
- let mainMenu = NSApp.mainMenu
|
|
|
- let PDFOfficeMenu: NSMenu = (mainMenu?.item(at: 0)?.submenu)!
|
|
|
-
|
|
|
- var index: Int = 4
|
|
|
-#if VERSION_DMG
|
|
|
- index = 5
|
|
|
-#endif
|
|
|
-
|
|
|
- let isLogin = false
|
|
|
- if (isLogin) {
|
|
|
- PDFOfficeMenu.insertItem(withTitle: NSLocalizedString("user@mobile.com", comment: ""), action: #selector(showAccount), target: self, at: index)
|
|
|
- let manageAcctounItem = PDFOfficeMenu.item(at: index+1)
|
|
|
- manageAcctounItem?.title = NSLocalizedString("View my account", comment: "")
|
|
|
-
|
|
|
- PDFOfficeMenu.insertItem(withTitle: NSLocalizedString("Resume purchase", comment: ""), action: #selector(resumePurchase), target: self, at: index+2)
|
|
|
- let loginItem = PDFOfficeMenu.item(at: index+3)
|
|
|
- loginItem?.title = NSLocalizedString("Logout", comment: "")
|
|
|
- } else {
|
|
|
- var hasLoginItems = false
|
|
|
- for item in PDFOfficeMenu.items {
|
|
|
- if (item.action == #selector(showAccount) ||
|
|
|
- item.action == #selector(resumePurchase)) {
|
|
|
- hasLoginItems = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (hasLoginItems) {
|
|
|
- let loginItem = PDFOfficeMenu.item(at: index+3)
|
|
|
- loginItem?.title = NSLocalizedString("Log In", comment: "")
|
|
|
- PDFOfficeMenu.removeItem(at: index+2)
|
|
|
-
|
|
|
- let manageAcctounItem = PDFOfficeMenu.item(at: index+1)
|
|
|
- manageAcctounItem?.title = NSLocalizedString("Manage my account", comment: "")
|
|
|
- PDFOfficeMenu.removeItem(at: index)
|
|
|
- } else {
|
|
|
- let manageAcctounItem = PDFOfficeMenu.item(at: index+1)
|
|
|
- manageAcctounItem?.title = NSLocalizedString("Manage my account", comment: "")
|
|
|
- let loginItem = PDFOfficeMenu.item(at: index+2)
|
|
|
- loginItem?.title = NSLocalizedString("Log In", comment: "")
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// MARK: PDF Master Menu
|
|
|
@IBAction func openPreferenceWindow(_ sender: Any) {
|
|
|
KMPreferenceWindowController.shared.showWindow(nil)
|
|
@@ -332,13 +285,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // MARK: DMG
|
|
|
- #if VERSION_DMG
|
|
|
+ // MARK:- DMG
|
|
|
@objc func checkForUpdates(_ sender: NSMenuItem) {
|
|
|
+ let appTarget = KMTools_OC.getAppTarget()
|
|
|
+ if (appTarget != .DMG) {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- #endif
|
|
|
}
|
|
|
|
|
|
extension AppDelegate : NSMenuDelegate,NSMenuItemValidation {
|