Browse Source

【2025】【压缩】批量入口接入

lizhe 3 tháng trước cách đây
mục cha
commit
8b37a1fc8b

+ 8 - 9
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -1933,13 +1933,7 @@ extension KMMainViewController {
         }
         
         self.compressWindowController?.batchAction = { [unowned self] view, filePaths in
-            self.view.window?.endSheet((self.compressWindowController?.window)!)
-            
- 
-            let batchWindowController = KMBatchOperateWindowController.sharedWindowController
-            let batchOperateFile = KMBatchOperateFile(filePath: filePaths.first!.path, type: .Compress)
-            batchWindowController.switchToOperateType(KMBatchOperationType.Compress, files: [batchOperateFile])
-            batchWindowController.window?.makeKeyAndOrderFront("")
+            self.showBatchCompressController(filePaths)
         }
         
         self.compressWindowController?.resultCallback = { [unowned self] result, openDocument, fileURL, error in
@@ -1959,8 +1953,13 @@ extension KMMainViewController {
         }
     }
     
-    func showBatchCompressController() {
+    func showBatchCompressController(_ filePaths: [URL]) {
+        self.view.window?.endSheet((self.compressWindowController?.window)!)
         
+        let batchWindowController = KMBatchOperateWindowController.sharedWindowController
+        let batchOperateFile = KMBatchOperateFile(filePath: filePaths.first!.path, type: .Compress)
+        batchWindowController.switchToOperateType(KMBatchOperationType.Compress, files: [batchOperateFile])
+        batchWindowController.window?.makeKeyAndOrderFront("")
     }
 }
 
@@ -2297,7 +2296,7 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
             if itemIdentifier == KMPDFToolbar_tools_compress_Identifier {
                 self.showCompressController(self.listView.document.documentURL)
             } else if itemIdentifier == KMPDFToolbar_tools_batch_compress_Identifier {
-                self.showBatchCompressController()
+                self.showBatchCompressController([self.listView.document.documentURL])
             }
         } else if itemIdentifier == KMPDFToolbar_ViewDisplay_Identifier {
             //MARK: -Display