瀏覽代碼

【保存】添加任意注释,快捷键cmd+s保存,没有任何反应,架上会出现一个保存提示进度框

liujiajie 10 月之前
父節點
當前提交
7e25b7544e

+ 2 - 0
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -971,6 +971,7 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
             return
         }
         var success = true
+        NotificationCenter.default.post(name: Notification.Name(rawValue: "kCPDFDocumentDidBeginWriteNotification"), object: self)
         if !self.isHome {
             if mainViewController != nil {
                 if mainViewController?.document != nil {
@@ -1011,6 +1012,7 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
         if success && isNewCreated && NSDocument.SaveOperationType.saveAsOperation == saveOperation {
             isNewCreated = false
         }
+        NotificationCenter.default.post(name: Notification.Name(rawValue: "kCPDFDocumentDidEndWriteNotification"), object: self)
     }
     
     private func _km_saveForWatermark(openAccessoryView: Bool = true, subscribeDidClick: (()->Void)? = nil, callback:@escaping (_ needSave: Bool, _ param: Any...)->Void) {

+ 4 - 4
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/ProgressSheet.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment version="101300" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -19,7 +19,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="302" y="374" width="226" height="58"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="300" height="87"/>
             <value key="maxSize" type="size" width="300" height="87"/>
             <view key="contentView" id="6">
@@ -35,7 +35,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <progressIndicator verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" controlSize="small" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="SKProgressController_ProgressIndicator" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                    <progressIndicator verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" doubleValue="5" bezeled="NO" controlSize="small" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="SKProgressController_ProgressIndicator" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="16" y="12" width="194" height="12"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </progressIndicator>

+ 28 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -2386,6 +2386,33 @@ extension KMMainViewController {
         }
     }
     
+    func pdfSaveAlertView(_ sender: NSNotification) {
+        if AutoSaveManager.manager.isSaving{
+            return
+        }
+        var num = 0
+        if self.listView.document != nil{
+            num = Int(self.listView.document.pageCount)
+        }
+        if Thread.current.isMainThread {
+            self.beginProgressSheet(withMessage: NSLocalizedString("Saving PDF", comment: "") + "...", maxValue: UInt(num))
+        } else {
+            DispatchQueue.main.async {
+                self.beginProgressSheet(withMessage: NSLocalizedString("Saving PDF", comment: "") + "...", maxValue: UInt(num))
+            }
+        }
+    }
+    
+    func pdfSaveFinishAlertView(_ sender: NSNotification) {
+        if Thread.current.isMainThread {
+            self.dismissProgressSheet()
+        } else {
+            DispatchQueue.main.async {
+                self.dismissProgressSheet()
+            }
+        }
+    }
+    
     private func _renameForSavePanel(_ tabC: CTTabController?) {
         let outputSavePanel = NSSavePanel()
         outputSavePanel.title = NSLocalizedString("Rename", comment: "")
@@ -2978,6 +3005,7 @@ extension KMMainViewController {
         if maxValue > 0 {
             progressC?.indeterminate = false
             progressC?.maxValue = Double(maxValue)
+            progressC?.progressBar.doubleValue = 0.3
         } else {
             progressC?.indeterminate = true
         }

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -393,6 +393,8 @@ import Cocoa
         NotificationCenter.default.addObserver(self, selector: #selector(didShowFullScreenNotification), name: NSWindow.didShowFullScreenNotification, object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(didAddContentViewNotification), name: NSWindow.didAddContentViewNotification, object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(addAutoSaveEvent), name: AutoSaveManager.kTimeValueChangedNotificationName, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(pdfSaveAlertView(_:)), name: Notification.Name("kCPDFDocumentDidBeginWriteNotification"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(pdfSaveFinishAlertView(_:)), name: Notification.Name("kCPDFDocumentDidEndWriteNotification"), object: nil)
         
         Task {
             self.addAutoSaveEvent()