Browse Source

【综合】AI功能完善,合并功能优化

niehaoyu 6 months ago
parent
commit
0687baca1e

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift

@@ -252,7 +252,6 @@ extension KMMergeWindowController {
         //                self.savePanelAccessoryViewController = savePanelAccessoryViewController;
         //                self.savePanelAccessoryViewController = savePanelAccessoryViewController;
                         savePanel.beginSheetModal(for: self.window!) { result in
                         savePanel.beginSheetModal(for: self.window!) { result in
                             if result == .OK {
                             if result == .OK {
-                                self.cancelAction?()
                                 var outputSavePanel = savePanel.url?.path ?? ""
                                 var outputSavePanel = savePanel.url?.path ?? ""
                                 DispatchQueue.main.async {
                                 DispatchQueue.main.async {
                                     var success = false
                                     var success = false
@@ -278,6 +277,7 @@ extension KMMergeWindowController {
                                         alert.messageText = "\(String(describing: files.first?.filePath.lastPathComponent)) + \(NSLocalizedString("Failed to merge!", comment: ""))"
                                         alert.messageText = "\(String(describing: files.first?.filePath.lastPathComponent)) + \(NSLocalizedString("Failed to merge!", comment: ""))"
                                         alert.runModal()
                                         alert.runModal()
                                     }
                                     }
+                                    self.cancelAction?()
                                 }
                                 }
                             }
                             }
                         }
                         }
@@ -294,7 +294,6 @@ extension KMMergeWindowController {
     //                self.savePanelAccessoryViewController = savePanelAccessoryViewController;
     //                self.savePanelAccessoryViewController = savePanelAccessoryViewController;
                     savePanel.beginSheetModal(for: self.window!) { result in
                     savePanel.beginSheetModal(for: self.window!) { result in
                         if result == .OK {
                         if result == .OK {
-                            self.cancelAction?()
                             var outputSavePanel = savePanel.url?.path
                             var outputSavePanel = savePanel.url?.path
                             DispatchQueue.main.async {
                             DispatchQueue.main.async {
                                 var success = self.oldPDFDocument.write(toFile: outputSavePanel!)
                                 var success = self.oldPDFDocument.write(toFile: outputSavePanel!)
@@ -316,6 +315,7 @@ extension KMMergeWindowController {
                                     alert.messageText = "\(String(describing: files.first?.filePath.lastPathComponent)) + \(NSLocalizedString("Failed to merge!", comment: ""))"
                                     alert.messageText = "\(String(describing: files.first?.filePath.lastPathComponent)) + \(NSLocalizedString("Failed to merge!", comment: ""))"
                                     alert.runModal()
                                     alert.runModal()
                                 }
                                 }
+                                self.cancelAction?()
                             }
                             }
                         }
                         }
                     }
                     }

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

@@ -4698,6 +4698,8 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 FMTrackEventManager.defaultManager.trackEvent(event: "Tbr", withProperties: ["Tbr_Btn": "Btn_Tbr_DigitalSignature"])
                 FMTrackEventManager.defaultManager.trackEvent(event: "Tbr", withProperties: ["Tbr_Btn": "Btn_Tbr_DigitalSignature"])
             }
             }
             self.enterDigitalSign()
             self.enterDigitalSign()
+        } else if itemId == KMDocumentAIToolsToolbarItemIdentifier {
+            self.showAITypeChooseView(aiConfigType: .none)
         }
         }
     }
     }
     
     

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

@@ -1363,10 +1363,12 @@ import Cocoa
             
             
             self.mergeWindowController!.cancelAction = { [unowned self] controller in
             self.mergeWindowController!.cancelAction = { [unowned self] controller in
                 self.view.window?.endSheet(mergeWindowController!.window!)
                 self.view.window?.endSheet(mergeWindowController!.window!)
+                self.mergeWindowController = nil
             }
             }
             
             
             self.mergeWindowController!.mergeAction = { [unowned self] controller, filePath in
             self.mergeWindowController!.mergeAction = { [unowned self] controller, filePath in
                 self.view.window?.endSheet(mergeWindowController!.window!)
                 self.view.window?.endSheet(mergeWindowController!.window!)
+                self.mergeWindowController = nil;
             }
             }
             self.toolbarController.cancelSelected(KMToolbarToolMergeItemIdentifier)
             self.toolbarController.cancelSelected(KMToolbarToolMergeItemIdentifier)