Browse Source

文案 - 未选中任意任何文件,点击右上角一键清空文案调整

wanjun 1 year ago
parent
commit
3572e8bc6f

+ 11 - 10
PDF Office/PDF Master/Class/Home/ViewController/KMHomeHistoryFileViewController.swift

@@ -538,16 +538,17 @@ class KMHomeHistoryFileViewController: NSViewController, NSCollectionViewDelegat
             }
             self.delete?.historyFileViewController!(self, deleteDocuments: selectFiles)
         } else if selectFiles.count > 0 {
-            let urls: Array<URL> = NSDocumentController.shared.recentDocumentURLs
-            NSDocumentController.shared.clearRecentDocuments(nil)
-            DispatchQueue.main.asyncAfter(deadline: .now()) { [self] in
-                for (_, url) in urls.enumerated() {
-                    if !selectFiles.contains(url) {
-                        NSDocumentController.shared.noteNewRecentDocumentURL(url)
-                    }
-                }
-                NotificationCenter.default.post(name: NSNotification.Name.init(rawValue: "KMHomeFileRectChange"), object: NSApp.mainWindow)
-            }
+//            let urls: Array<URL> = NSDocumentController.shared.recentDocumentURLs
+//            NSDocumentController.shared.clearRecentDocuments(nil)
+//            DispatchQueue.main.asyncAfter(deadline: .now()) { [self] in
+//                for (_, url) in urls.enumerated() {
+//                    if !selectFiles.contains(url) {
+//                        NSDocumentController.shared.noteNewRecentDocumentURL(url)
+//                    }
+//                }
+//                NotificationCenter.default.post(name: NSNotification.Name.init(rawValue: "KMHomeFileRectChange"), object: NSApp.mainWindow)
+//            }
+            self.delete?.historyFileViewController!(self, deleteDocuments: selectFiles)
         }
     }
     

+ 7 - 1
PDF Office/PDF Master/Class/Home/WindowController/KMHistoryFileDeleteWindowController.swift

@@ -68,7 +68,13 @@ class KMHistoryFileDeleteWindowController: NSWindowController {
     func initLocalization() {
         let firstPath = indexPaths.first?.path.lastPathComponent ?? ""
 //        deleteOptionsLabel.stringValue = String(format: NSLocalizedString("Remove\"%@\"from your Recent Files?", comment: ""), firstPath)
-        deleteOptionsLabel.stringValue = NSLocalizedString("Delete selected file from the recents", comment: "")
+        let urls: Array<URL> = NSDocumentController.shared.recentDocumentURLs
+        if urls.count == indexPaths.count {
+            deleteOptionsLabel.stringValue = NSLocalizedString("Clear All Recents", comment: "")
+        } else {
+            deleteOptionsLabel.stringValue = NSLocalizedString("Delete selected file from the recents", comment: "")
+        }
+
         noLongerPromptVC.stringValue = NSLocalizedString("Don't ask again", comment: "")
         cancelVC.stringValue = NSLocalizedString("Cancel", comment: "")
         deleteVC.stringValue = NSLocalizedString("Delete", comment: "")

+ 2 - 3
PDF Office/PDF Master/Class/Home/WindowController/KMHistoryFileDeleteWindowController.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMHistoryFileDeleteWindowController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMHistoryFileDeleteWindowController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="cancelBox" destination="84N-oJ-zPU" id="vS5-xZ-TRI"/>
                 <outlet property="deleteBox" destination="ICh-pS-7xc" id="e6j-Jk-V9z"/>
@@ -30,7 +29,7 @@
                         <constraints>
                             <constraint firstAttribute="width" constant="228" id="SGg-Fg-WbD"/>
                         </constraints>
-                        <textFieldCell key="cell" title="Label" id="I5C-zs-Vdr">
+                        <textFieldCell key="cell" alignment="center" title="Label" id="I5C-zs-Vdr">
                             <font key="font" usesAppearanceFont="YES"/>
                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>