|
@@ -52,7 +52,7 @@ class KMBookmark: NSObject {
|
|
self.bookmarkType = KMBookmarkType(rawValue: documentSetup[kType] as! String ) ?? .bookmark
|
|
self.bookmarkType = KMBookmarkType(rawValue: documentSetup[kType] as! String ) ?? .bookmark
|
|
}
|
|
}
|
|
self.aliasData = documentSetup[kBDAlias] as? NSData
|
|
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 {
|
|
if documentSetup[kLabel] != nil {
|
|
self.label = documentSetup[kLabel] as! String
|
|
self.label = documentSetup[kLabel] as! String
|
|
}
|
|
}
|
|
@@ -268,13 +268,13 @@ class KMBookmark: NSObject {
|
|
func open() {
|
|
func open() {
|
|
var document: Any?
|
|
var document: Any?
|
|
var error: Error?
|
|
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 }
|
|
guard let fileURL = fileURL else { return }
|
|
NSDocumentController.shared.openDocument(withContentsOf: fileURL, display: true, completionHandler: { document, result, error in
|
|
NSDocumentController.shared.openDocument(withContentsOf: fileURL, display: true, completionHandler: { document, result, error in
|
|
if (error != nil) {
|
|
if (error != nil) {
|
|
@@ -285,7 +285,7 @@ class KMBookmark: NSObject {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- }
|
|
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
func objectOfChidren(index: Int) -> KMBookmark{
|
|
func objectOfChidren(index: Int) -> KMBookmark{
|