Browse Source

【BOTA】搜索栏不勾选忽略大小写,输入小写搜索的结果会显示大写的 修复

lizhe 1 year ago
parent
commit
2b0e5fcdd2

+ 8 - 8
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.xib

@@ -5,7 +5,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBrowserWindowController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBrowserWindowController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="fileSearchView_" destination="eJO-4K-8Fw" id="eOY-0e-9xQ"/>
                 <outlet property="fileUploadPanel" destination="iH2-4t-6uG" id="zAQ-Xv-eYu"/>
@@ -33,7 +33,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="1280" height="786"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kjc-aQ-qNb" customClass="KMToolbarRightView" customModule="PDF_Office" customModuleProvider="target">
+                            <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kjc-aQ-qNb" customClass="KMToolbarRightView" customModule="PDF_Master" customModuleProvider="target">
                                 <rect key="frame" x="208" y="481" width="163" height="96"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                             </customView>
@@ -46,7 +46,7 @@
             </connections>
             <point key="canvasLocation" x="21" y="144"/>
         </window>
-        <customView id="xy6-xE-uD2" customClass="KMToolbarRightView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="xy6-xE-uD2" customClass="KMToolbarRightView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="418" height="55"/>
             <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
             <subviews>
@@ -144,7 +144,7 @@
             </connections>
             <point key="canvasLocation" x="104.5" y="581.5"/>
         </customView>
-        <customView id="p5u-KH-T9i" customClass="KMToolbarRightView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="p5u-KH-T9i" customClass="KMToolbarRightView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="267" height="45"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
             <subviews>
@@ -162,7 +162,7 @@
                         <action selector="userInfoButtonAction:" target="xy6-xE-uD2" id="UcG-2p-rY4"/>
                     </connections>
                 </button>
-                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="WXF-Ar-JGk" customClass="KMSegmentedBox" customModule="PDF_Office" customModuleProvider="target">
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="WXF-Ar-JGk" customClass="KMSegmentedBox" customModule="PDF_Master" customModuleProvider="target">
                     <rect key="frame" x="60" y="12" width="163" height="21"/>
                     <view key="contentView" id="pfi-aZ-YRi">
                         <rect key="frame" x="0.0" y="0.0" width="163" height="21"/>
@@ -241,7 +241,7 @@
             </connections>
             <point key="canvasLocation" x="-3.5" y="718.5"/>
         </customView>
-        <customView id="eJO-4K-8Fw" userLabel="Management Search View" customClass="KMFileSearchView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="eJO-4K-8Fw" userLabel="Management Search View" customClass="KMFileSearchView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="145" height="22"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
@@ -301,7 +301,7 @@
             </connections>
             <point key="canvasLocation" x="43" y="538"/>
         </customView>
-        <window title="Panel" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="iH2-4t-6uG" userLabel="Progress Panel" customClass="KMUploadFilePanel" customModule="PDF_Office" customModuleProvider="target">
+        <window title="Panel" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="iH2-4t-6uG" userLabel="Progress Panel" customClass="KMUploadFilePanel" customModule="PDF_Master" customModuleProvider="target">
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="1127" y="748" width="369" height="111"/>
@@ -355,7 +355,7 @@ Gw
             </connections>
             <point key="canvasLocation" x="-80" y="1015"/>
         </window>
-        <customView id="zbC-Pu-Vky" userLabel="TabBar" customClass="KMTabStripView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="zbC-Pu-Vky" userLabel="TabBar" customClass="KMTabStripView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="483" height="40"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
             <subviews>

+ 16 - 34
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -8,7 +8,7 @@
 import Foundation
 
 extension KMMainViewController {
-    func search(searchString:String,isCase:Bool) {
+    func search(searchString: String, isCase: Bool) {
         let document = self.listView.document
         if ((document?.isFinding) != nil) {
             document?.cancelFindString()
@@ -19,42 +19,24 @@ extension KMMainViewController {
             self.leftSideViewController.searchViewController.reloadData()
         } else {
             mwcFlags.wholeWordSearch = isCase == true ? 1 : 0
-            if mwcFlags.wholeWordSearch != 0 {
-                let words = KMOCToolClass.scannerCharaterString(searchString)!
-                var string = words.firstObject as? String
-                if string == nil {
-                    string = ""
-                }
-                let findArray : [[CPDFSelection]] = self.listView.document.findString(string) ?? []
-                self.searchResults.removeAll()
-                for selections in findArray {
-                    for selection in selections {
-//                        if KMOCToolClass.wholeWord(with: selection, keyword: searchString) {
-                            let mode : KMSearchMode = KMSearchMode()
-                            mode.selection = selection
-                            mode.attributedString = KMOCToolClass.getAttributedString(with: selection, keyword: searchString)
-                            mode.selectionPageIndex = self.listView.document.index(for: selection.page)
-                            self.searchResults.insert(mode, at: self.searchResults.count)
-//                        }
-                    }
-                }
-                self.leftSideViewController.searchViewController.searchResults = self.searchResults
-                self.leftSideViewController.searchViewController.reloadData()
+            var findArray : [[CPDFSelection]]
+            if isCase {
+                findArray = self.listView.document.findString(searchString) ?? []
             } else {
-                let findArray : [[CPDFSelection]] = self.listView.document.findString(searchString) ?? []
-                self.searchResults.removeAll()
-                for selections in findArray {
-                    for selection in selections {
-                        let mode : KMSearchMode = KMSearchMode()
-                        mode.selection = selection
-                        mode.attributedString = KMOCToolClass.getAttributedString(with: selection, keyword: searchString)
-                        mode.selectionPageIndex = self.listView.document.index(for: selection.page)
-                        self.searchResults.insert(mode, at: self.searchResults.count)
-                    }
+                findArray = self.listView.document.findString(searchString, with: .caseSensitive) ?? []
+            }
+            self.searchResults.removeAll()
+            for selections in findArray {
+                for selection in selections {
+                    let mode : KMSearchMode = KMSearchMode()
+                    mode.selection = selection
+                    mode.attributedString = KMOCToolClass.getAttributedString(with: selection, keyword: searchString)
+                    mode.selectionPageIndex = self.listView.document.index(for: selection.page)
+                    self.searchResults.insert(mode, at: self.searchResults.count)
                 }
-                self.leftSideViewController.searchViewController.searchResults = self.searchResults
-                self.leftSideViewController.searchViewController.reloadData()
             }
+            self.leftSideViewController.searchViewController.searchResults = self.searchResults
+            self.leftSideViewController.searchViewController.reloadData()
         }
     }