|
@@ -139,6 +139,8 @@ struct KMNMWCFlags {
|
|
|
|
|
|
var removeAllAnnotationsStore = KMPDFViewRemoveAllAnnotationsStore()
|
|
|
|
|
|
+ var componentMessageView: ComponentMessage = ComponentMessage()
|
|
|
+
|
|
|
private var _needSave = false
|
|
|
var needSave: Bool {
|
|
|
set {
|
|
@@ -729,10 +731,14 @@ struct KMNMWCFlags {
|
|
|
//密文
|
|
|
listView.annotationType = .redact
|
|
|
listView.toolMode = .CRedactToolMode
|
|
|
+
|
|
|
+ self.enterRedactAlert()
|
|
|
} else if subToolMode == .Digital_Sign {
|
|
|
//数字签名
|
|
|
listView.annotationType = .digitalSign
|
|
|
listView.toolMode = .CDigitalSignToolMode
|
|
|
+
|
|
|
+ self.enterDigitalSignature()
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1125,14 +1131,13 @@ struct KMNMWCFlags {
|
|
|
|
|
|
view.window?.makeFirstResponder(listView)
|
|
|
|
|
|
- let readModeMessage: ComponentMessage = ComponentMessage()
|
|
|
- readModeMessage.properties = ComponentMessageProperty(messageType: .normal_custom, title: KMLocalizedString("Read Mode On"))
|
|
|
- readModeMessage.frame = CGRectMake((CGRectGetWidth(self.view.frame) - readModeMessage.properties.propertyInfo.viewWidth)/2,
|
|
|
- CGRectGetHeight(self.view.frame) - readModeMessage.properties.propertyInfo.viewHeight - 8,
|
|
|
- readModeMessage.properties.propertyInfo.viewWidth,
|
|
|
- readModeMessage.properties.propertyInfo.viewHeight)
|
|
|
- readModeMessage.reloadData()
|
|
|
- readModeMessage.show(inView: self.view, autoHideSeconde: 2)
|
|
|
+ self.componentMessageView.properties = ComponentMessageProperty(messageType: .normal_custom, title: KMLocalizedString("Read Mode On"))
|
|
|
+ self.componentMessageView.frame = CGRectMake((CGRectGetWidth(self.view.frame) - self.componentMessageView.properties.propertyInfo.viewWidth)/2,
|
|
|
+ CGRectGetHeight(self.view.frame) - self.componentMessageView.properties.propertyInfo.viewHeight - 8,
|
|
|
+ self.componentMessageView.properties.propertyInfo.viewWidth,
|
|
|
+ self.componentMessageView.properties.propertyInfo.viewHeight)
|
|
|
+ self.componentMessageView.reloadData()
|
|
|
+ self.componentMessageView.show(inView: self.view, autoHideSeconde: 2)
|
|
|
|
|
|
setUpPDFPageNumberToolbar()
|
|
|
|
|
@@ -1164,14 +1169,13 @@ struct KMNMWCFlags {
|
|
|
reloadPDFPageNumberToolbar()
|
|
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
|
|
|
- let readModeMessage: ComponentMessage = ComponentMessage()
|
|
|
- readModeMessage.properties = ComponentMessageProperty(messageType: .normal_custom, title: KMLocalizedString("Read Mode Off"))
|
|
|
- readModeMessage.frame = CGRectMake((CGRectGetWidth(self.infoSplitCenterView.frame) - readModeMessage.properties.propertyInfo.viewWidth)/2,
|
|
|
- CGRectGetHeight(self.infoSplitCenterView.frame) - readModeMessage.properties.propertyInfo.viewHeight - 8,
|
|
|
- readModeMessage.properties.propertyInfo.viewWidth,
|
|
|
- readModeMessage.properties.propertyInfo.viewHeight)
|
|
|
- readModeMessage.reloadData()
|
|
|
- readModeMessage.show(inView: self.infoSplitCenterView, autoHideSeconde: 2)
|
|
|
+ self.componentMessageView.properties = ComponentMessageProperty(messageType: .normal_custom, title: KMLocalizedString("Read Mode Off"))
|
|
|
+ self.componentMessageView.frame = CGRectMake((CGRectGetWidth(self.infoSplitCenterView.frame) - self.componentMessageView.properties.propertyInfo.viewWidth)/2,
|
|
|
+ CGRectGetHeight(self.infoSplitCenterView.frame) - self.componentMessageView.properties.propertyInfo.viewHeight - 8,
|
|
|
+ self.componentMessageView.properties.propertyInfo.viewWidth,
|
|
|
+ self.componentMessageView.properties.propertyInfo.viewHeight)
|
|
|
+ self.componentMessageView.reloadData()
|
|
|
+ self.componentMessageView.show(inView: self.infoSplitCenterView, autoHideSeconde: 2)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1533,6 +1537,24 @@ struct KMNMWCFlags {
|
|
|
signaturestateVC.reloadData()
|
|
|
}
|
|
|
|
|
|
+ func enterDigitalSignature() {
|
|
|
+ if UserDefaults.standard.object(forKey: "kDigitalSignature") != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .informational
|
|
|
+ alert.messageText = KMLocalizedString("Using your mouse, click and drag to draw the area where you would like the signature to appear. Once you finish dragging out the desired area, you will be taken to the next step of the signing process. ")
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("OK"))
|
|
|
+ alert.showsSuppressionButton = true
|
|
|
+ let response = alert.runModal()
|
|
|
+ if response.rawValue == 1000 {
|
|
|
+ if alert.suppressionButton?.state == .on {
|
|
|
+ UserDefaults.standard.set("YES", forKey: "kDigitalSignature")
|
|
|
+ UserDefaults.standard.synchronize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// MARK: - 显示合并窗口
|
|
|
public func showMergeWindow(url: URL? = nil, _ password: String?) {
|
|
@@ -3490,6 +3512,8 @@ extension KMMainViewController {
|
|
|
self.showCompress(model: model)
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ self.showCompress(model: model)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3598,16 +3622,21 @@ extension KMMainViewController {
|
|
|
|
|
|
//OCR
|
|
|
func convertOCRScanFile(window: KMOCRSettingWindowController, document: CPDFDocument, model: KMOCRModel) {
|
|
|
- window.beginLoading()
|
|
|
+// window.beginLoading()
|
|
|
|
|
|
+ KMCompressManager.shared.showLoadingWindow(window: window.window)
|
|
|
+ KMCompressManager.shared.cancelAction = {
|
|
|
+ KMOCRManager.manager.cancelRecognition()
|
|
|
+ }
|
|
|
//当前页面需要提前设置
|
|
|
if model.pageRangeType == .current {
|
|
|
model.pageRange = [self.listView.currentPageIndex]
|
|
|
}
|
|
|
|
|
|
KMOCRManager.manager.convertScanFile(document: document, model: model, progress: { progress in
|
|
|
-
|
|
|
+ KMCompressManager.shared.updateLoadingProgress(value: progress)
|
|
|
}) { [weak self] document, text, error in
|
|
|
+ KMCompressManager.shared.dismissLoadiingWindow(window: window.window)
|
|
|
window.endLoading()
|
|
|
window.km_quick_endSheet()
|
|
|
if !model.saveAsPDF {
|
|
@@ -3946,6 +3975,8 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
|
|
|
viewManager.showRightSide = false
|
|
|
} else if SettingsManager.sharedInstance.autoExpandPropertyPanel == true {
|
|
|
viewManager.showRightSide = true
|
|
|
+ } else if viewManager.subToolMode == .Stamp || viewManager.subToolMode == .Sign {
|
|
|
+ viewManager.showRightSide = true
|
|
|
}
|
|
|
self.refreshToolbarRightViewInfo()
|
|
|
|
|
@@ -7340,6 +7371,30 @@ extension KMMainViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func enterRedactAlert() {
|
|
|
+ if UserDefaults.standard.object(forKey: "kRedact") != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .informational
|
|
|
+ alert.informativeText = KMLocalizedString("Redaction allows you to permanently mask and remove sensitive content.")
|
|
|
+ alert.messageText = KMLocalizedString("""
|
|
|
+ Redaction requires two steps:
|
|
|
+ 1. Mark for Redaction
|
|
|
+ 2. Apply Redactions
|
|
|
+
|
|
|
+ Note: Redactions are not applied permanently until you select Apply Redactions.
|
|
|
+ """)
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("OK"))
|
|
|
+ alert.showsSuppressionButton = true
|
|
|
+ let response = alert.runModal()
|
|
|
+ if response.rawValue == 1000 {
|
|
|
+ if alert.suppressionButton?.state == .on {
|
|
|
+ UserDefaults.standard.set("YES", forKey: "kRedact")
|
|
|
+ UserDefaults.standard.synchronize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// MARK: - 保存文档
|
|
|
internal func needSaveDocument() -> Bool {
|