Quellcode durchsuchen

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

tangchao vor 1 Jahr
Ursprung
Commit
e8c4f27a07

+ 2 - 1
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -314,11 +314,12 @@ extension KMMainViewController {
         return stypItem
     }
     func setShareStype() -> NSMenuItem {
-        let stypItem = NSMenuItem(title: NSLocalizedString("Share", comment: ""), action: #selector(showShareAction), target: self)
+        let stypItem = NSMenuItem(title: NSLocalizedString("Share", comment: ""), action: nil, target: self)
         var string = ""
         if listView.activeAnnotation != nil {
             string = listView.activeAnnotation.contents
         }
+        string = listView.currentSelection.string()
         
         stypItem.submenu = NSSharingServicePicker.menu(forSharingItems: [string], subjectContext: "", withTarget: self, selector: #selector(shareFromService), serviceDelegate: nil)
         return stypItem

+ 70 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -700,8 +700,78 @@ extension KMMainViewController {
         self.listView.autoFlow()
     }
     @objc func shareFromService(sender: NSMenuItem) {
+        if ((NSApp.mainWindow?.windowController is KMBrowserWindowController) == false) {
+            return
+        }
+        
+        var string = ""
+        if let freeTextAnnotation = listView.activeAnnotation as? CPDFFreeTextAnnotation {
+            string = freeTextAnnotation.contents ?? ""
+        } else if let markupAnnotation = listView.activeAnnotation as? CPDFMarkupAnnotation {
+            if let page = markupAnnotation.page {
+                if let selection = page.selection(for: markupAnnotation.bounds) {
+                    string = selection.string()
+                }
+            }
+        } else {
+            string = listView.currentSelection.string()
+        }
         
+        let windowControler = NSApp.mainWindow?.windowController as! KMBrowserWindowController
+        let model: CTTabStripModel = windowControler.browser.tabStripModel
+        if (model.count() <= 0) {
+            return
+        }
+        
+        if (model.activeTabContents().isHome) {
+            return
+        }
+        
+        let document: KMMainDocument = model.activeTabContents() as! KMMainDocument
+        if string.count > 0 {
+            let represent : NSSharingService = sender.representedObject as! NSSharingService
+            represent.perform(withItems: [string])
+            return
+        }
+
+        // 有使用付费功能
+        Task { @MainActor in
+            if await (KMLightMemberManager.manager.canPayFunction() == false) {
+                let _ = KMSubscribeWaterMarkWindowController.show(window: NSApp.mainWindow!, isContinue: true) { isSubscribeSuccess, isWaterMarkExport, isClose in
+                    if (isClose) {
+                        return
+                    }
+                    if (isSubscribeSuccess) {
+                        let represent : NSSharingService = sender.representedObject as! NSSharingService
+                        represent.perform(withItems: [string])
+                        return
+                    }
+                    if (isWaterMarkExport) {
+                        let doucumentURL = document.fileURL
+                        let docDir = NSTemporaryDirectory()
+                        let documentName : String = doucumentURL!.path.lastPathComponent
+                        let path = docDir.stringByAppendingPathComponent(documentName)
+            
+                        let data = KMTools.saveWatermarkDocument(document: document.mainViewController!.document!, to: URL(fileURLWithPath: path), secureOptions: document.mainViewController!.secureOptions, removePWD: document.mainViewController!.removeSecureFlag)
+                        let writeSuccess = data != nil
+                        if writeSuccess == false {
+                            __NSBeep()
+                            return;
+                        }
+                        
+                        let represent : NSSharingService = sender.representedObject as! NSSharingService
+                        represent.perform(withItems: [string])
+                        return
+                    }
+                }
+                return
+            }
+            
+            let represent : NSSharingService = sender.representedObject as! NSSharingService
+            represent.perform(withItems: [string])
+        }
     }
+    
     @objc func cutAction(sender: NSMenuItem) {
         
     }

+ 4 - 4
PDF Office/PDF Master/de.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "Sicherheit entfernen";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "Setzen Sie Passwörter";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "Sicherheit entfernen";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "Setzen Sie Passwörter";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/es.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "Eliminar la seguridad";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "Establecer contraseñas";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "Eliminar la seguridad";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "Establecer contraseñas";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/fr.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "Supprimer la sécurité";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "Définir les mots de passe";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "Supprimer la sécurité";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "Définir les mots de passe";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/it.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "Rimuovere la sicurezza";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "Imposta password";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "Rimuovere la sicurezza";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "Imposta password";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/ja.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "セキュリティを削除します";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "パスワードを設定します";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "セキュリティを削除します";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "パスワードを設定します";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/nl.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "Verwijder de beveiliging";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" ="Stel wachtwoorden in";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "Verwijder de beveiliging";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "Stel wachtwoorden in";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/pl.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "Usuń bezpieczeństwo";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "Ustaw hasła";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "Usuń bezpieczeństwo";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "Ustaw hasła";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/ru.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "Удалить безопасность";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "Установите пароли";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "Удалить безопасность";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "Установите пароли";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/zh-Hans.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "刪除安全性設置";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "设置密码";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "刪除安全性設置";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "设置密码";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";

+ 4 - 4
PDF Office/PDF Master/zh-Hant.lproj/Main.strings

@@ -567,10 +567,10 @@
 "UcJ-8B-aGi.title" = "Rotate";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "UeP-EN-pne"; */
-"UeP-EN-pne.title" = "Remove Security";
+"UeP-EN-pne.title" = "刪除安全性設置";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "Uex-cP-1GN"; */
-"Uex-cP-1GN.title" = "Set Passwords";
+"Uex-cP-1GN.title" = "设置密码";
 
 /* Class = "NSMenuItem"; title = "Pages to Print"; ObjectID = "Uju-2w-bbx"; */
 "Uju-2w-bbx.title" = "Pages to Print";
@@ -861,7 +861,7 @@
 "ijD-Zw-e5Q.title" = "Two Pages Continuous";
 
 /* Class = "NSMenuItem"; title = "Remove Security"; ObjectID = "j8D-NQ-1Vs"; */
-"j8D-NQ-1Vs.title" = "Remove Security";
+"j8D-NQ-1Vs.title" = "刪除安全性設置";
 
 /* Class = "NSMenuItem"; title = "Free PDF Template"; ObjectID = "jDd-TK-oX8"; */
 "jDd-TK-oX8.title" = "Free PDF Template";
@@ -930,7 +930,7 @@
 "o8C-LV-ujc.title" = "Themes4";
 
 /* Class = "NSMenuItem"; title = "Set Passwords"; ObjectID = "oCr-hU-X60"; */
-"oCr-hU-X60.title" = "Set Passwords";
+"oCr-hU-X60.title" = "设置密码";
 
 /* Class = "NSMenuItem"; title = "Mail Disk Image…"; ObjectID = "oFD-Tc-WY3"; */
 "oFD-Tc-WY3.title" = "Mail Disk Image…";