|
@@ -1286,14 +1286,17 @@ extension KMPDFToolbarController: KMRedactToolbarControllerDelegate {
|
|
|
delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, KMPDFToolbar_protect_redact_Property_Identifier)
|
|
|
|
|
|
} else if buttonIndex == 2 {
|
|
|
- viewManager?.subToolMode = .None
|
|
|
- cancelSelectedSecondToolbarItems(.Protect)
|
|
|
- delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, KMPDFToolbar_protect_redact_Apply_Identifier)
|
|
|
+ self.applyRedactAlert()
|
|
|
+
|
|
|
+// viewManager?.subToolMode = .None
|
|
|
+// cancelSelectedSecondToolbarItems(.Protect)
|
|
|
+// delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, KMPDFToolbar_protect_redact_Apply_Identifier)
|
|
|
|
|
|
} else if buttonIndex == 3 {
|
|
|
- viewManager?.subToolMode = .None
|
|
|
- cancelSelectedSecondToolbarItems(.Protect)
|
|
|
- delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, KMPDFToolbar_protect_redact_Exit_Identifier)
|
|
|
+ self.exitRedactAlert()
|
|
|
+// viewManager?.subToolMode = .None
|
|
|
+// cancelSelectedSecondToolbarItems(.Protect)
|
|
|
+// delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, KMPDFToolbar_protect_redact_Exit_Identifier)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1301,4 +1304,64 @@ extension KMPDFToolbarController: KMRedactToolbarControllerDelegate {
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ func exitRedactAlert() {
|
|
|
+ if UserDefaults.standard.object(forKey: "kExitRedactAlert") != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .informational
|
|
|
+// alert.informativeText = KMLocalizedString("Redaction allows you to permanently mask and remove sensitive content.")
|
|
|
+ alert.messageText = KMLocalizedString("""
|
|
|
+ There are unapplied redactions in this file. Any content associated with them will not be redacted until applied.
|
|
|
+ """)
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Exit"))
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Cancel"))
|
|
|
+ alert.showsSuppressionButton = true
|
|
|
+ let response = alert.runModal()
|
|
|
+ if response.rawValue == 1000 {
|
|
|
+ if alert.suppressionButton?.state == .on {
|
|
|
+ UserDefaults.standard.set("YES", forKey: "kExitRedactAlert")
|
|
|
+ UserDefaults.standard.synchronize()
|
|
|
+ }
|
|
|
+
|
|
|
+ //退出
|
|
|
+ viewManager?.subToolMode = .None
|
|
|
+ cancelSelectedSecondToolbarItems(.Protect)
|
|
|
+ delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, KMPDFToolbar_protect_redact_Exit_Identifier)
|
|
|
+ } else if response.rawValue == 1001 {
|
|
|
+ //取消
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func applyRedactAlert() {
|
|
|
+ if UserDefaults.standard.object(forKey: "kApplyRedactAlert") != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .informational
|
|
|
+ alert.messageText = KMLocalizedString("This action will permanently remove the redacted information from this document.")
|
|
|
+ alert.informativeText = KMLocalizedString("""
|
|
|
+ After you save this document, you will not be able to retrieve the redacted information.
|
|
|
+ """)
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Apply"))
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Cancel"))
|
|
|
+ alert.showsSuppressionButton = true
|
|
|
+ let response = alert.runModal()
|
|
|
+ if response.rawValue == 1000 {
|
|
|
+ if alert.suppressionButton?.state == .on {
|
|
|
+ UserDefaults.standard.set("YES", forKey: "kApplyRedactAlert")
|
|
|
+ UserDefaults.standard.synchronize()
|
|
|
+ }
|
|
|
+
|
|
|
+ //应用
|
|
|
+ viewManager?.subToolMode = .None
|
|
|
+ cancelSelectedSecondToolbarItems(.Protect)
|
|
|
+ delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, KMPDFToolbar_protect_redact_Apply_Identifier)
|
|
|
+ } else if response.rawValue == 1001 {
|
|
|
+ //取消
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|