|
@@ -580,35 +580,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
panel.canChooseFiles = false
|
|
|
panel.canChooseDirectories = true
|
|
|
panel.canCreateDirectories = true
|
|
|
- let button = NSButton.init(checkboxWithTitle: "保存后打开文档", target: nil, action: nil)
|
|
|
- button.state = .off
|
|
|
- panel.accessoryView = button
|
|
|
panel.beginSheetModal(for: (self?.view.window)!) { response in
|
|
|
if (response == .cancel) {
|
|
|
return
|
|
|
}
|
|
|
KMPageEditTools.split((self?.listView?.document)!, outputModel, panel.url!.path, outputModel.outputFileNameDeletePathExtension) { result, outputFilepaths, error in
|
|
|
if (result) {
|
|
|
- if (button.state == .on) {
|
|
|
- for filepath in outputFilepaths! {
|
|
|
- if !filepath.isPDFValid() {
|
|
|
- let alert = NSAlert()
|
|
|
- alert.alertStyle = .critical
|
|
|
- alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
|
|
|
- alert.runModal()
|
|
|
- } else {
|
|
|
- NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: filepath), display: true) { document, alreadyOpen, error in
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- var urls: [URL] = []
|
|
|
- for filepath in outputFilepaths! {
|
|
|
- urls.append(URL(fileURLWithPath: filepath))
|
|
|
- }
|
|
|
- NSWorkspace.shared.activateFileViewerSelecting(urls)
|
|
|
+ if let _urlString = outputFilepaths?.first?.deletingLastPathComponent {
|
|
|
+ NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: _urlString)])
|
|
|
}
|
|
|
}
|
|
|
}
|