|
@@ -424,43 +424,29 @@ extension KMHomeViewController {
|
|
|
showLimitWindowAlert(url: url)
|
|
|
return
|
|
|
}
|
|
|
- KMMainDocument().tryToUnlockDocument(pdfDoc!)
|
|
|
- var selectDocument: KMMainDocument? = nil
|
|
|
- if ((document?.isKind(of: KMMainDocument.self)) != nil) {
|
|
|
- selectDocument = (document as! KMMainDocument)
|
|
|
- }
|
|
|
- if selectDocument != nil {
|
|
|
- let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
|
|
|
- selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
|
|
|
- if (selectDocument?.browser.window.isVisible)! as Bool {
|
|
|
+ }
|
|
|
+
|
|
|
+ KMMainDocument().tryToUnlockDocument(pdfDoc!)
|
|
|
+ var selectDocument: KMMainDocument? = nil
|
|
|
+ if ((document?.isKind(of: KMMainDocument.self)) != nil) {
|
|
|
+ selectDocument = (document as! KMMainDocument)
|
|
|
+ }
|
|
|
+ if selectDocument != nil {
|
|
|
+ if selectDocument?.browser != nil {
|
|
|
+ let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument) ?? 0
|
|
|
+ selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex), userGesture: true)
|
|
|
+ let isVisible: Bool = selectDocument?.browser.window.isVisible ?? false
|
|
|
+ let isMiniaturized: Bool = selectDocument?.browser.window.isMiniaturized ?? false
|
|
|
+
|
|
|
+ if isVisible {
|
|
|
selectDocument?.browser.window.orderFront(nil)
|
|
|
- } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
|
|
|
+ } else if isMiniaturized {
|
|
|
selectDocument?.browser.window.orderFront(nil)
|
|
|
}
|
|
|
- } else {
|
|
|
- NSDocumentController.shared.km_safe_openDocument(withContentsOf: url, display: true) { _, _, _ in
|
|
|
-
|
|
|
- }
|
|
|
}
|
|
|
} else {
|
|
|
- var selectDocument: KMMainDocument? = nil
|
|
|
- if ((document?.isKind(of: KMMainDocument.self)) != nil) {
|
|
|
- selectDocument = (document as! KMMainDocument)
|
|
|
- }
|
|
|
- if selectDocument != nil {
|
|
|
- if selectDocument?.browser != nil {
|
|
|
- let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
|
|
|
- selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
|
|
|
- if (selectDocument?.browser.window.isVisible)! as Bool {
|
|
|
- selectDocument?.browser.window.orderFront(nil)
|
|
|
- } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
|
|
|
- selectDocument?.browser.window.orderFront(nil)
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- NSDocumentController.shared.km_safe_openDocument(withContentsOf: url, display: true) { _, _, _ in
|
|
|
-
|
|
|
- }
|
|
|
+ NSDocumentController.shared.km_safe_openDocument(withContentsOf: url, display: true) { _, _, _ in
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
} else {
|