|
@@ -3526,13 +3526,21 @@ struct KMNMWCFlags {
|
|
|
//MARK: Compress
|
|
|
extension KMMainViewController {
|
|
|
func showCompressController(_ url: URL) {
|
|
|
- KMPasswordInputWindow.openWindow(window: NSWindow.currentWindow(), type: .owner, url: url) { [unowned self] result, password in
|
|
|
- if (result == .success) {
|
|
|
- let model = KMBatchProcessingTableViewModel.initWithFilePath(url: listView.document.documentURL)
|
|
|
- model.password = password ?? ""
|
|
|
- model.isLock = false
|
|
|
- self.showCompressController(model: model)
|
|
|
+ let document = CPDFDocument(url: url)
|
|
|
+ document?.unlock(withPassword: model.password)
|
|
|
+
|
|
|
+ if !document!.allowsPrinting && !document!.allowsCopying {
|
|
|
+ KMPasswordInputWindow.openWindow(window: NSWindow.currentWindow(), type: .owner, url: url) { [unowned self] result, password in
|
|
|
+ if (result == .success) {
|
|
|
+ let model = KMBatchProcessingTableViewModel.initWithFilePath(url: listView.document.documentURL)
|
|
|
+ model.password = password ?? ""
|
|
|
+ model.isLock = false
|
|
|
+ self.showCompressController(model: model)
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ let model = KMBatchProcessingTableViewModel.initWithFilePath(url: listView.document.documentURL)
|
|
|
+ self.showCompressController(model: model)
|
|
|
}
|
|
|
}
|
|
|
|