|
@@ -3182,48 +3182,49 @@ struct KMNMWCFlags {
|
|
|
|
|
|
//MARK: - 转档
|
|
|
func showConvertWindow(_ convertType: KMPDFConvertType) {
|
|
|
-
|
|
|
+
|
|
|
+ var winC: KMConvertBaseWindowController = KMConvertBaseWindowController()
|
|
|
if convertType == .word {
|
|
|
- let winC = KMConvertWordWindowController()
|
|
|
+ winC = KMConvertWordWindowController()
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: self.view.window, completionHandler: nil)
|
|
|
} else if convertType == .ppt {
|
|
|
- let winC = KMConvertPPTsWindowController()
|
|
|
+ winC = KMConvertPPTsWindowController()
|
|
|
winC.subType = 1
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: self.view.window, completionHandler: nil)
|
|
|
} else if convertType == .rtf {
|
|
|
- let winC = KMConvertPPTsWindowController()
|
|
|
+ winC = KMConvertPPTsWindowController()
|
|
|
winC.subType = 2
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: self.view.window, completionHandler: nil)
|
|
|
} else if convertType == .text {
|
|
|
- let winC = KMConvertPPTsWindowController()
|
|
|
+ winC = KMConvertPPTsWindowController()
|
|
|
winC.subType = 4
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: self.view.window, completionHandler: nil)
|
|
|
} else if convertType == .csv {
|
|
|
- let winC = KMConvertPPTsWindowController()
|
|
|
+ winC = KMConvertPPTsWindowController()
|
|
|
winC.subType = 5
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: self.view.window, completionHandler: nil)
|
|
|
} else if convertType == .excel {
|
|
|
- let winC = KMConvertExcelWindowController()
|
|
|
+ winC = KMConvertExcelWindowController()
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: self.view.window, completionHandler: nil)
|
|
|
} else if convertType == .html {
|
|
|
- let winC = KMConvertHtmlWindowController()
|
|
|
+ winC = KMConvertHtmlWindowController()
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: self.view.window, completionHandler: nil)
|
|
|
} else if convertType == .json {
|
|
|
- let winC = KMConvertJsonWindowController()
|
|
|
+ winC = KMConvertJsonWindowController()
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: view.window, completionHandler: nil)
|
|
@@ -3235,7 +3236,7 @@ struct KMNMWCFlags {
|
|
|
convertType == .tga ||
|
|
|
convertType == .bmp ||
|
|
|
convertType == .jp2{
|
|
|
- let winC = KMConvertImageWindowController()
|
|
|
+ winC = KMConvertImageWindowController()
|
|
|
let model = KMDocumentModel(url: listView.document.documentURL)
|
|
|
winC.documentModel = model
|
|
|
winC.own_beginSheetModal(for: view.window, completionHandler: nil)
|
|
@@ -3243,6 +3244,10 @@ struct KMNMWCFlags {
|
|
|
settingView.selectConvertType(convertType: convertType)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ winC.batchAction = { [unowned self] in
|
|
|
+ self.showBatchWindow(type: .convertPDF, subType: convertType.rawValue, files: [listView.document.documentURL])
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//MARK: - 选择Form注释
|
|
@@ -3618,9 +3623,13 @@ extension KMMainViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//Batch
|
|
|
+//MARK: Batch
|
|
|
extension KMMainViewController {
|
|
|
func showBatchWindow(type: KMBatchCollectionViewType, files: [URL]?) {
|
|
|
+ self.showBatchWindow(type: type, subType: 0, files: files)
|
|
|
+ }
|
|
|
+
|
|
|
+ func showBatchWindow(type: KMBatchCollectionViewType, subType: Int = 0, files: [URL]?) {
|
|
|
let batchWindowController = KMBatchWindowController.init(windowNibName: "KMBatchWindowController")
|
|
|
batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
|
|
@@ -3631,16 +3640,7 @@ extension KMMainViewController {
|
|
|
// }
|
|
|
batchWindowController.inputData = files ?? []
|
|
|
batchWindowController.type = type
|
|
|
-
|
|
|
-// let batchWindowController = KMBatchOperateWindowController.sharedWindowController
|
|
|
-//
|
|
|
-// var array: [KMBatchOperateFile] = []
|
|
|
-// for fpath in filepaths ?? [] {
|
|
|
-// let batchOperateFile = KMBatchOperateFile(filePath: fpath, type: type)
|
|
|
-// array.append(batchOperateFile)
|
|
|
-// }
|
|
|
-// batchWindowController.switchToOperateType(type, files: array)
|
|
|
-// batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
+ batchWindowController.inputSubType = subType
|
|
|
}
|
|
|
}
|
|
|
|