|
@@ -2389,7 +2389,7 @@ extension KMMainViewController {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let tabController = sender.object as? CTTabController
|
|
let tabController = sender.object as? CTTabController
|
|
- if tabController?.title == self.document?.documentURL.lastPathComponent {
|
|
|
|
|
|
+ if tabController?.title == self.document?.documentURL.deletingPathExtension().lastPathComponent {
|
|
if let doc = self.myDocument, doc.isDocumentEdited {
|
|
if let doc = self.myDocument, doc.isDocumentEdited {
|
|
Task {
|
|
Task {
|
|
let resp = await KMAlertTool.runModel(message: NSLocalizedString("File Updated", comment: ""), buttons: [NSLocalizedString("Save", comment: ""), NSLocalizedString("Cancel", comment: "")])
|
|
let resp = await KMAlertTool.runModel(message: NSLocalizedString("File Updated", comment: ""), buttons: [NSLocalizedString("Save", comment: ""), NSLocalizedString("Cancel", comment: "")])
|
|
@@ -2410,8 +2410,8 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- func pdfSaveAlertView(_ sender: NSNotification) {
|
|
|
|
- if AutoSaveManager.manager.isSaving{
|
|
|
|
|
|
+ func savePdfAlertView() {
|
|
|
|
+ if AutoSaveManager.manager.isSaving || AutoSaveManager.manager.isSaveNoti{
|
|
return
|
|
return
|
|
}
|
|
}
|
|
AutoSaveManager.manager.isSaveNoti = true
|
|
AutoSaveManager.manager.isSaveNoti = true
|
|
@@ -2428,7 +2428,7 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- func pdfSaveFinishAlertView(_ sender: NSNotification) {
|
|
|
|
|
|
+ func savePdfFinishAlertView() {
|
|
if !AutoSaveManager.manager.isSaveNoti{
|
|
if !AutoSaveManager.manager.isSaveNoti{
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -2482,10 +2482,11 @@ extension KMMainViewController {
|
|
func showInFinder(_ sender: Any) -> Void {
|
|
func showInFinder(_ sender: Any) -> Void {
|
|
if sender is NSNotification {
|
|
if sender is NSNotification {
|
|
let tabController = (sender as! NSNotification).object as? CTTabController
|
|
let tabController = (sender as! NSNotification).object as? CTTabController
|
|
- if tabController?.title == self.document?.documentURL.lastPathComponent {
|
|
|
|
- let file: URL = (self.myDocument?.fileURL)!
|
|
|
|
- if FileManager.default.fileExists(atPath: file.path) {
|
|
|
|
- NSWorkspace.shared.activateFileViewerSelecting([file])
|
|
|
|
|
|
+ if tabController?.title == self.document?.documentURL.deletingPathExtension().lastPathComponent {
|
|
|
|
+ if let file = self.myDocument?.fileURL {
|
|
|
|
+ if FileManager.default.fileExists(atPath: file.path) {
|
|
|
|
+ NSWorkspace.shared.activateFileViewerSelecting([file])
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -2930,13 +2931,13 @@ extension KMMainViewController {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- let extract = KMExtractImageWindowController(windowNibName: "KMExtractImageWindowController")
|
|
|
|
- extract.docPath = fileURL?.path ?? ""
|
|
|
|
- extract.password = document?.password ?? ""
|
|
|
|
- extract.currentPage = self.listView.currentPageIndex
|
|
|
|
|
|
+ extract = KMExtractImageWindowController(windowNibName: "KMExtractImageWindowController")
|
|
|
|
+ extract?.docPath = fileURL?.path ?? ""
|
|
|
|
+ extract?.password = document?.password ?? ""
|
|
|
|
+ extract?.currentPage = self.listView.currentPageIndex
|
|
// extract.beginSheetModal(for: NSApp.mainWindow!, completionHandler: nil)
|
|
// extract.beginSheetModal(for: NSApp.mainWindow!, completionHandler: nil)
|
|
- self.km_beginSheet(windowC: extract)
|
|
|
|
- extract.selectCurrentPageBtn()
|
|
|
|
|
|
+ self.km_beginSheet(windowC: extract!)
|
|
|
|
+ extract?.selectCurrentPageBtn()
|
|
// self.showCreateStamp()
|
|
// self.showCreateStamp()
|
|
// self.showAddSignature()
|
|
// self.showAddSignature()
|
|
}
|
|
}
|
|
@@ -2999,6 +3000,7 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
|
|
|
|
internal func showPrintWindow(pageRange: KMPrintPageRange = KMPrintPageRange(type: .allPage, selectPages: [])) {
|
|
internal func showPrintWindow(pageRange: KMPrintPageRange = KMPrintPageRange(type: .allPage, selectPages: [])) {
|
|
|
|
+ self.saveDocument()
|
|
if (self.listView.document != nil && !self.listView.document.allowsPrinting) { // 有打印限制
|
|
if (self.listView.document != nil && !self.listView.document.allowsPrinting) { // 有打印限制
|
|
KMPasswordInputWindow.openWindow(window: self.view.window!, type: .owner, url: self.listView.document.documentURL) { [weak self] result ,password in
|
|
KMPasswordInputWindow.openWindow(window: self.view.window!, type: .owner, url: self.listView.document.documentURL) { [weak self] result ,password in
|
|
if (result == .cancel) {
|
|
if (result == .cancel) {
|
|
@@ -3009,29 +3011,11 @@ extension KMMainViewController {
|
|
// 隐藏提示
|
|
// 隐藏提示
|
|
self?.hiddenSecureLimitTip()
|
|
self?.hiddenSecureLimitTip()
|
|
// 去打印
|
|
// 去打印
|
|
- if let data = self?.saveWatermarkFlag, !data {
|
|
|
|
- KMPrintWindowController.openDocument(inputDocument: self!.listView?.document, inputPageRange: pageRange)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if let _url = KMTools.saveWatermarkDocumentToTemp(document: self!.listView.document, secureOptions: self!.secureOptions, removePWD: self!.removeSecureFlag) {
|
|
|
|
- _ = CPDFDocument(url: _url)
|
|
|
|
- KMPrintWindowController.showPrintWindowControll(inputData: _url, inputDocument: self?.listView.document, inputPageRange: pageRange)
|
|
|
|
- } else {
|
|
|
|
- KMPrintWindowController.openDocument(inputDocument: self?.listView?.document, inputPageRange: pageRange)
|
|
|
|
- }
|
|
|
|
|
|
+ KMPrintWindowController.openDocument(inputDocument: self?.listView?.document, inputPageRange: pageRange)
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if (!self.saveWatermarkFlag) {
|
|
|
|
- KMPrintWindowController.openDocument(inputDocument: self.listView?.document, inputPageRange: pageRange)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if let _url = KMTools.saveWatermarkDocumentToTemp(document: self.listView.document, secureOptions: self.secureOptions, removePWD: self.removeSecureFlag) {
|
|
|
|
- let _document = CPDFDocument(url: _url)
|
|
|
|
- KMPrintWindowController.showPrintWindowControll(inputData: _url, inputDocument: self.listView.document, inputPageRange: pageRange)
|
|
|
|
- } else {
|
|
|
|
- KMPrintWindowController.openDocument(inputDocument: self.listView?.document, inputPageRange: pageRange)
|
|
|
|
- }
|
|
|
|
|
|
+ KMPrintWindowController.openDocument(inputDocument: self.listView?.document, inputPageRange: pageRange)
|
|
}
|
|
}
|
|
|
|
|
|
// MARK: - 图片注释
|
|
// MARK: - 图片注释
|
|
@@ -3553,22 +3537,6 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
#endif
|
|
#endif
|
|
self.trackEvent_aiTranslate()
|
|
self.trackEvent_aiTranslate()
|
|
self._aiTranslationPDFFileAction()
|
|
self._aiTranslationPDFFileAction()
|
|
-// Task { @MainActor in
|
|
|
|
-// if await (KMLightMemberManager.manager.canPayFunction() == false) {
|
|
|
|
-// let _ = KMSubscribeWaterMarkWindowController.show(window: self.view.window!, type: .aiTranslate) { isSub, _, isClose in
|
|
|
|
-// if (isClose) {
|
|
|
|
-// return
|
|
|
|
-// }
|
|
|
|
-// if (isSub) {
|
|
|
|
-// self._aiTranslationPDFFileAction()
|
|
|
|
-// return
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// return
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// self._aiTranslationPDFFileAction()
|
|
|
|
-// }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private func _aiTranslationPDFFileAction() {
|
|
private func _aiTranslationPDFFileAction() {
|
|
@@ -3609,29 +3577,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
}
|
|
}
|
|
|
|
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, shareDocument item: NSMenuItem) {
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, shareDocument item: NSMenuItem) {
|
|
- if (!self.saveWatermarkFlag) {
|
|
|
|
- self.shareDocument(sender: viewController)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- Task { @MainActor in
|
|
|
|
- if await (KMLightMemberManager.manager.canPayFunction() == false) {
|
|
|
|
- KMSubscribeWaterMarkWindowController.show(window: self.view.window!, isContinue: true) { isSubscribeSuccess, isWaterMarkExport, isClose in
|
|
|
|
- if (isClose) {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if (isSubscribeSuccess) {
|
|
|
|
- self.shareDocument(sender: viewController)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if (isWaterMarkExport) {
|
|
|
|
- self.shareDocument(sender: viewController, limit: true)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- self.shareDocument(sender: viewController)
|
|
|
|
- }
|
|
|
|
|
|
+ self.shareDocument(sender: viewController)
|
|
}
|
|
}
|
|
|
|
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, shareFlatten item: NSMenuItem) {
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, shareFlatten item: NSMenuItem) {
|
|
@@ -3643,29 +3589,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
}
|
|
}
|
|
|
|
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, shareOriginalPDF item: NSMenuItem) {
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, shareOriginalPDF item: NSMenuItem) {
|
|
- if (!self.saveWatermarkFlag) {
|
|
|
|
- self.shareOriginalPDF(sender: viewController)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- Task { @MainActor in
|
|
|
|
- if await (KMLightMemberManager.manager.canPayFunction() == false) {
|
|
|
|
- let _ = KMSubscribeWaterMarkWindowController.show(window: self.view.window!, isContinue: true) { isSubscribeSuccess, isWaterMarkExport, isClose in
|
|
|
|
- if (isClose) {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if (isSubscribeSuccess) {
|
|
|
|
- self.shareOriginalPDF(sender: viewController)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if (isWaterMarkExport) {
|
|
|
|
- self.shareOriginalPDF(sender: viewController, limit: true)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- self.shareOriginalPDF(sender: viewController)
|
|
|
|
- }
|
|
|
|
|
|
+ self.shareOriginalPDF(sender: viewController)
|
|
}
|
|
}
|
|
|
|
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, scanOCRModel selectedTag: Int) {
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, scanOCRModel selectedTag: Int) {
|
|
@@ -3753,27 +3677,6 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- if await (KMLightMemberManager.manager.canPayFunction() == false) {
|
|
|
|
-// self.view.window?.contentView?.superview?.beginLoading()
|
|
|
|
- let document = self.listView.document
|
|
|
|
- let secureOptions = self.secureOptions
|
|
|
|
- let removeSecureFlag = self.removeSecureFlag
|
|
|
|
-
|
|
|
|
-// DispatchQueue.global().async { [unowned self] in
|
|
|
|
- guard let _url = KMTools.saveWatermarkDocumentToTemp(document: document!, secureOptions: secureOptions, removePWD: removeSecureFlag) else {
|
|
|
|
-// DispatchQueue.main.async {
|
|
|
|
-// self.view.window?.contentView?.superview?.endLoading()
|
|
|
|
-// }
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-// DispatchQueue.main.async {
|
|
|
|
-// self.view.window?.contentView?.superview?.endLoading()
|
|
|
|
- self.showCompressWindow(url: _url)
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (self.needSaveDocument()) {
|
|
if (self.needSaveDocument()) {
|
|
self.saveDocumentWithProgressAlert { [unowned self] params in
|
|
self.saveDocumentWithProgressAlert { [unowned self] params in
|
|
self.showCompressWindow()
|
|
self.showCompressWindow()
|
|
@@ -3821,14 +3724,6 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- if await (KMLightMemberManager.manager.canPayFunction() == false) {
|
|
|
|
- guard let _url = KMTools.saveWatermarkDocumentToTemp(document: self.listView.document, secureOptions: self.secureOptions, removePWD: self.removeSecureFlag) else {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- self.showMergeWindow(url: _url, self.model.password)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (self.needSaveDocument()) {
|
|
if (self.needSaveDocument()) {
|
|
self.saveDocumentWithProgressAlert { [unowned self] params in
|
|
self.saveDocumentWithProgressAlert { [unowned self] params in
|
|
self.showMergeWindow(self.listView.document.password)
|
|
self.showMergeWindow(self.listView.document.password)
|