|
@@ -659,17 +659,32 @@ extension KMHomeViewController: NSPopoverDelegate {
|
|
|
|
|
|
extension KMHomeViewController {
|
|
|
func openPDFAction(_ sender: KMBox) {
|
|
|
+ let controll: KMBrowserWindowController? = self.view.window?.windowController as? KMBrowserWindowController
|
|
|
+ if controll?.browser.tabCount() ?? 0 > 1 && !IAPProductsManager.default().isAvailableAllFunction() {
|
|
|
+ let window = NSWindow.currentWindow()
|
|
|
+ if !KMDataManager.default.isTabbingWin{
|
|
|
+ KMDataManager.default.isTabbingWin = true
|
|
|
+ let tabbingWin: KMTabbingHintWindowController = KMTabbingHintWindowController()
|
|
|
+ tabbingWin.selectCallBack = { continueOrNot in
|
|
|
+ window.km_quick_endSheet()
|
|
|
+ KMDataManager.default.isTabbingWin = false
|
|
|
+ if continueOrNot {
|
|
|
+ self.reopenDocument(forPaths: [])
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ window.km_beginSheet(windowC: tabbingWin)
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
let openPanel = NSOpenPanel()
|
|
|
openPanel.allowedFileTypes = ["pdf", "PDF"]
|
|
|
openPanel.allowsMultipleSelection = false
|
|
|
openPanel.beginSheetModal(for: self.view.window!) { (result) in
|
|
|
if result == NSApplication.ModalResponse.OK {
|
|
|
- NSDocumentController.shared.openDocument(withContentsOf: openPanel.url!, display: true) { (document, documentWasAlreadyOpen, error) in
|
|
|
- if let error = error {
|
|
|
- NSApp.presentError(error)
|
|
|
- } else {
|
|
|
- self.view.window?.windowController?.close()
|
|
|
- }
|
|
|
+ NSDocumentController.shared.km_safe_limit_openDocument(withContentsOf: openPanel.url!, display: true) { (document, documentWasAlreadyOpen, error) in
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|