|
@@ -305,8 +305,48 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|
}
|
|
}
|
|
|
|
|
|
let document: KMMainDocument = model.activeTabContents() as! KMMainDocument
|
|
let document: KMMainDocument = model.activeTabContents() as! KMMainDocument
|
|
- let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
|
- represent.perform(withItems: [document.fileURL as Any])
|
|
|
|
|
|
+ if let data = document.mainViewController?.saveWatermarkFlag, !data {
|
|
|
|
+ let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
|
+ represent.perform(withItems: [document.fileURL as Any])
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 有使用付费功能
|
|
|
|
+ Task { @MainActor in
|
|
|
|
+ if await (KMLightMemberManager.manager.canPayFunction() == false) {
|
|
|
|
+ let _ = KMSubscribeWaterMarkWindowController.show(window: NSApp.mainWindow!) { isSubscribeSuccess, isWaterMarkExport, isClose in
|
|
|
|
+ if (isClose) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (isSubscribeSuccess) {
|
|
|
|
+ let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
|
+ represent.perform(withItems: [document.fileURL as Any])
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (isWaterMarkExport) {
|
|
|
|
+ let doucumentURL = document.fileURL
|
|
|
|
+ let docDir = NSTemporaryDirectory()
|
|
|
|
+ let documentName : String = doucumentURL!.path.lastPathComponent
|
|
|
|
+ let path = docDir.stringByAppendingPathComponent(documentName)
|
|
|
|
+
|
|
|
|
+ let data = KMTools.saveWatermarkDocument(document: document.mainViewController!.document!, to: URL(fileURLWithPath: path), secureOptions: document.mainViewController!.secureOptions, removePWD: document.mainViewController!.removeSecureFlag)
|
|
|
|
+ let writeSuccess = data != nil
|
|
|
|
+ if writeSuccess == false {
|
|
|
|
+ __NSBeep()
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
|
+ represent.perform(withItems: [data as Any])
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
|
+ represent.perform(withItems: [document.fileURL as Any])
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// MARK: PDF Master Menu
|
|
// MARK: PDF Master Menu
|