Browse Source

Merge branch 'develop' of http://git.kdan.cc:8865/Mac_PDF/PDF_Office into develop

liaoxiaoyue 1 year ago
parent
commit
d1fea2ce69

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


+ 0 - 16
PDF Office/PDF Office.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -116,21 +116,5 @@
             landmarkType = "7">
             landmarkType = "7">
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "0AE00915-2583-4DDF-98BB-EE5C169A3631"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Office/AppDelegate.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "105"
-            endingLineNumber = "105"
-            landmarkName = "sharePageItemAction()"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
    </Breakpoints>
    </Breakpoints>
 </Bucket>
 </Bucket>

+ 17 - 1
PDF Office/PDF Office/AppDelegate.swift

@@ -100,8 +100,24 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         shareItem.submenu = NSSharingServicePicker.menu(forSharingItems: [""], subjectContext: "", withTarget: self, selector: #selector(sharePageItemAction), serviceDelegate: nil)
         shareItem.submenu = NSSharingServicePicker.menu(forSharingItems: [""], subjectContext: "", withTarget: self, selector: #selector(sharePageItemAction), serviceDelegate: nil)
     }
     }
     
     
-    @objc func sharePageItemAction() {
+    @objc func sharePageItemAction(sender: NSMenuItem) {
+        if ((NSApp.mainWindow?.windowController is KMBrowserWindowController) == false) {
+            return
+        }
+        
+        let windowControler = NSApp.mainWindow?.windowController as! KMBrowserWindowController
+        let model: CTTabStripModel = windowControler.browser.tabStripModel
+        if (model.count() <= 0) {
+            return
+        }
+        
+        if (model.activeTabContents().isHome) {
+            return
+        }
         
         
+        let document: KMMainDocument = model.activeTabContents() as! KMMainDocument        
+        let represent : NSSharingService = sender.representedObject as! NSSharingService
+        represent.perform(withItems: [document.fileURL as Any])
     }
     }
     
     
     func updateAccountMenus() {
     func updateAccountMenus() {