瀏覽代碼

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

tangchao 10 月之前
父節點
當前提交
284841a5e8

+ 1 - 0
PDF Office/PDF Master/Class/AIInfo/AIUserInfoController/AIUserInfoController.swift

@@ -201,6 +201,7 @@ import Cocoa
         self.showAIRobotBtn.title = NSLocalizedString("Show AI robot icon", comment: "")
         self.showAIRobotBtn.setTitleColor(KMAppearance.KMColor_Layout_H0())
         self.showAIRobotBtn.state = AIInfoManager.default().showAIIcon ? .on : .off
+        self.showAIRobotBtn.isHidden = true
         
         if KMAppearance.isDarkMode() {
             self.creditsInfoBox.fillColor = NSColor(red: 0, green: 0, blue: 0, alpha: 0.4)

+ 14 - 18
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -87,6 +87,9 @@ import Cocoa
     //密码弹窗
     var passwordWindow: KMPasswordInputWindow?
     
+    //
+    var securityWindowController: KMSecurityWindowController?
+    
     //春季活动
     var recommondPopWindowVC: KMRecommondPopWindow?
     
@@ -766,7 +769,6 @@ import Cocoa
                 windowVC.window?.becomeMain()
             }
         }
-        windowVC.window?.center()
         if windowVC.window?.isVisible == true && windowVC.didSetOriginFrame == true {
             
         } else {
@@ -1403,25 +1405,22 @@ import Cocoa
     // MARK: - 显示加密弹窗
     
     public func showSecureWindow(_ url: URL) {
-        let controller = KMSecurityWindowController(windowNibName: "KMSecurityWindowController")
-        controller.documentURL = self.listView.document.documentURL
-        self.currentWindowController = controller
-
-        controller.batchAction = { [unowned self] controller, files in
-            self.view.window?.endSheet((self.currentWindowController.window)!)
-            self.currentWindowController = nil
+        self.securityWindowController = KMSecurityWindowController(windowNibName: "KMSecurityWindowController")
+        guard let securityWindowController = securityWindowController else { return }
+        
+        securityWindowController.documentURL = self.listView.document.documentURL
+        securityWindowController.batchAction = { [unowned self] controller, files in
+            self.view.window?.endSheet((securityWindowController.window)!)
 
             self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
 
             let batchWindowController = KMBatchOperateWindowController.sharedWindowController
-//            batchWindowController.window?.makeKeyAndOrderFront("")
             let batchOperateFile = KMBatchOperateFile(filePath: self.document?.documentURL.path ?? "", type: .AddPassword)
             batchWindowController.switchToOperateType(.AddPassword, files: [batchOperateFile])
             batchWindowController.window?.makeKeyAndOrderFront("")
         }
 
-        controller.doneAction = { [unowned self] controller, options, attribute in
-//            let windowController_secure = self.currentWindowController as! KMSecureEncryptWindowController
+        securityWindowController.doneAction = { [unowned self] controller, options, attribute in
             let openPanel = NSOpenPanel()
             openPanel.canChooseFiles = false
             openPanel.canChooseDirectories = true
@@ -1436,9 +1435,7 @@ import Cocoa
                             let path = fileURL.path.stringByAppendingPathComponent(url.deletingPathExtension().lastPathComponent) + "_SetPassword" + "." + url.pathExtension
                             let success = document!.write(to: NSURL(fileURLWithPath: path) as URL, withOptions: options)
                             if success {
-                                self.view.window?.endSheet((self.currentWindowController.window)!)
-                                self.currentWindowController = nil
-                                
+                                self.view.window?.endSheet((securityWindowController.window)!)
                                 
                                 NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
                             }
@@ -1448,11 +1445,10 @@ import Cocoa
             }
         }
 
-        controller.cancelAction = { [unowned self] controller in
-            self.view.window?.endSheet((self.currentWindowController.window)!)
-            self.currentWindowController = nil
+        securityWindowController.cancelAction = { [unowned self] controller in
+            self.view.window?.endSheet((securityWindowController.window)!)
         }
-        NSWindow.currentWindow().beginSheet(controller.window!)
+        NSWindow.currentWindow().beginSheet(securityWindowController.window!)
     }
     
     // MARK: - 保存文档