|
@@ -2025,59 +2025,59 @@ extension KMMainViewController {
|
|
// MARK: 显示窗口
|
|
// MARK: 显示窗口
|
|
|
|
|
|
internal func showCompressWindow(url: URL? = nil) {
|
|
internal func showCompressWindow(url: URL? = nil) {
|
|
- if let wc = self.currentWindowController as? KMCompressWindowController, let _ = wc.window?.isSheet {
|
|
|
|
- KMPrint("压缩窗口已显示")
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- let windowController = KMCompressWIndowControllerNew(windowNibName: "KMCompressWIndowControllerNew")
|
|
|
|
- self.view.window?.beginSheet(windowController.window!)
|
|
|
|
- self.currentWindowController = windowController
|
|
|
|
-// if let _url = url {
|
|
|
|
-// windowController.oriDocumentUrl = self.listView.document.documentURL
|
|
|
|
-// windowController.documentURL = _url
|
|
|
|
-// } else {
|
|
|
|
- windowController.documentURL = self.listView.document.documentURL
|
|
|
|
|
|
+// if let wc = self.currentWindowController as? KMCompressWindowController, let _ = wc.window?.isSheet {
|
|
|
|
+// KMPrint("压缩窗口已显示")
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+// let windowController = KMCompressWIndowControllerNew(windowNibName: "KMCompressWIndowControllerNew")
|
|
|
|
+// self.view.window?.beginSheet(windowController.window!)
|
|
|
|
+// self.currentWindowController = windowController
|
|
|
|
+//// if let _url = url {
|
|
|
|
+//// windowController.oriDocumentUrl = self.listView.document.documentURL
|
|
|
|
+//// windowController.documentURL = _url
|
|
|
|
+//// } else {
|
|
|
|
+// windowController.documentURL = self.listView.document.documentURL
|
|
|
|
+//// }
|
|
|
|
+// windowController.password = self.listView.document.password
|
|
|
|
+//
|
|
|
|
+// windowController.itemClick = { [weak self] in
|
|
|
|
+// self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
|
+// self?.currentWindowController = nil
|
|
|
|
+//
|
|
|
|
+// self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// windowController.batchAction = { [weak self] view, filePaths in
|
|
|
|
+// self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
|
+// self?.currentWindowController = nil
|
|
|
|
+//
|
|
|
|
+// self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
+//
|
|
|
|
+// let batchWindowController = KMBatchOperateWindowController.sharedWindowController
|
|
|
|
+// batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
|
+// let batchOperateFile = KMBatchOperateFile(filePath: filePaths.first!.path)
|
|
|
|
+// batchWindowController.switchToOperateType(KMBatchOperationType.Compress, files: [batchOperateFile])
|
|
|
|
+// batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// windowController.resultCallback = { [weak self] result, openDocument, fileURL, error in
|
|
|
|
+// if (result) {
|
|
|
|
+// self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
|
+// self?.currentWindowController = nil
|
|
|
|
+//
|
|
|
|
+// self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
+//
|
|
|
|
+// if (openDocument) {
|
|
|
|
+// NSDocumentController.shared.openDocument(withContentsOf: fileURL, display: true) { document, result, error in }
|
|
|
|
+// } else {
|
|
|
|
+// NSWorkspace.shared.activateFileViewerSelecting([fileURL])
|
|
|
|
+// }
|
|
|
|
+// } else {
|
|
|
|
+// let alert = NSAlert()
|
|
|
|
+// alert.messageText = NSLocalizedString("Compress Faild", comment: "")
|
|
|
|
+// alert.runModal()
|
|
|
|
+// }
|
|
// }
|
|
// }
|
|
- windowController.password = self.listView.document.password
|
|
|
|
-
|
|
|
|
- windowController.itemClick = { [weak self] in
|
|
|
|
- self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
|
- self?.currentWindowController = nil
|
|
|
|
-
|
|
|
|
- self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- windowController.batchAction = { [weak self] view, filePaths in
|
|
|
|
- self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
|
- self?.currentWindowController = nil
|
|
|
|
-
|
|
|
|
- self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
-
|
|
|
|
- let batchWindowController = KMBatchOperateWindowController.sharedWindowController
|
|
|
|
- batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
|
- let batchOperateFile = KMBatchOperateFile(filePath: filePaths.first!.path)
|
|
|
|
- batchWindowController.switchToOperateType(KMBatchOperationType.Compress, files: [batchOperateFile])
|
|
|
|
- batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- windowController.resultCallback = { [weak self] result, openDocument, fileURL, error in
|
|
|
|
- if (result) {
|
|
|
|
- self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
|
- self?.currentWindowController = nil
|
|
|
|
-
|
|
|
|
- self?.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
|
|
|
|
-
|
|
|
|
- if (openDocument) {
|
|
|
|
- NSDocumentController.shared.openDocument(withContentsOf: fileURL, display: true) { document, result, error in }
|
|
|
|
- } else {
|
|
|
|
- NSWorkspace.shared.activateFileViewerSelecting([fileURL])
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- let alert = NSAlert()
|
|
|
|
- alert.messageText = NSLocalizedString("Compress Faild", comment: "")
|
|
|
|
- alert.runModal()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
internal func showConvertWindow(type: KMToolbarType, documentUrl: URL? = nil, identifier: String?) {
|
|
internal func showConvertWindow(type: KMToolbarType, documentUrl: URL? = nil, identifier: String?) {
|
|
@@ -2085,37 +2085,37 @@ extension KMMainViewController {
|
|
KMPrint("转档窗口已显示")
|
|
KMPrint("转档窗口已显示")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- var convertT: KMConvertType = .Word
|
|
|
|
- var windowController: KMConvertBaseWindowController?
|
|
|
|
- if (type == .word) { /// Word
|
|
|
|
- convertT = .Word
|
|
|
|
- } else if (type == .excel) {
|
|
|
|
- convertT = .Excel
|
|
|
|
- } else if (type == .ppt || type == .rtf || type == .html || type == .conversion_text) {
|
|
|
|
- if (type == .ppt) {
|
|
|
|
- convertT = .PPT
|
|
|
|
- } else if (type == .rtf) {
|
|
|
|
- convertT = .RTF
|
|
|
|
- } else if (type == .html) {
|
|
|
|
- convertT = .HTML
|
|
|
|
- } else if (type == .conversion_text) {
|
|
|
|
- convertT = .Text
|
|
|
|
- }
|
|
|
|
- } else if (type == .csv) {
|
|
|
|
- convertT = .CSV
|
|
|
|
- } else if (type == .conversion_image) {
|
|
|
|
- windowController = KMConvertImageWindowController()
|
|
|
|
- }
|
|
|
|
- windowController?.subscribeWaterMarkType = type.toSubscribeWaterMarkType()
|
|
|
|
-
|
|
|
|
- var url: URL?
|
|
|
|
- if (documentUrl != nil) {
|
|
|
|
- url = documentUrl
|
|
|
|
- windowController?.oriDocumentUrl = self.listView.document.documentURL
|
|
|
|
- } else {
|
|
|
|
- url = self.listView.document.documentURL
|
|
|
|
- }
|
|
|
|
- self.showAllConvertWindow(convertT: convertT)
|
|
|
|
|
|
+// var convertT: KMConvertType = .Word
|
|
|
|
+// var windowController: KMConvertBaseWindowController?
|
|
|
|
+// if (type == .word) { /// Word
|
|
|
|
+// convertT = .Word
|
|
|
|
+// } else if (type == .excel) {
|
|
|
|
+// convertT = .Excel
|
|
|
|
+// } else if (type == .ppt || type == .rtf || type == .html || type == .conversion_text) {
|
|
|
|
+// if (type == .ppt) {
|
|
|
|
+// convertT = .PPT
|
|
|
|
+// } else if (type == .rtf) {
|
|
|
|
+// convertT = .RTF
|
|
|
|
+// } else if (type == .html) {
|
|
|
|
+// convertT = .HTML
|
|
|
|
+// } else if (type == .conversion_text) {
|
|
|
|
+// convertT = .Text
|
|
|
|
+// }
|
|
|
|
+// } else if (type == .csv) {
|
|
|
|
+// convertT = .CSV
|
|
|
|
+// } else if (type == .conversion_image) {
|
|
|
|
+// windowController = KMConvertImageWindowController()
|
|
|
|
+// }
|
|
|
|
+// windowController?.subscribeWaterMarkType = type.toSubscribeWaterMarkType()
|
|
|
|
+//
|
|
|
|
+// var url: URL?
|
|
|
|
+// if (documentUrl != nil) {
|
|
|
|
+// url = documentUrl
|
|
|
|
+// windowController?.oriDocumentUrl = self.listView.document.documentURL
|
|
|
|
+// } else {
|
|
|
|
+// url = self.listView.document.documentURL
|
|
|
|
+// }
|
|
|
|
+// self.showAllConvertWindow(convertT: convertT)
|
|
|
|
|
|
// let model = KMDocumentModel(url: url!)
|
|
// let model = KMDocumentModel(url: url!)
|
|
// if (self.listView.document.password != nil) {
|
|
// if (self.listView.document.password != nil) {
|