|
@@ -2642,33 +2642,30 @@ extension KMMainViewController {
|
|
|
// MARK: 显示窗口
|
|
|
|
|
|
internal func showCompressWindow(url: URL? = nil) {
|
|
|
- if let wc = self.currentWindowController as? KMCompressWindowController, let _ = wc.window?.isSheet {
|
|
|
+ if let wc = self.compressWIndowControllerNew, let _ = wc.window?.isSheet {
|
|
|
KMPrint("压缩窗口已显示")
|
|
|
return
|
|
|
}
|
|
|
- let windowController = KMCompressWIndowControllerNew(windowNibName: "KMCompressWIndowControllerNew")
|
|
|
- self.view.window?.beginSheet(windowController.window!)
|
|
|
- self.currentWindowController = windowController
|
|
|
- windowController.password = self.listView?.document?.password ?? ""
|
|
|
+ self.compressWIndowControllerNew = KMCompressWIndowControllerNew(windowNibName: "KMCompressWIndowControllerNew")
|
|
|
+ self.view.window?.beginSheet(self.compressWIndowControllerNew!.window!)
|
|
|
+ self.compressWIndowControllerNew?.password = self.listView?.document?.password ?? ""
|
|
|
// if let _url = url {
|
|
|
// windowController.oriDocumentUrl = self.listView.document.documentURL
|
|
|
// windowController.documentURL = _url
|
|
|
// } else {
|
|
|
- windowController.documentURL = self.listView.document.documentURL
|
|
|
+ self.compressWIndowControllerNew?.documentURL = self.listView.document.documentURL
|
|
|
// }
|
|
|
|
|
|
- windowController.itemClick = { [weak self] in
|
|
|
- self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
- self?.currentWindowController = nil
|
|
|
+ self.compressWIndowControllerNew?.itemClick = { [unowned self] in
|
|
|
+ self.view.window?.endSheet((self.compressWIndowControllerNew?.window)!)
|
|
|
|
|
|
- self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
+ self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
}
|
|
|
|
|
|
- windowController.batchAction = { [weak self] view, filePaths in
|
|
|
- self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
- self?.currentWindowController = nil
|
|
|
+ self.compressWIndowControllerNew?.batchAction = { [unowned self] view, filePaths in
|
|
|
+ self.view.window?.endSheet((self.compressWIndowControllerNew?.window)!)
|
|
|
|
|
|
- self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
+ self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
|
|
let batchWindowController = KMBatchOperateWindowController.sharedWindowController
|
|
|
// batchWindowController.window?.makeKeyAndOrderFront("")
|
|
@@ -2677,12 +2674,11 @@ extension KMMainViewController {
|
|
|
batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
}
|
|
|
|
|
|
- windowController.resultCallback = { [weak self] result, openDocument, fileURL, error in
|
|
|
+ self.compressWIndowControllerNew?.resultCallback = { [unowned self] result, openDocument, fileURL, error in
|
|
|
if (result) {
|
|
|
- self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
- self?.currentWindowController = nil
|
|
|
+ self.view.window?.endSheet((self.compressWIndowControllerNew?.window)!)
|
|
|
|
|
|
- self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
+ self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
|
|
if (openDocument) {
|
|
|
NSDocumentController.shared.openDocument(withContentsOf: fileURL, display: true) { document, result, error in }
|