소스 검색

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

tangchao 1 년 전
부모
커밋
f4accaca83

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/KMBookmark/Controller/KMBookmarkController.swift

@@ -179,7 +179,7 @@ class KMBookmarkController: NSWindowController {
     @IBAction func doubleClickBookmark(_ sender: Any?) {
         let row = bookmarkOutlineView.outlineView.clickedRow
         if let bm = (row != -1 ? bookmarkOutlineView.outlineView.item(atRow: row) : nil) as? KMBookmark,
-           [KMBookmarkType.bookmark, .session].contains(bm.bookmarkType) {
+           [KMBookmarkType.bookmark, .session, .file].contains(bm.bookmarkType) {
             bm.open()
         }
     }

+ 9 - 9
PDF Office/PDF Master/Class/PDFTools/KMBookmark/Model/KMBookmark.swift

@@ -52,7 +52,7 @@ class KMBookmark: NSObject {
                 self.bookmarkType = KMBookmarkType(rawValue: documentSetup[kType] as! String ) ?? .bookmark
             }
             self.aliasData = documentSetup[kBDAlias] as? NSData
-            self.pageIndex = documentSetup[kPageIndex] as? UInt ?? 0
+            self.pageIndex = UInt(documentSetup[kPageIndex] as! String) ?? 0
             if documentSetup[kLabel] != nil {
                 self.label = documentSetup[kLabel] as! String
             }
@@ -268,13 +268,13 @@ class KMBookmark: NSObject {
     func open() {
         var document: Any?
         var error: Error?
-        if documentSetup != nil {
-            document = try? NSDocumentController.shared.openDocument(nil)
-            if document == nil {
-                NSApp.presentError(NSError(domain: "File not found", code: -1, userInfo: nil))
-            }
-//            document = [[NSDocumentController sharedDocumentController] openDocumentWithSetup:[self properties] error:&error];
-        } else {
+//        if documentSetup != nil {
+//            document = try? NSDocumentController.shared.openDocument(nil)
+//            if document == nil {
+//                NSApp.presentError(NSError(domain: "File not found", code: -1, userInfo: nil))
+//            }
+////            document = [[NSDocumentController sharedDocumentController] openDocumentWithSetup:[self properties] error:&error];
+//        } else {
             guard let fileURL = fileURL else { return }
             NSDocumentController.shared.openDocument(withContentsOf: fileURL, display: true, completionHandler: { document, result, error in
                 if (error != nil) {
@@ -285,7 +285,7 @@ class KMBookmark: NSObject {
                     }
                 }
             })
-        }
+//        }
     }
     
     func objectOfChidren(index: Int) -> KMBookmark{