Browse Source

综合-首页添加加密文档补充阻挡

tangchao 1 year ago
parent
commit
dbaed46dec

BIN
PDF Office/PDF Office.xcodeproj/project.xcworkspace/xcuserdata/kdanmobile.xcuserdatad/UserInterfaceState.xcuserstate


+ 26 - 22
PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -96,7 +96,11 @@ import Cocoa
         listView.pdfListViewDelegate = self
         listView.editingConfig().isSupportMultipleSelectEditingArea = true
         if (document != nil) {
-            listView.document = document
+//            if (self.document!.isLocked) {
+//
+//            } else {
+                listView.document = document
+//            }
             //            listView.document.delegate = self
             let autoScale = listView.autoScales
             if !autoScale {
@@ -108,27 +112,27 @@ import Cocoa
         self.toolbarController.listView = self.listView
     }
     
-//    override func viewDidAppear() {
-//        super.viewDidAppear()
-//
-//        if (self.document == nil) {
-//            return
-//        }
-//        if (self.document!.isLocked == false) {
-//            return
-//        }
-//        if (self.view.window == nil) {
-//            return
-//        }
-//        KMPasswordInputWindow.openWindow(window: self.view.window!, url: self.document!.documentURL) { result , password in
-//            if (result == .cancel) {
-//                self.browserWindowController?.browser.closeTab()
-//                return
-//            }
-//            self.document?.unlock(withPassword: password)
-//            self.listView.document = self.document
-//        }
-//    }
+    override func viewDidAppear() {
+        super.viewDidAppear()
+
+        if (self.document == nil) {
+            return
+        }
+        if (self.document!.isLocked == false) {
+            return
+        }
+        if (self.view.window == nil) {
+            return
+        }
+        KMPasswordInputWindow.openWindow(window: self.view.window!, url: self.document!.documentURL) { result , password in
+            if (result == .cancel) {
+                self.browserWindowController?.browser.closeTab()
+                return
+            }
+            self.document?.unlock(withPassword: password)
+            self.listView.document = self.document
+        }
+    }
     
     override func viewWillDisappear() {
         super.viewWillDisappear()