Browse Source

【2025】【综合】整合基础类

dinglingui 4 months ago
parent
commit
faf8a55fb2
28 changed files with 1374 additions and 840 deletions
  1. 35 35
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.xib
  2. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift
  3. 22 26
      PDF Office/PDF Master/KMClass/Convert/Base/KMConvertBaseWindowController.swift
  4. 2 3
      PDF Office/PDF Master/KMClass/Convert/Window/KMConvertCSVWindowController.swift
  5. 3 8
      PDF Office/PDF Master/KMClass/Convert/Window/KMConvertExcelWindowController.swift
  6. 2 2
      PDF Office/PDF Master/KMClass/Convert/Window/KMConvertHtmlWindowController.swift
  7. 2 2
      PDF Office/PDF Master/KMClass/Convert/Window/KMConvertImageWindowController.swift
  8. 2 2
      PDF Office/PDF Master/KMClass/Convert/Window/KMConvertJsonWindowController.swift
  9. 2 2
      PDF Office/PDF Master/KMClass/Convert/Window/KMConvertPPTsWindowController.swift
  10. 2 2
      PDF Office/PDF Master/KMClass/Convert/Window/KMConvertWordWindowController.swift
  11. 8 8
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFInsert/KMNPDFInsertPDFWindowController.swift
  12. 255 25
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController+Action.swift
  13. 31 0
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift
  14. 9 9
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.xib
  15. 1 1
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMNDisplayViewController/KMNDisplayViewController.swift
  16. 1 1
      PDF Office/PDF Master/KMClass/Left/KMNLeftSideViewController.swift
  17. 2 2
      PDF Office/PDF Master/KMClass/Left/KMNLeftSideViewController.xib
  18. 18 0
      PDF Office/PDF Master/KMClass/Left/ThumnailView/KMNThumnailHeaderViewController.xib
  19. 25 41
      PDF Office/PDF Master/Class/PDFTools/Tools/KMBaseXibView/BaseXibView.swift
  20. 12 448
      PDF Office/PDF Master/KMClass/Tools/Base/KMNBaseViewController.swift
  21. 13 125
      PDF Office/PDF Master/KMClass/Tools/Base/KMNBaseWindowController.swift
  22. 42 0
      PDF Office/PDF Master/KMClass/Tools/NSWindowController+Extension/NSWindowController+Extension.swift
  23. 46 46
      PDF Office/PDF Master/Class/PDFTools/Secure/View/KMSecureTextFiled.swift
  24. 568 0
      PDF Office/PDF Master/KMClass/Tools/Secure/Window/KMPasswordInputWindow.swift
  25. 199 0
      PDF Office/PDF Master/KMClass/Tools/Secure/Window/KMPasswordInputWindow.xib
  26. 12 0
      PDF Office/PDF Master/KMClass/Tools/Tool/KMNConvertTool.swift
  27. 56 48
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj
  28. 3 3
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/dinglingui.xcuserdatad/xcschemes/xcschememanagement.plist

+ 35 - 35
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<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="22155"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -45,11 +45,11 @@
                         <box autoresizesSubviews="NO" title="Password Security Settings" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="ST2-wX-xoy">
                             <rect key="frame" x="37" y="274" width="498" height="236"/>
                             <view key="contentView" id="6hv-cP-65h">
-                                <rect key="frame" x="4" y="5" width="490" height="228"/>
+                                <rect key="frame" x="3" y="3" width="492" height="230"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="twD-kg-pju">
-                                        <rect key="frame" x="14" y="196" width="471" height="18"/>
+                                        <rect key="frame" x="14" y="198" width="473" height="18"/>
                                         <buttonCell key="cell" type="check" title="Require a password to open the document." bezelStyle="regularSquare" imagePosition="left" inset="2" id="v2x-SU-J9M">
                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -58,16 +58,16 @@
                                             <action selector="openPasswordButtonAction:" target="-2" id="H9S-kO-FSs"/>
                                         </connections>
                                     </button>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4FR-2o-FxP">
-                                        <rect key="frame" x="34" y="164" width="169" height="16"/>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4FR-2o-FxP">
+                                        <rect key="frame" x="34" y="166" width="169" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Document Open Password:" id="tkx-7J-BVQ">
                                             <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="textColor" red="0.090196078431372548" green="0.4392156862745098" blue="0.95686274509803915" alpha="0.84705882352941175" colorSpace="custom" customColorSpace="sRGB"/>
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6g4-S8-Wrw" userLabel="Open Password">
-                                        <rect key="frame" x="206" y="161" width="248" height="21"/>
+                                    <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6g4-S8-Wrw" userLabel="Open Password">
+                                        <rect key="frame" x="206" y="163" width="250" height="21"/>
                                         <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" enabled="NO" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="o4k-uv-YuM">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -78,7 +78,7 @@
                                         </secureTextFieldCell>
                                     </secureTextField>
                                     <button tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="MN5-MX-XNZ">
-                                        <rect key="frame" x="14" y="129" width="308" height="18"/>
+                                        <rect key="frame" x="14" y="131" width="308" height="18"/>
                                         <buttonCell key="cell" type="check" title="Restrict printing and copying of the document." bezelStyle="regularSquare" imagePosition="left" inset="2" id="Sto-JN-CH6">
                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -87,8 +87,8 @@
                                             <action selector="ownerPaasswordButtonAction:" target="-2" id="mag-bW-xf5"/>
                                         </connections>
                                     </button>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HTv-gT-hdG">
-                                        <rect key="frame" x="34" y="97" width="169" height="16"/>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HTv-gT-hdG">
+                                        <rect key="frame" x="34" y="99" width="169" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Permissions Password:" id="4Wl-oL-1en">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -96,7 +96,7 @@
                                         </textFieldCell>
                                     </textField>
                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="Df0-VK-282">
-                                        <rect key="frame" x="63" y="57" width="188" height="18"/>
+                                        <rect key="frame" x="63" y="59" width="188" height="18"/>
                                         <buttonCell key="cell" type="check" title="Restrict document printing" bezelStyle="regularSquare" imagePosition="left" enabled="NO" inset="2" id="Y7o-CX-bmh">
                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -106,7 +106,7 @@
                                         </connections>
                                     </button>
                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="Q12-nq-8Ww">
-                                        <rect key="frame" x="63" y="31" width="175" height="18"/>
+                                        <rect key="frame" x="63" y="33" width="175" height="18"/>
                                         <buttonCell key="cell" type="check" title="Restrict content copying" bezelStyle="regularSquare" imagePosition="left" enabled="NO" inset="2" id="hyr-CH-Xfe">
                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -115,8 +115,8 @@
                                             <action selector="copyButtonAction:" target="-2" id="o3r-bc-w8E"/>
                                         </connections>
                                     </button>
-                                    <secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KlB-P6-WnC" userLabel="Owner Password">
-                                        <rect key="frame" x="206" y="94" width="248" height="21"/>
+                                    <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KlB-P6-WnC" userLabel="Owner Password">
+                                        <rect key="frame" x="206" y="96" width="250" height="21"/>
                                         <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" enabled="NO" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="slP-Wn-4zY">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -194,67 +194,67 @@ DQ
                         <box autoresizesSubviews="NO" title="Document Description" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="AuG-7F-1zd">
                             <rect key="frame" x="37" y="66" width="498" height="176"/>
                             <view key="contentView" id="dsj-4C-14o">
-                                <rect key="frame" x="4" y="5" width="490" height="168"/>
+                                <rect key="frame" x="3" y="3" width="492" height="170"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G69-bY-klh">
-                                        <rect key="frame" x="14" y="135" width="67" height="16"/>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G69-bY-klh">
+                                        <rect key="frame" x="14" y="137" width="67" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Title:" id="ChV-F8-rdz">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1qu-Ea-pYg">
-                                        <rect key="frame" x="85" y="132" width="395" height="21"/>
+                                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1qu-Ea-pYg">
+                                        <rect key="frame" x="85" y="134" width="397" height="21"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="fDe-4Q-Pyw">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="feB-OM-BTK">
-                                        <rect key="frame" x="14" y="99" width="67" height="16"/>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="feB-OM-BTK">
+                                        <rect key="frame" x="14" y="101" width="67" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Author:" id="Le5-rl-XYu">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FbH-uh-vhX">
-                                        <rect key="frame" x="85" y="96" width="395" height="21"/>
+                                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FbH-uh-vhX">
+                                        <rect key="frame" x="85" y="98" width="397" height="21"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="dHR-ed-Cv8">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pye-Uj-4I0">
-                                        <rect key="frame" x="14" y="27" width="67" height="16"/>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pye-Uj-4I0">
+                                        <rect key="frame" x="14" y="29" width="67" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Keywords:" id="Wfk-WB-BEW">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wJ2-bm-ZhO">
-                                        <rect key="frame" x="85" y="60" width="395" height="21"/>
+                                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wJ2-bm-ZhO">
+                                        <rect key="frame" x="85" y="62" width="397" height="21"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="nPj-Eh-Hsz">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SX3-7U-7ea">
-                                        <rect key="frame" x="85" y="24" width="395" height="21"/>
+                                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SX3-7U-7ea">
+                                        <rect key="frame" x="85" y="26" width="397" height="21"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="HXf-ig-qVm">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="621-mt-orF">
-                                        <rect key="frame" x="14" y="63" width="67" height="16"/>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="621-mt-orF">
+                                        <rect key="frame" x="14" y="65" width="67" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Subject:" id="oZ4-Yu-aS5">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -296,7 +296,7 @@ DQ
                                 <constraint firstAttribute="width" constant="492" id="kta-Mj-cgQ"/>
                             </constraints>
                         </box>
-                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aXy-qa-30P">
+                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aXy-qa-30P">
                             <rect key="frame" x="54" y="508" width="170" height="18"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="18" id="FeS-5P-ueR"/>
@@ -307,7 +307,7 @@ DQ
                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                             </textFieldCell>
                         </textField>
-                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bDa-JE-YYY">
+                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bDa-JE-YYY">
                             <rect key="frame" x="54" y="240" width="140" height="18"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="18" id="Exf-QJ-ne2"/>

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -1513,7 +1513,7 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
                 if pathExtension == "pdf" {
                     let pdf = CPDFDocument(url: url!)
                     if let data = pdf?.isEncrypted, data {
-                        self.view.window?.windowController?.knCheckPassword(url: url!, type: .owner, completion: { [weak self] success, resultPassword in
+                        self.view.window?.windowController?.showCheckPassword(url: url!, type: .owner, completion: { [weak self] success, resultPassword in
                             if success && resultPassword.isEmpty == false {
                                 pdf?.unlock(withPassword: resultPassword)
                                 self?.model.insertedDocumentSet.insert(pdf!)

+ 22 - 26
PDF Office/PDF Master/KMClass/Convert/Base/KMConvertBaseWindowController.swift

@@ -86,9 +86,29 @@ class KMConvertBaseWindowController: KMNBaseWindowController {
         pdfPreView?.reloadUI()
     }
     
-    override func initSubViews() {
-        super.initSubViews()
+    override func initContentView() {
+        super.initContentView()
         
+        canelBox.fillColor = .clear
+        cancelButton_?.keyEquivalent = KMKeyEquivalent.esc.string()
+        
+        convertBox.fillColor = .clear
+        convertButton_?.properties = ComponentButtonProperty(type: .primary,
+                                                          size: .s,
+                                                          state: .normal,
+                                                          isDisable: false,
+                                                          buttonText: KMLocalizedString("Convert"))
+        convertButton_?.setTarget(self, action: #selector(convertButtonAction))
+        convertButton_?.keyEquivalent = KMKeyEquivalent.enter
+        
+        rightScrollView.hasVerticalScroller = false
+        rightScrollView.hasHorizontalScroller = false
+        
+        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
+        
+        leftBox.borderWidth = 1
+        leftBox.cornerRadius = ComponentLibrary.shared.getComponentValueFromKey("radius/m") as? CGFloat ?? 0
+
         let view = initSettingView()
         settingView = view
         rightScrollView.documentView = view
@@ -148,30 +168,6 @@ class KMConvertBaseWindowController: KMNBaseWindowController {
         batchButton_?.autoresizingMask = [.width, .height]
     }
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
-        
-        canelBox.fillColor = .clear
-        cancelButton_?.keyEquivalent = KMKeyEquivalent.esc.string()
-        
-        convertBox.fillColor = .clear
-        convertButton_?.properties = ComponentButtonProperty(type: .primary,
-                                                          size: .s,
-                                                          state: .normal,
-                                                          isDisable: false,
-                                                          buttonText: KMLocalizedString("Convert"))
-        convertButton_?.setTarget(self, action: #selector(convertButtonAction))
-        convertButton_?.keyEquivalent = KMKeyEquivalent.enter
-        
-        rightScrollView.hasVerticalScroller = false
-        rightScrollView.hasHorizontalScroller = false
-        
-        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        
-        leftBox.borderWidth = 1
-        leftBox.cornerRadius = ComponentLibrary.shared.getComponentValueFromKey("radius/m") as? CGFloat ?? 0
-    }
-    
     func initSettingView() -> KMConvertSettingView? {
         let settingView = KMConvertSettingView.createFromNib()
         return settingView

+ 2 - 3
PDF Office/PDF Master/KMClass/Convert/Window/KMConvertCSVWindowController.swift

@@ -19,9 +19,8 @@ class KMConvertCSVWindowController: KMConvertBaseWindowController {
         }
     }
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
-        
+    override func initContentView() {
+        super.initContentView()
         self.titleLabel.stringValue = NSLocalizedString("PDF to CSV", comment: "")
     }
     

+ 3 - 8
PDF Office/PDF Master/KMClass/Convert/Window/KMConvertExcelWindowController.swift

@@ -14,15 +14,10 @@ class KMConvertExcelWindowController: KMConvertBaseWindowController {
         return KMPDFConvert.pathExtension(.excel)
     }
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
-        
+    override func initContentView() {
+        super.initContentView()
         self.titleLabel.stringValue = NSLocalizedString("PDF to Excel", comment: "")
-    }
-    
-    override func initSubViews() {
-        super.initSubViews()
-        
+
         self.setupContentHeight(height: 391+20)
     }
     

+ 2 - 2
PDF Office/PDF Master/KMClass/Convert/Window/KMConvertHtmlWindowController.swift

@@ -13,8 +13,8 @@ class KMConvertHtmlWindowController: KMConvertBaseWindowController {
         return KMPDFConvert.pathExtension(.html)
     }
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
+    override func initContentView() {
+        super.initContentView()
         
         self.titleLabel.stringValue = NSLocalizedString("PDF to HTML", comment: "")
     }

+ 2 - 2
PDF Office/PDF Master/KMClass/Convert/Window/KMConvertImageWindowController.swift

@@ -8,8 +8,8 @@
 // 转档 转图片 窗口
 class KMConvertImageWindowController: KMConvertBaseWindowController {
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
+    override func initContentView() {
+        super.initContentView()
         
         self.titleLabel.stringValue = NSLocalizedString("PDF to Image", comment: "")
     }

+ 2 - 2
PDF Office/PDF Master/KMClass/Convert/Window/KMConvertJsonWindowController.swift

@@ -12,8 +12,8 @@ class KMConvertJsonWindowController: KMConvertBaseWindowController {
         return KMPDFConvert.pathExtension(.json)
     }
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
+    override func initContentView() {
+        super.initContentView()
         
         self.titleLabel.stringValue = NSLocalizedString("PDF to Json", comment: "")
     }

+ 2 - 2
PDF Office/PDF Master/KMClass/Convert/Window/KMConvertPPTsWindowController.swift

@@ -25,8 +25,8 @@ class KMConvertPPTsWindowController: KMConvertBaseWindowController {
         return super.fileExtension
     }
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
+    override func initContentView() {
+        super.initContentView()
         
         if (self.subType == 1) {
             self.titleLabel.stringValue = NSLocalizedString("PDF to PPT", comment: "")

+ 2 - 2
PDF Office/PDF Master/KMClass/Convert/Window/KMConvertWordWindowController.swift

@@ -16,8 +16,8 @@ class KMConvertWordWindowController: KMConvertBaseWindowController {
         return KMPDFConvert.pathExtension(.word)
     }
     
-    override func initDefaultValue() {
-        super.initDefaultValue()
+    override func initContentView() {
+        super.initContentView()
         
         self.titleLabel.stringValue = NSLocalizedString("PDF to Word", comment: "")
     }

+ 8 - 8
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFInsert/KMNPDFInsertPDFWindowController.swift

@@ -410,16 +410,16 @@ class KMNPDFInsertPDFWindowController: KMNBaseWindowController {
                     let pdfDoc = CPDFDocument(url: fileURL)
                     if let data = pdfDoc?.isLocked, data {
                         DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
-                            KMNBaseWindowController.checkPassword(url: fileURL ?? NSURL.fileURL(withPath: ""), type: .owner) { result, pwd in
-                                if (pwd.isEmpty == false) {
-                                    self.insertDocument = CPDFDocument(url: fileURL)
-                                    if let data = self.insertDocument?.isLocked, data {
-                                        self.insertDocument?.unlock(withPassword: pwd)
+                            self.window?.windowController?.showCheckPassword(url: fileURL ?? NSURL.fileURL(withPath: ""), type: .owner, completion: { [weak self] success, resultPassword in
+                                if success && resultPassword.isEmpty == false {
+                                    self?.insertDocument = CPDFDocument(url: fileURL)
+                                    if let data = self?.insertDocument?.isLocked, data {
+                                        self?.insertDocument?.unlock(withPassword: resultPassword)
                                     }
-                                    self.insertFilePath = fileURL?.path
-                                    self.updateInsertPDF()
+                                    self?.insertFilePath = fileURL?.path
+                                    self?.updateInsertPDF()
                                 }
-                            }
+                            })
                         }
                     } else {
                         self.insertDocument = CPDFDocument(url: fileURL)

+ 255 - 25
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController+Action.swift

@@ -73,11 +73,11 @@ extension KMNThumbnailBaseViewController {
         if newSelectIndexs.isEmpty { return }
         
         let firstIndexPath = newSelectIndexs.first
-       collectionView.scrollToItems(at: [firstIndexPath ?? IndexPath(item: 0, section: 0)], scrollPosition: .top)
+        collectionView.scrollToItems(at: [firstIndexPath ?? IndexPath(item: 0, section: 0)], scrollPosition: .top)
     }
     
     public func insertFormPages(insertPages: [CPDFPage],pageDex:Int) {
-        var pageIndexDex: Int = pageDex
+        let pageIndexDex: Int = pageDex
         var indexpaths = Set<IndexPath>()
         
         let page = insertPages.first
@@ -131,7 +131,7 @@ extension KMNThumbnailBaseViewController {
         }
         return isSuccessFul
     }
-
+    
     public func rotatePages(indexPaths: Set<IndexPath>, rotateAngle: Int) {
         var tIndexPaths: Set<IndexPath> = []
         tIndexPaths = indexPaths
@@ -197,7 +197,7 @@ extension KMNThumbnailBaseViewController {
         var index = targetIndexpaths.sorted().first!.item
         var tIndexPaths: Set<IndexPath> = []
         
-        var indexSet = KMNTools.indexpathsToIndexs(indexpaths: targetIndexpaths)
+        let indexSet = KMNTools.indexpathsToIndexs(indexpaths: targetIndexpaths)
         
         showDocument?.removePage(at: indexSet)
         
@@ -221,7 +221,6 @@ extension KMNThumbnailBaseViewController {
         var deletePages:[CPDFPage] = []
         
         for targetIndexPath in indexpaths {
-            let dex = targetIndexPath.item
             deletePages.append(showDocument?.page(at: UInt(targetIndexPath.item)) ?? CPDFPage())
             changeIndex.insert(targetIndexPath.item)
         }
@@ -229,7 +228,7 @@ extension KMNThumbnailBaseViewController {
         refreshDatas()
         collectionView.reloadData()
     }
-        
+    
     public func movePages(pages:[CPDFPage],destinationDex:Int) {
         var destinationIndex = destinationDex
         
@@ -267,7 +266,7 @@ extension KMNThumbnailBaseViewController {
         let pathExtension = URL(fileURLWithPath: path).pathExtension.lowercased()
         if pathExtension == "pdf", let pdf = CPDFDocument(url: URL(fileURLWithPath: path)) {
             if pdf.isLocked {
-                KMNBaseWindowController.checkPassword(url: pdf.documentURL, type: .owner) { success, resultPassword in
+                self.view.window?.windowController?.showCheckPassword(url: pdf.documentURL, type: .owner) { success, resultPassword in
                     if (resultPassword.isEmpty == false) {
                         pdf.unlock(withPassword: resultPassword)
                         
@@ -449,7 +448,7 @@ extension KMNThumbnailBaseViewController {
             return
         }
         KMNThumbnailManager.manager.copyPages = []
-
+        
         let indexpaths = collectionView.selectionIndexPaths
         for indexpath in indexpaths.sorted() {
             guard let page = showDocument?.page(at: UInt(indexpath.item)).copy() as? CPDFPage else {
@@ -518,10 +517,10 @@ extension KMNThumbnailBaseViewController {
             }
         }
         let copyPages = KMNThumbnailManager.manager.copyPages
-
+        
         insertFormPages(insertPages: copyPages, pageDex: pastIndex)
     }
-
+    
     @objc public func cutMenuItemAciton() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
             let winC = KMPurchaseCompareWindowController.sharedInstance()
@@ -538,7 +537,7 @@ extension KMNThumbnailBaseViewController {
             KMNThumbnailManager.manager.copyDocument.append(showDocument ?? CPDFDocument())
             KMNThumbnailManager.manager.copyPages.append(page)
         }
-
+        
         deletePages(indexpaths: indexpaths)
     }
     
@@ -559,7 +558,7 @@ extension KMNThumbnailBaseViewController {
             return
         }
         let indexpaths = collectionView.selectionIndexPaths
-
+        
         let doucument = showDocument
         let filename : String = doucument?.documentURL.lastPathComponent ?? ""
         let folderPath = (NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.applicationSupportDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last?.stringByAppendingPathComponent(filename)) ?? ""
@@ -575,7 +574,7 @@ extension KMNThumbnailBaseViewController {
             represent?.perform(withItems: [url])
         }
     }
-
+    
     @objc public func displayPageSizeAction() {
         let indexpaths = collectionView.selectionIndexPaths
         isShowPageSize = !isShowPageSize
@@ -623,7 +622,7 @@ extension KMNThumbnailBaseViewController {
             if updateIndexPaths.isEmpty { return }
             let firstIndexPath = updateIndexPaths.first
             collectionView.scrollToItems(at: [firstIndexPath ?? IndexPath(item: 0, section: 0)], scrollPosition: .top)
-
+            
             collectionView.selectionIndexPaths = updateIndexPaths
         }
     }
@@ -650,7 +649,7 @@ extension KMNThumbnailBaseViewController {
                     let pdfDoc = CPDFDocument(url: fileURL)
                     if let data = pdfDoc?.isLocked, data {
                         DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
-                            KMNBaseWindowController.checkPassword(url: fileURL ?? NSURL.fileURL(withPath: ""), type: .owner) { result, pwd in
+                            self?.view.window?.windowController?.showCheckPassword(url: fileURL ?? NSURL.fileURL(withPath: ""), type: .owner) { result, pwd in
                                 if (pwd.isEmpty == false) {
                                     self?.insertFilePath(filePath: fileURL?.path ?? "", pdfPassword: pwd)
                                 }
@@ -673,7 +672,7 @@ extension KMNThumbnailBaseViewController {
         }
         
         let selectedIndexPaths = collectionView.selectionIndexPaths
-
+        
         let insertPDF = KMNPDFInsertBlankWindowController(self.showDocument, selectionIndexPaths: selectedIndexPaths)
         insertPDF.callback = { [weak self] pageSize, insertIdx in
             self?.insertBlankSize(pageSize: pageSize, pageDex: insertIdx)
@@ -717,7 +716,7 @@ extension KMNThumbnailBaseViewController {
         
         let selectedIndexPaths = collectionView.selectionIndexPaths
         let maxmumIndexPath = selectedIndexPaths.max(by: { $0 < $1 })
-
+        
         let vc = KMDeviceBrowserWindowController.shared
         vc.type = .scanner
         vc.importScannerFileCallback = { [weak self] (url: NSURL) -> Void in
@@ -728,7 +727,7 @@ extension KMNThumbnailBaseViewController {
                 self?.refreshDatas()
                 
                 let ips: Set<IndexPath> = [IndexPath(item: index, section: 0)]
-
+                
                 self?.collectionView.selectionIndexPaths = ips
                 self?.collectionView.scrollToItems(at: ips, scrollPosition: .centeredVertically)
             }
@@ -753,20 +752,20 @@ extension KMNThumbnailBaseViewController {
     public func redoPDFAction() {
         currentUndoManager?.redo()
     }
-        
+    
     @objc public func extractPDFAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
             KMPurchaseCompareWindowController.sharedInstance()?.showWindow(nil)
             return
         }
-
+        
         let selectedIndexPaths = collectionView.selectionIndexPaths
-
+        
         if selectedIndexPaths.count < 1 {
             _ = KMNCustomAlertView.alertView(message: KMLocalizedString("Please select one or more pages first to organize."), type: .info, fromView: self.view, point:CGPointMake(self.view.frame.origin.x + self.view.frame.size.width/2, self.view.bounds.size.height - 30))
             return
         }
-                
+        
         let extractPDF = KMNExtractPDFWindowController(self.showDocument, selectionIndexPaths: collectionView.selectionIndexPaths)
         extractPDF.callback = { [weak self] oneDocumentPerPage, isDeletePage in
             extractPDF.own_closeEndSheet()
@@ -808,7 +807,7 @@ extension KMNThumbnailBaseViewController {
                 if (tFileUrl!.path.isPDFValid() == false) {
                     let alert = NSAlert()
                     alert.alertStyle = .critical
-                    alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                    alert.messageText = KMLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.")
                     alert.runModal()
                 }
             }
@@ -881,17 +880,248 @@ extension KMNThumbnailBaseViewController {
         }
         
         let selectedIndexPaths = collectionView.selectionIndexPaths
-
+        
         if selectedIndexPaths.count < 1 {
             _ = KMNCustomAlertView.alertView(message: KMLocalizedString("Please select one or more pages first to organize."), type: .info, fromView: self.view, point:CGPointMake(self.view.frame.origin.x + self.view.frame.size.width/2, self.view.bounds.size.height - 30))
             return
         } else if selectedIndexPaths.count == (showDocument?.pageCount ?? 0) {
             _ = KMNCustomAlertView.alertView(message: KMLocalizedString("Can not delete all pages."), type: .info, fromView: self.view, point:CGPointMake(self.view.frame.origin.x + self.view.frame.size.width/2, self.view.bounds.size.height - 30))
             return
-
+            
         }
         
         deletePages(indexpaths: selectedIndexPaths)
     }
     
+    // MARK: - private
+    private func fetchProgressBlockParamsIsPasswordFile(params: Any...) -> Bool {
+        if (params.count <= 2) {
+            return false
+        }
+        return true
+    }
+    
+    private func fetchProgressBlockParamsForFileUrl(params: Any...) -> URL? {
+        if (params.count < 2) {
+            return nil
+        }
+        return params[1] as? URL
+    }
+    
+    private func km_open_file_multi(type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
+        NSPanel.km_open_multi_success(self.view.window!) { panel in
+            var array: [String] = []
+            for fileType in KMConvertPDFManager.supportFileType() {
+                array.append(fileType)
+            }
+            panel.allowedFileTypes = KMNConvertTool.pdfExtensions + array
+        } completion: { urls in
+            self.km_add_file_multi(fileUrls: urls, type: type, progressBlock: progressBlock, completionBlock: completionBlock)
+        }
+    }
+    
+    private func km_add_file_multi(fileUrls: [URL] ,type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
+        var pdfUrls: [URL] = []
+        var imageUrls: [URL] = []
+        var officeUrls: [URL] = []
+        for url in fileUrls {
+            let type = url.pathExtension.lowercased()
+            if (KMNConvertTool.isPDFType(type)) {
+                pdfUrls.append(url)
+            }
+            if (KMNConvertTool.isImageType(type)) {
+                imageUrls.append(url)
+            }
+            if (KMNConvertTool.isOfficeType(type)) {
+                officeUrls.append(url)
+            }
+        }
+        
+        if (officeUrls.count == 0) {
+            self.km_add_pdf_multi(fileUrls: pdfUrls, type: type, progressBlock: progressBlock) { documents in
+                var index = documents.count
+                var _documents: [CPDFDocument] = []
+                for imageUrl in imageUrls {
+                    index += 1
+                    let document = CPDFDocument()
+                    let image = NSImage(contentsOfFile: imageUrl.path)
+                    let _ = document?.km_insertPage(image?.size ?? .zero, withImage: imageUrl.path, at: 0)
+                    _documents.append(document!)
+                    
+                    if let _callback = progressBlock { // 回调进度
+                        _callback(index, document as Any, imageUrl)
+                    }
+                }
+                
+                completionBlock(documents + _documents)
+            }
+            return
+        }
+        
+        self.km_add_office_multi(fileUrls: officeUrls) { [unowned self] fileUrlStrings in
+            var officeDocuments: [CPDFDocument] = []
+            var index = 0
+            for fileUrlString in fileUrlStrings {
+                index += 1
+                let document = CPDFDocument(url: URL(fileURLWithPath: fileUrlString))
+                officeDocuments.append(document!)
+                
+                if let _callback = progressBlock { // 回调进度
+                    _callback(index, document as Any, URL(fileURLWithPath: fileUrlString))
+                }
+            }
+            
+            self.km_add_pdf_multi(fileUrls: pdfUrls) { documents in
+                var index = documents.count + officeDocuments.count
+                var _documents: [CPDFDocument] = []
+                for imageUrl in imageUrls {
+                    index += 1
+                    let document = CPDFDocument()
+                    let image = NSImage(contentsOfFile: imageUrl.path)
+                  let _ = document?.km_insertPage(image!.size, withImage: imageUrl.path, at: 0)
+                    _documents.append(document!)
+                    
+                    if let _callback = progressBlock { // 回调进度
+                        _callback(index, document as Any, imageUrl)
+                    }
+                }
+                
+                completionBlock(officeDocuments + documents + _documents)
+            }
+        }
+    }
+    
+    private func km_add_pdf_multi(fileUrls: [URL] ,type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
+        var results: [CPDFDocument] = []
+        
+        self.lockedFiles.removeAll()
+        var index = 0
+        for url in fileUrls {
+            let document = CPDFDocument(url: url)
+            if (document!.isLocked) {
+                self.lockedFiles.append(url)
+                continue
+            }
+            
+            if let _document = document {
+                results.append(_document)
+            }
+            
+            index += 1
+            if let _callback = progressBlock {
+                _callback(index, ((document != nil) ? document : CPDFDocument()) as Any, url)
+            }
+        }
+        
+        if (self.lockedFiles.count == 0) {
+            completionBlock(results)
+            return
+        }
+        
+        self._openPasswordWindow_loop(fileUrl: self.lockedFiles.first!, type: type) { params in
+            index += 1
+            if (params.count <= 2) { // 参数错误
+                if let _callback = progressBlock { // 回调进度
+                    _callback(index)
+                }
+                return
+            }
+            
+            let fileUrl     = params[0] as! URL
+            let result      = params[1] as! KMPasswordInputWindowResult
+            let password    = params[2] as? String
+            if (result == .cancel) {
+                if let _callback = progressBlock { // 回调进度
+                    _callback(index, CPDFDocument() as Any, fileUrl, result)
+                }
+                return
+            }
+            
+            let document = CPDFDocument(url: fileUrl)
+            if let _password = password { // 将文档进行解密
+                document?.unlock(withPassword: _password)
+            }
+            if let _callback = progressBlock { // 回调进度
+                _callback(index, document as Any, fileUrl, result, password as Any)
+            }
+            // 将文档加入返回数据
+            if let _document = document {
+                results.append(_document)
+            }
+        } completionBlock: {
+            completionBlock(results)
+        }
+    }
+    
+    private func km_add_office_multi(fileUrls: [URL], completionBlock:@escaping ([String])->Void) -> Void {
+        var fileUrlStrings: [String] = []
+        
+        let dispatchGroup = Dispatch.DispatchGroup()
+        for (index, fileUrl) in fileUrls.enumerated() {
+            let filePath = fileUrl.path
+            let folderPath = "convertToPDF_\(index).pdf"
+            let savePath: String? = folderPath.kUrlToPDFFolderPath() as String
+            if (savePath == nil) {
+                continue
+            }
+            
+            dispatchGroup.enter()
+            KMConvertPDFManager.convertFile(filePath, savePath: savePath!) { success, errorDic in
+                if errorDic != nil || !success || !FileManager.default.fileExists(atPath: savePath!) {
+                    dispatchGroup.leave()
+                    
+                    if FileManager.default.fileExists(atPath: savePath!) {
+                        try?FileManager.default.removeItem(atPath: savePath!)
+                    }
+                    let alert = NSAlert.init()
+                    alert.alertStyle = .critical
+                    var infoString = ""
+                    if errorDic != nil {
+                        for key in (errorDic! as Dictionary).keys {
+                            infoString = infoString.appendingFormat("%@\n", errorDic![key] as! CVarArg)
+                        }
+                    }
+                    alert.informativeText = KMLocalizedString("Please install Microsoft Office to create PDFs from Office files")
+                    alert.messageText = KMLocalizedString("Failed to Create PDF", comment: "")
+                    alert.addButton(withTitle: KMLocalizedString("OK"))
+                    alert.runModal()
+                    return
+                }
+                
+                if !savePath!.isPDFValid() {
+                    dispatchGroup.leave()
+                    
+                    let alert = NSAlert()
+                    alert.alertStyle = .critical
+                    alert.messageText = KMLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.")
+                    alert.runModal()
+                    return
+                }
+                
+                fileUrlStrings.append(savePath!)
+                dispatchGroup.leave()
+            }
+        }
+        
+        dispatchGroup.notify(queue: DispatchQueue.main) {
+            completionBlock(fileUrlStrings)
+        }
+    }
+    
+    fileprivate func _openPasswordWindow_loop(fileUrl: URL, type: KMPasswordInputWindowType, progressBlock: ((_ params: Any...)->Void)?, completionBlock:@escaping ()->Void) {
+        KMPasswordInputWindow.openWindow(window: self.view.window!, type: type, url: fileUrl) { [weak self] result, password in
+            // 将结果返回
+            if let _callback = progressBlock {
+                _callback(fileUrl, result, password as Any)
+            }
+            
+            // 进行下一个
+            self?.lockedFiles.removeFirst()
+            if let _fileUrl = self?.lockedFiles.first {
+                self?._openPasswordWindow_loop(fileUrl: _fileUrl, type: type, progressBlock: progressBlock, completionBlock: completionBlock)
+            } else {
+                completionBlock()
+            }
+        }
+    }
 }

+ 31 - 0
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift

@@ -43,6 +43,8 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
         
     private var currentDocument:CPDFDocument?
     private var isChangeIndexPaths = false
+    var lockedFiles: [URL] = []
+
     internal var dragedIndexPaths: [IndexPath] = []
     
     public var thumbnails:[KMNThumbnail] = []
@@ -529,3 +531,32 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
         dragLocalityPages = []
     }
 }
+
+// MARK: - NSFilePromiseProviderDelegate
+//extension KMNThumbnailBaseViewController: NSFilePromiseProviderDelegate {
+//    func filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL, completionHandler: @escaping (Error?) -> Void) {
+//        
+//    }
+//    
+//    func filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL) async throws {
+//        
+//    }
+//    
+//    func filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, fileNameForType fileType: String) -> String {
+//        var fileName: String = "Untitle"
+//        if let _string = showDocument?.documentURL.deletingPathExtension().lastPathComponent {
+//            fileName = _string
+//        }
+//        fileName.append(" pages")
+//        var indexs = IndexSet()
+//        for indexpath in self.dragedIndexPaths {
+//            indexs.insert(indexpath.item)
+//        }
+//        fileName.append(" ")
+//        fileName.append(KMPageRangeTools.newParseSelectedIndexs(selectedIndex: indexs.sorted()))
+//        fileName.append(".pdf")
+//        
+//        return fileName
+//    }
+//    
+//}

+ 9 - 9
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.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" customObjectInstantitationMethod="direct">
+<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="22505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -62,27 +62,27 @@
                                                 <constraint firstAttribute="width" constant="44" id="d0h-VA-7VV"/>
                                             </constraints>
                                         </box>
-                                        <splitView dividerStyle="paneSplitter" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0yW-dC-XWa" customClass="KMPDFSplitView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <splitView dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0yW-dC-XWa" customClass="KMPDFSplitView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                             <rect key="frame" x="44" y="0.0" width="762" height="361"/>
                                             <subviews>
                                                 <customView fixedFrame="YES" id="Rjd-la-yXL">
-                                                    <rect key="frame" x="0.0" y="0.0" width="245" height="361"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="251" height="361"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                                 </customView>
                                                 <customView fixedFrame="YES" id="bRZ-TQ-QhI">
-                                                    <rect key="frame" x="255" y="0.0" width="249" height="361"/>
+                                                    <rect key="frame" x="252" y="0.0" width="255" height="361"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
                                                     <subviews>
                                                         <splitView fixedFrame="YES" arrangesAllSubviews="NO" dividerStyle="paneSplitter" translatesAutoresizingMaskIntoConstraints="NO" id="hf2-wd-3w7">
-                                                            <rect key="frame" x="0.0" y="0.0" width="249" height="361"/>
+                                                            <rect key="frame" x="0.0" y="0.0" width="255" height="361"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <subviews>
                                                                 <customView fixedFrame="YES" id="imw-ZH-2FU">
-                                                                    <rect key="frame" x="0.0" y="0.0" width="249" height="171"/>
+                                                                    <rect key="frame" x="0.0" y="0.0" width="255" height="171"/>
                                                                     <autoresizingMask key="autoresizingMask"/>
                                                                 </customView>
                                                                 <customView fixedFrame="YES" id="ySe-re-pP1">
-                                                                    <rect key="frame" x="0.0" y="181" width="249" height="180"/>
+                                                                    <rect key="frame" x="0.0" y="181" width="255" height="180"/>
                                                                     <autoresizingMask key="autoresizingMask"/>
                                                                 </customView>
                                                             </subviews>
@@ -94,7 +94,7 @@
                                                     </subviews>
                                                 </customView>
                                                 <customView fixedFrame="YES" id="MYm-xb-CGc">
-                                                    <rect key="frame" x="514" y="0.0" width="248" height="361"/>
+                                                    <rect key="frame" x="508" y="0.0" width="254" height="361"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
                                                 </customView>
                                             </subviews>

+ 1 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/KMNDisplayViewController/KMNDisplayViewController.swift

@@ -587,7 +587,7 @@ class KMNDisplayViewController: NSViewController {
                 let pdfDoc = CPDFDocument(url: fileURL)
                 if let data = pdfDoc?.isLocked, data {
                     DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
-                        KMNBaseWindowController.checkPassword(url: fileURL ?? NSURL.fileURL(withPath: ""), type: .owner) { result, pwd in
+                        self?.view.window?.windowController?.showCheckPassword(url: fileURL ?? NSURL.fileURL(withPath: ""), type: .owner) { result, pwd in
                             if (pwd.isEmpty == false) {
                                 
                             }

+ 1 - 1
PDF Office/PDF Master/KMClass/Left/KMNLeftSideViewController.swift

@@ -32,7 +32,7 @@ class KMNLeftSideViewController: KMNBaseViewController {
     
     lazy var thumbnailHeaderViewController: KMNThumnailHeaderViewController = {
         let controller = KMNThumnailHeaderViewController(nibName: "KMNThumnailHeaderViewController", bundle: nil)
-        controller.view.bounds = headerBox.bounds
+        controller.view.frame = headerBox.bounds
         controller.view.autoresizingMask = [.width, .height] // Use flexible for better resizing
         return controller
     }()

+ 2 - 2
PDF Office/PDF Master/KMClass/Left/KMNLeftSideViewController.xib

@@ -26,10 +26,10 @@
                         <rect key="frame" x="0.0" y="0.0" width="337" height="549"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="bvR-aB-khj">
+                            <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="bvR-aB-khj">
                                 <rect key="frame" x="0.0" y="509" width="337" height="40"/>
                                 <view key="contentView" id="8gD-Vi-mE5">
-                                    <rect key="frame" x="1" y="1" width="335" height="38"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="337" height="40"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 </view>
                                 <constraints>

+ 18 - 0
PDF Office/PDF Master/KMClass/Left/ThumnailView/KMNThumnailHeaderViewController.xib

@@ -26,11 +26,29 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="fhq-cP-7X0" customClass="ComponentDivider" customModule="KMComponentLibrary">
+                    <rect key="frame" x="0.0" y="250" width="164" height="1"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="1" id="Z9U-LZ-aAE"/>
+                    </constraints>
+                </customView>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="acY-kE-OyK" customClass="ComponentDivider" customModule="KMComponentLibrary">
+                    <rect key="frame" x="0.0" y="0.0" width="164" height="1"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="1" id="uFr-Oa-H2x"/>
+                    </constraints>
+                </customView>
             </subviews>
             <constraints>
+                <constraint firstItem="fhq-cP-7X0" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="13a-vI-VIU"/>
                 <constraint firstItem="ifx-E2-DEP" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="7CK-Ma-z0f"/>
+                <constraint firstAttribute="trailing" secondItem="fhq-cP-7X0" secondAttribute="trailing" id="M6j-fx-PgF"/>
                 <constraint firstItem="ifx-E2-DEP" firstAttribute="centerY" secondItem="Hz6-mo-xeY" secondAttribute="centerY" id="N4v-sC-oWr"/>
+                <constraint firstAttribute="bottom" secondItem="acY-kE-OyK" secondAttribute="bottom" id="Xuy-Ww-4Wf"/>
+                <constraint firstAttribute="trailing" secondItem="acY-kE-OyK" secondAttribute="trailing" id="bqO-pU-XcW"/>
+                <constraint firstItem="fhq-cP-7X0" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="h33-j3-cld"/>
                 <constraint firstAttribute="trailing" secondItem="ifx-E2-DEP" secondAttribute="trailing" id="hA7-o8-xR6"/>
+                <constraint firstItem="acY-kE-OyK" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="ph6-ej-ufU"/>
             </constraints>
             <point key="canvasLocation" x="39" y="111.5"/>
         </customView>

+ 25 - 41
PDF Office/PDF Master/Class/PDFTools/Tools/KMBaseXibView/BaseXibView.swift

@@ -10,33 +10,51 @@ import AppKit
 
 @objcMembers
 public class BaseXibView: NSView {
-
-    @IBOutlet var contentView: NSView!
     
-//    private var area : NSTrackingArea?
+    @IBOutlet var contentView: NSView!
     
+    deinit {
+        KMPrint(self.className + " deinit.")
+        
+        self.removeNotifations()
+    }
     
     // MARK: 初始化
     public required init?(coder decoder: NSCoder) {
         super.init(coder: decoder)
-        self.initContentView()
- 
         
+        initContentView()
+        addNotifations()
     }
     
     override init(frame frameRect: NSRect) {
         super.init(frame: frameRect)
-        self.initContentView()
+        initContentView()
+        addNotifations()
+    }
     
+    private func addNotifations() {
+        updateUIThemeColor()
+        NotificationCenter.default.addObserver(self, selector: #selector(updateUIThemeColor), name: APPAppearanceChangedNotificationName, object: nil)
         
+        updateUILanguage()
+        NotificationCenter.default.addObserver(self, selector: #selector(updateUILanguage), name: APPLanguageChangedNotificationName, object: nil)
     }
     
+    private func removeNotifations() {
+        NotificationCenter.default.removeObserver(self)
+    }
+    
+    @objc func updateUIThemeColor() {}
+    
+    @objc func updateUILanguage() {}
+    
     private func initContentView() {
         let isExist = Bundle.main.path(forResource: String(describing:self.classForCoder.self), ofType: "nib")
         if isExist != nil {
             var topLevelArray: NSArray? = nil
             let resource = NSNib(nibNamed: String(describing:self.classForCoder.self), bundle: Bundle(for: self.classForCoder.self))
- 
+            
             if resource != nil {
                 if (resource!.instantiate(withOwner: self, topLevelObjects: &topLevelArray)) {
                     for view in topLevelArray! {
@@ -61,38 +79,4 @@ public class BaseXibView: NSView {
             }
         }
     }
-    
-//    public override func updateTrackingAreas() {
-//        super.updateTrackingAreas()
-//
-//        if let _area = area, _area.rect.isEmpty == false {
-//            if (_area.rect.equalTo(bounds)) {
-//                return
-//            }
-//        }
-//        
-//        if (area != nil) {
-//            removeTrackingArea(area!)
-//            area = nil
-//        }
-//        
-//        area = NSTrackingArea(rect: bounds, options: [.mouseEnteredAndExited, .mouseMoved, .activeAlways], owner: self)
-//        self.addTrackingArea(area!)
-//    }
-//    
-//    public override func mouseEntered(with event: NSEvent) {
-//        super.mouseEntered(with: event)
-//        
-//    }
-//    
-//    public override func mouseMoved(with event: NSEvent) {
-//        super.mouseMoved(with: event)
-//        
-//    }
-//    
-//    public override func mouseExited(with event: NSEvent) {
-//        super.mouseExited(with: event)
-//        
-//    }
-    
 }

+ 12 - 448
PDF Office/PDF Master/KMClass/Tools/Base/KMNBaseViewController.swift

@@ -7,473 +7,37 @@
 
 import Cocoa
 
-// 基类 [抽象类]
 class KMNBaseViewController: NSViewController {
-    // 是否需要菜单
-    var needMenu = false {
-        didSet {
-            if (self.needMenu) {
-                self.addMenu(to: self.view)
-            } else {
-                self.removeMenu(to: self.view)
-            }
-        }
-    }
     
     deinit {
         KMPrint(self.className + " deinit.")
-
+        
         self.removeNotifations()
     }
-
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         
-        if (self.needMenu) {
-            self.addMenu(to: self.view)
-        } else {
-            self.removeMenu(to: self.view)
-        }
-        
         self.addNotifations()
     }
     
-    func updateUIThemeColor() {}
-    
     // Noti
-    
-    func addNotifations() { }
-    
-    func removeNotifations() {
-        NotificationCenter.default.removeObserver(self)
-    }
-    
-    func km_add_office_multi(fileUrls: [URL], completionBlock:@escaping ([String])->Void) -> Void {
-        var fileUrlStrings: [String] = []
-        
-        let dispatchGroup = Dispatch.DispatchGroup()
-        for (index, fileUrl) in fileUrls.enumerated() {
-            let filePath = fileUrl.path
-            let folderPath = "convertToPDF_\(index).pdf"
-            let savePath: String? = folderPath.kUrlToPDFFolderPath() as String
-            if (savePath == nil) {
-                continue
-            }
-            
-            dispatchGroup.enter()
-            KMConvertPDFManager.convertFile(filePath, savePath: savePath!) { success, errorDic in
-                if errorDic != nil || !success || !FileManager.default.fileExists(atPath: savePath!) {
-                    dispatchGroup.leave()
-                    
-                    if FileManager.default.fileExists(atPath: savePath!) {
-                        try?FileManager.default.removeItem(atPath: savePath!)
-                    }
-                    let alert = NSAlert.init()
-                    alert.alertStyle = .critical
-                    var infoString = ""
-                    if errorDic != nil {
-                        for key in (errorDic! as Dictionary).keys {
-                            infoString = infoString.appendingFormat("%@\n", errorDic![key] as! CVarArg)
-                        }
-                    }
-                    alert.informativeText = NSLocalizedString("Please install Microsoft Office to create PDFs from Office files", comment: "")
-                    alert.messageText = NSLocalizedString("Failed to Create PDF", comment: "")
-                    alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
-                    alert.runModal()
-                    return
-                }
-                
-                if !savePath!.isPDFValid() {
-                    dispatchGroup.leave()
-                    
-                    let alert = NSAlert()
-                    alert.alertStyle = .critical
-                    alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
-                    alert.runModal()
-                    return
-                }
-                
-                fileUrlStrings.append(savePath!)
-                dispatchGroup.leave()
-            }
-        }
-        
-        dispatchGroup.notify(queue: DispatchQueue.main) {
-            completionBlock(fileUrlStrings)
-        }
-    }
-    
-    // MARK: - Open Password Files
-    
-    private var lockedFiles: [URL] = []
-    func km_open_pdf_multi(type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
-        NSPanel.km_open_pdf_multi_success(self.view.window!, panel: nil) { urls in
-            self.km_add_pdf_multi(fileUrls: urls, type: type, progressBlock: progressBlock, completionBlock: completionBlock)
-        }
-    }
-    
-    func km_open_file_multi(type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
-        NSPanel.km_open_multi_success(self.view.window!) { panel in
-            var array: [String] = []
-            for fileType in KMConvertPDFManager.supportFileType() {
-                array.append(fileType)
-            }
-            panel.allowedFileTypes = KMTools.pdfExtensions + array
-        } completion: { urls in
-            self.km_add_file_multi(fileUrls: urls, type: type, progressBlock: progressBlock, completionBlock: completionBlock)
-        }
-    }
-    
-    func km_add_pdf_multi(fileUrlStrings: [String] ,type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
-        var urls: [URL] = []
-        for string in fileUrlStrings {
-            urls.append(URL(fileURLWithPath: string))
-        }
-        self.km_add_pdf_multi(fileUrls: urls, type: type, progressBlock: progressBlock, completionBlock: completionBlock)
-    }
-    
-    func km_add_pdf_multi(fileUrls: [URL] ,type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
-        var results: [CPDFDocument] = []
-        
-        self.lockedFiles.removeAll()
-        var index = 0
-        for url in fileUrls {
-            let document = CPDFDocument(url: url)
-            if (document!.isLocked) {
-                self.lockedFiles.append(url)
-                continue
-            }
-            
-            if let _document = document {
-                results.append(_document)
-            }
-            
-            index += 1
-            if let _callback = progressBlock {
-                _callback(index, ((document != nil) ? document : CPDFDocument()) as Any, url)
-            }
-        }
-        
-        if (self.lockedFiles.count == 0) {
-            completionBlock(results)
-            return
-        }
-        
-//        if let _callback = progressBlock {
-//            _callback(0, results)
-//        }
-        
-        self._openPasswordWindow_loop(fileUrl: self.lockedFiles.first!, type: type) { params in
-            index += 1
-            if (params.count <= 2) { // 参数错误
-                if let _callback = progressBlock { // 回调进度
-                    _callback(index)
-                }
-                return
-            }
-            
-            let fileUrl     = params[0] as! URL
-            let result      = params[1] as! KMPasswordInputWindowResult
-            let password    = params[2] as? String
-            if (result == .cancel) {
-                if let _callback = progressBlock { // 回调进度
-                    _callback(index, CPDFDocument() as Any, fileUrl, result)
-                }
-                return
-            }
-            
-            let document = CPDFDocument(url: fileUrl)
-            if let _password = password { // 将文档进行解密
-                document?.unlock(withPassword: _password)
-            }
-            if let _callback = progressBlock { // 回调进度
-                _callback(index, document as Any, fileUrl, result, password as Any)
-            }
-            // 将文档加入返回数据
-            if let _document = document {
-                results.append(_document)
-            }
-        } completionBlock: {
-            completionBlock(results)
-        }
-    }
-    
-    func km_add_file_multi(fileUrls: [URL] ,type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
-            var pdfUrls: [URL] = []
-            var imageUrls: [URL] = []
-            var officeUrls: [URL] = []
-            for url in fileUrls {
-                let type = url.pathExtension.lowercased()
-                if (KMTools.isPDFType(type)) {
-                    pdfUrls.append(url)
-                }
-                if (KMTools.isImageType(type)) {
-                    imageUrls.append(url)
-                }
-                if (KMTools.isOfficeType(type)) {
-                    officeUrls.append(url)
-                }
-            }
-            
-            if (officeUrls.count == 0) {
-                self.km_add_pdf_multi(fileUrls: pdfUrls, type: type, progressBlock: progressBlock) { documents in
-                    var index = documents.count
-                    var _documents: [CPDFDocument] = []
-                    for imageUrl in imageUrls {
-                        index += 1
-                        let document = CPDFDocument()
-                        let image = NSImage(contentsOfFile: imageUrl.path)
-//                        document?.insertPage(image!.size, withImage: imageUrl.path, at: 0)
-                        document?.km_insertPage(image?.size ?? .zero, withImage: imageUrl.path, at: 0)
-                        _documents.append(document!)
-                        
-                        if let _callback = progressBlock { // 回调进度
-                            _callback(index, document as Any, imageUrl)
-                        }
-                    }
-                    
-                    completionBlock(documents + _documents)
-                }
-                return
-            }
-            
-            self.km_add_office_multi(fileUrls: officeUrls) { [unowned self] fileUrlStrings in
-                var officeDocuments: [CPDFDocument] = []
-                var index = 0
-                for fileUrlString in fileUrlStrings {
-                    index += 1
-                    let document = CPDFDocument(url: URL(fileURLWithPath: fileUrlString))
-                    officeDocuments.append(document!)
-                    
-                    if let _callback = progressBlock { // 回调进度
-                        _callback(index, document as Any, URL(fileURLWithPath: fileUrlString))
-                    }
-                }
-                
-                self.km_add_pdf_multi(fileUrls: pdfUrls) { documents in
-                    var index = documents.count + officeDocuments.count
-                    var _documents: [CPDFDocument] = []
-                    for imageUrl in imageUrls {
-                        index += 1
-                        let document = CPDFDocument()
-                        let image = NSImage(contentsOfFile: imageUrl.path)
-//                        document?.insertPage(image!.size, withImage: imageUrl.path, at: 0)
-                        document?.km_insertPage(image!.size, withImage: imageUrl.path, at: 0)
-                        _documents.append(document!)
-                        
-                        if let _callback = progressBlock { // 回调进度
-                            _callback(index, document as Any, imageUrl)
-                        }
-                    }
-
-                    completionBlock(officeDocuments + documents + _documents)
-                }
-            }
-    }
-    
-    // MARK: - ProgressBlock Params Fetch
-    
-    func fetchProgressBlockParamsForDocument(params: Any...) -> CPDFDocument? {
-        return params.first as? CPDFDocument
-    }
-    func fetchProgressBlockParamsForFileUrl(params: Any...) -> URL? {
-        if (params.count < 2) {
-            return nil
-        }
-        return params[1] as? URL
-    }
-    
-    func fetchProgressBlockParamsForResult(params: Any...) -> KMPasswordInputWindowResult? {
-        if (params.count <= 2) {
-            return nil
-        }
-        return params[2] as? KMPasswordInputWindowResult
-    }
-    func fetchProgressBlockParamsForPassword(params: Any...) -> String? {
-        if (params.count <= 2) {
-            return nil
-        }
-        return params.last as? String
-    }
-    func fetchProgressBlockParamsIsPasswordFile(params: Any...) -> Bool {
-        if (params.count <= 2) {
-            return false
-        }
-        return true
-    }
-    
-    // MARK: - Open Password Window
-    // 留意:
-    // -会直接弹密码弹窗,不会判断文档是否加密
-    // -在使用前最好判断下文件是否已加密
-    
-    func openPasswordWindow(fileUrlString: String, type: KMPasswordInputWindowType = .open, completionBlock:@escaping (KMPasswordInputWindowResult, String?)->Void) {
-        self.openPasswordWindow(fileUrl: URL(fileURLWithPath: fileUrlString), type: type, completionBlock: completionBlock)
-    }
-    
-    func openPasswordWindow(fileUrl: URL, type: KMPasswordInputWindowType = .open, completionBlock:@escaping (KMPasswordInputWindowResult, String?)->Void) {
-        KMPasswordInputWindow.openWindow(window: self.view.window!, type: type, url: fileUrl, callback: completionBlock)
-    }
-    
-    func openPasswordWindow_success(fileUrlString: String, type: KMPasswordInputWindowType = .open, completionBlock:@escaping (String)->Void) {
-        self.openPasswordWindow_success(fileUrl: URL(fileURLWithPath: fileUrlString), type: type, completionBlock: completionBlock)
-    }
-    
-    func openPasswordWindow_success(fileUrl: URL, type: KMPasswordInputWindowType = .open, completionBlock:@escaping (String)->Void) {
-        KMPasswordInputWindow.success_openWindow(window: self.view.window!, url: fileUrl, callback: completionBlock)
-    }
-    
-    
-    fileprivate func _openPasswordWindow_loop(fileUrl: URL, type: KMPasswordInputWindowType, progressBlock: ((_ params: Any...)->Void)?, completionBlock:@escaping ()->Void) {
-        KMPasswordInputWindow.openWindow(window: self.view.window!, type: type, url: fileUrl) { [weak self] result, password in
-            // 将结果返回
-            if let _callback = progressBlock {
-                _callback(fileUrl, result, password as Any)
-            }
-            
-            // 进行下一个
-            self?.lockedFiles.removeFirst()
-            if let _fileUrl = self?.lockedFiles.first {
-                self?._openPasswordWindow_loop(fileUrl: _fileUrl, type: type, progressBlock: progressBlock, completionBlock: completionBlock)
-            } else {
-                completionBlock()
-            }
-        }
-    }
-    
-    // MARK: - Progress Window
-    
-    var progressC: SKProgressController?
-    func showProgressWindow(message: String = "") {
-        if (self.progressC != nil) {
-            self.hiddenProgressWindow()
-        }
-        
-        let progressC = SKProgressController()
-        progressC.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
-        progressC.window?.contentView?.wantsLayer = true
-        progressC.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
-        progressC.progressField.textColor = NSColor.white
-        progressC.showClose = false
-        progressC.message = message
-
-        self.progressC = progressC
-        self.view.window?.beginSheet(progressC.window!)
-    }
-    
-    func hiddenProgressWindow() {
-        if let _progressC = self.progressC {
-            if let _window = _progressC.window {
-                self.view.window?.endSheet(_window)
-            }
-            self.progressC = nil
-        }
-    }
-    
-    // MARK: - Menu Add & Remove
-    
-    public func addMenu(to view: NSView?) {
-        if let menuView = view {
-            self.addMenu(to: menuView)
-            return
-        }
-        self.addMenu(to: self.view)
-    }
-    
-    public func removeMenu(to view: NSView?) {
-        if let menuView = view {
-            self.removeMenu(to: menuView)
-            return
-        }
-        self.removeMenu(to: self.view)
-    }
-    
-    private func addMenu(to view: NSView) {
-        // 先移除
-        self.removeMenu(to: view)
+    func addNotifations() {
+        updateUIThemeColor()
+        NotificationCenter.default.addObserver(self, selector: #selector(updateUIThemeColor), name: APPAppearanceChangedNotificationName, object: nil)
         
-        let menu = NSMenu()
-        menu.delegate = self
-        view.menu = menu
-    }
-    private func removeMenu(to view: NSView) {
-        view.menu?.delegate = nil
-        view.menu = nil
-    }
-    
-    // MARK: - Document isDocumentEdited
-    
-    public func setDocumentEditedState(window: NSWindow? = nil) {
-        var _win = window
-        if (_win == nil) {
-            _win = self.view.window
-        }
-        guard let _window = _win else {
-            return
-        }
-        guard let _document = NSDocumentController.shared.document(for: _window) else {
-            return
-        }
-        self.setDocumentEditedState(document: _document)
-    }
-    
-    public func setDocumentEditedState(url: URL? = nil) {
-        if let _url = url {
-            KMTools.setDocumentEditedState(url: _url)
-        } else {
-            self.setDocumentEditedState(window: self.view.window)
-        }
+        updateUILanguage()
+        NotificationCenter.default.addObserver(self, selector: #selector(updateUILanguage), name: APPLanguageChangedNotificationName, object: nil)
     }
     
-    public func setDocumentEditedState(document: NSDocument) {
-        km_synchronized(document) {
-            if let _document = document as? KMMainDocument {
-                _document.km_updateChangeCount(.changeDone)
-            } else {
-                document.updateChangeCount(.changeDone)
-            }
-        }
+    func removeNotifations() {
+        NotificationCenter.default.removeObserver(self)
     }
     
-    public func clearDocumentEditedState(window: NSWindow? = nil) {
-        var _win = window
-        if (_win == nil) {
-            _win = self.view.window
-        }
-        guard let _window = _win else {
-            return
-        }
-        guard let _document = NSDocumentController.shared.document(for: _window) else {
-            return
-        }
-        self.clearDocumentEditedState(document: _document)
-    }
+    @objc func updateUIThemeColor() {}
     
-    public func clearDocumentEditedState(url: URL? = nil) {
-        if let _url = url {
-            KMTools.clearDocumentEditedState(url: _url)
-        } else {
-            self.clearDocumentEditedState(window: self.view.window)
-        }
-    }
+    @objc func updateUILanguage() {}
     
-    public func clearDocumentEditedState(document: NSDocument) {
-        km_synchronized(document) {
-            if let _document = document as? KMMainDocument {
-                _document.km_updateChangeCount(.changeCleared)
-            } else {
-                document.updateChangeCount(.changeCleared)
-            }
-        }
-    }
-}
-
-extension KMNBaseViewController: NSMenuDelegate, NSMenuItemValidation {
-    func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
-        return true
-    }
+    private func initContentView() {}
     
-    func menuNeedsUpdate(_ menu: NSMenu) {
-        menu.removeAllItems()
-    }
 }

+ 13 - 125
PDF Office/PDF Master/KMClass/Tools/Base/KMNBaseWindowController.swift

@@ -22,35 +22,30 @@ class KMNBaseWindowController: NSWindowController {
         super.windowDidLoad()
     
         // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
-        self.initSubViews()
-        self.initDefaultValue()
+        self.initContentView()
         self.initNotification()
     }
     
-    func initSubViews() {
-        
-    }
-    
-    func beginSheetFinish() {
-        
-    }
-    
-    func initDefaultValue() {
-        self.window?.appearance = NSApp.appearance
-    }
-    
     func initNotification() {
-        DistributedNotificationCenter.default().addObserver(self, selector: #selector(_themeChanged), name: NSApplication.interfaceThemeChangedNotification, object: nil)
+        updateUIThemeColor()
+        NotificationCenter.default.addObserver(self, selector: #selector(updateUIThemeColor), name: APPAppearanceChangedNotificationName, object: nil)
+        
+        updateUILanguage()
+        NotificationCenter.default.addObserver(self, selector: #selector(updateUILanguage), name: APPLanguageChangedNotificationName, object: nil)
     }
     
     func removeNotification() {
         DistributedNotificationCenter.default().removeObserver(self)
     }
-    
-    func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
         
-    }
+    @objc func updateUIThemeColor() {}
     
+    @objc func updateUILanguage() {}
+    
+    func beginSheetFinish() {}
+    
+    func initContentView() {}
+
     func own_beginSheetModal(for window: NSWindow?, completionHandler handler: ((String?) -> Void)?) {
         if window != nil {
             parentWindow = window
@@ -61,116 +56,9 @@ class KMNBaseWindowController: NSWindowController {
         self.handler = handler
         
         beginSheetFinish()
-        
     }
     
     func own_closeEndSheet() {
         parentWindow?.endSheet(self.window!)
     }
-
-}
-
-// MARK: - Private Methods
-
-extension KMNBaseWindowController {
-    @objc private func _themeChanged(_ sender: Notification) {
-        let isDarkModel = KMAdvertisementConfig.isDarkModel()
-        if isDarkModel {
-            self.window?.appearance = .init(named: .darkAqua)
-        } else {
-            self.window?.appearance = .init(named: .aqua)
-        }
-        
-        Task { @MainActor in
-            self.interfaceThemeDidChanged(self.window?.appearance?.name ?? .aqua)
-        }
-    }
-}
-
-extension NSWindowController {
-    func knCheckPassword(url: URL, type: KMPasswordInputWindowType, password: String = "", completion: @escaping ((_ success: Bool, _ resultPassword: String) -> Void)) {
-        // 判断路径 + document
-        guard let document = CPDFDocument.init(url: url) else {
-            return completion(false, "")
-        }
-
-        // 判断是否为加密文档
-        if document.isLocked == false {
-            if type == .open {
-                completion(true, "")
-                return
-            }
-        }
-        
-        if document.isLocked == false && (document.allowsCopying && document.allowsPrinting) {
-            completion(true, "")
-            return
-        }
-        
-        // 加密文件,尝试解锁
-        if password.isEmpty == false {
-            let preStatus = document.permissionsStatus
-            document.unlock(withPassword: password)
-            if document.permissionsStatus.rawValue > preStatus.rawValue { // 解密成功
-                completion(true, password)
-                return
-            }
-        }
-        
-        // 弹密码弹窗
-        Task { @MainActor in
-            KMPasswordInputWindow.openWindow(window: self.window!, type: type, url: url) { result , password in
-                if (result == .cancel) {
-                    completion(false, "")
-                    return
-                } else {
-                    completion(true, password ?? "")
-                }
-            }
-        }
-    }
-}
-
-extension KMNBaseWindowController {
-    static func checkPassword(url: URL, type: KMPasswordInputWindowType, password: String = "", completion: @escaping ((_ success: Bool, _ resultPassword: String) -> Void)) {
-        // 判断路径 + document
-        guard let document = CPDFDocument.init(url: url) else {
-            return completion(false, "")
-        }
-
-        // 判断是否为加密文档
-        if document.isLocked == false {
-            if type == .open {
-                completion(true, "")
-                return
-            }
-        }
-        
-        if document.isLocked == false && (document.allowsCopying && document.allowsPrinting) {
-            completion(true, "")
-            return
-        }
-        
-        // 加密文件,尝试解锁
-        if password.isEmpty == false {
-            let preStatus = document.permissionsStatus
-            document.unlock(withPassword: password)
-            if document.permissionsStatus.rawValue > preStatus.rawValue { // 解密成功
-                completion(true, password)
-                return
-            }
-        }
-        
-        // 弹密码弹窗
-        Task { @MainActor in
-            KMPasswordInputWindow.openWindow(window: NSWindow.currentWindow(), type: type, url: url) { result , password in
-                if (result == .cancel) {
-                    completion(false, "")
-                    return
-                } else {
-                    completion(true, password ?? "")
-                }
-            }
-        }
-    }
 }

+ 42 - 0
PDF Office/PDF Master/KMClass/Tools/NSWindowController+Extension/NSWindowController+Extension.swift

@@ -17,6 +17,48 @@ extension NSWindowController {
         self.showWindow(sender)
     }
     
+    func showCheckPassword(url: URL, type: KMPasswordInputWindowType, password: String = "", completion: @escaping ((_ success: Bool, _ resultPassword: String) -> Void)) {
+        // 判断路径 + document
+        guard let document = CPDFDocument.init(url: url) else {
+            return completion(false, "")
+        }
+
+        // 判断是否为加密文档
+        if document.isLocked == false {
+            if type == .open {
+                completion(true, "")
+                return
+            }
+        }
+        
+        if document.isLocked == false && (document.allowsCopying && document.allowsPrinting) {
+            completion(true, "")
+            return
+        }
+        
+        // 加密文件,尝试解锁
+        if password.isEmpty == false {
+            let preStatus = document.permissionsStatus
+            document.unlock(withPassword: password)
+            if document.permissionsStatus.rawValue > preStatus.rawValue { // 解密成功
+                completion(true, password)
+                return
+            }
+        }
+        
+        // 弹密码弹窗
+        Task { @MainActor in
+            KMPasswordInputWindow.openWindow(window: self.window!, type: type, url: url) { result , password in
+                if (result == .cancel) {
+                    completion(false, "")
+                    return
+                } else {
+                    completion(true, password ?? "")
+                }
+            }
+        }
+    }
+    
 }
 
 // MARK: - Sheet

+ 46 - 46
PDF Office/PDF Master/Class/PDFTools/Secure/View/KMSecureTextFiled.swift

@@ -116,16 +116,16 @@ class KMSecureTextFiled: NSView {
     var placeholderString: String {
         get {
             if (self.mode == .plaintext) {
-                return self.textFiled.placeholderString ?? ""
+                return textFiled.placeholderString ?? ""
             } else {
-                return self.secureTextField.placeholderString ?? ""
+                return secureTextField.placeholderString ?? ""
             }
         }
         set {
-            if (self.mode == .plaintext) {
-                self.textFiled.placeholderString = newValue
+            if (mode == .plaintext) {
+                textFiled.placeholderString = newValue
             } else {
-                self.secureTextField.placeholderString = newValue
+                secureTextField.placeholderString = newValue
             }
         }
     }
@@ -154,14 +154,14 @@ class KMSecureTextFiled: NSView {
     
     func initDefaultValue() {
         mode = .ciphertext
-        self.secureTextField.isHidden = false
-        self.secureTextField.isBezeled = false
-        self.secureTextField.focusRingType = .none
-        self.secureTextField.delegate = self
-        self.textFiled.isHidden = true
-        self.textFiled.isBezeled = false
-        self.textFiled.focusRingType = .none
-        self.textFiled.delegate = self
+        secureTextField.isHidden = false
+        secureTextField.isBezeled = false
+        secureTextField.focusRingType = .none
+        secureTextField.delegate = self
+        textFiled.isHidden = true
+        textFiled.isBezeled = false
+        textFiled.focusRingType = .none
+        textFiled.delegate = self
         
         let cell = self.textFiled.cell as? NSTextFieldCell
         cell?.allowedInputSourceLocales = [NSAllRomanInputSourcesLocaleIdentifier]
@@ -186,9 +186,9 @@ class KMSecureTextFiled: NSView {
     }
     
     func initSubViews() {
-        self.addSubview(self.backgroundView)
-        self.addSubview(self.secureTextField)
-        self.addSubview(self.textFiled)
+        addSubview(backgroundView)
+        addSubview(secureTextField)
+        addSubview(textFiled)
     }
     
     override func layout() {
@@ -197,7 +197,7 @@ class KMSecureTextFiled: NSView {
         let width: CGFloat = NSWidth(self.bounds)
         let height: CGFloat = NSHeight(self.bounds)
         
-        self.backgroundView.frame = self.bounds
+        backgroundView.frame = self.bounds
         
         var textFieldHeight: CGFloat = 22
         if let font = self.textFiled.font {
@@ -209,12 +209,12 @@ class KMSecureTextFiled: NSView {
             rightView.frame = NSMakeRect(width-rightWidth, 0, rightWidth, height)
             
             let textFieldFrame = NSMakeRect(textFieldX, (height-textFieldHeight)*0.5, width-textFieldX*2-rightWidth-5, textFieldHeight)
-            self.secureTextField.frame = textFieldFrame
-            self.textFiled.frame = textFieldFrame
+            secureTextField.frame = textFieldFrame
+            textFiled.frame = textFieldFrame
         } else {
             let textFieldFrame = NSMakeRect(textFieldX, (height-textFieldHeight)*0.5, width-textFieldX*2, textFieldHeight)
-            self.secureTextField.frame = textFieldFrame
-            self.textFiled.frame = textFieldFrame
+            secureTextField.frame = textFieldFrame
+            textFiled.frame = textFieldFrame
         }
     }
     
@@ -222,23 +222,23 @@ class KMSecureTextFiled: NSView {
         self.mode = mode
         
         if (mode == .ciphertext) { /// 密文
-            self.secureTextField.isHidden = false
-            self.secureTextField.stringValue = self.textFiled.stringValue
-            self.window?.makeFirstResponder(self.secureTextField)
+            secureTextField.isHidden = false
+            secureTextField.stringValue = textFiled.stringValue
+            self.window?.makeFirstResponder(secureTextField)
             
-            self.textFiled.isHidden = true
+            textFiled.isHidden = true
         } else { /// 明文
-            self.textFiled.isHidden = false
-            self.textFiled.stringValue = self.secureTextField.stringValue
-            self.window?.makeFirstResponder(self.textFiled)
+            textFiled.isHidden = false
+            textFiled.stringValue = secureTextField.stringValue
+            self.window?.makeFirstResponder(textFiled)
             
-            self.secureTextField.isHidden = true
+            secureTextField.isHidden = true
         }
     }
     
     func clear() {
-        self.secureTextField.stringValue = ""
-        self.textFiled.stringValue = ""
+        secureTextField.stringValue = ""
+        textFiled.stringValue = ""
         
         guard let callback = valueDidChange else {
             return
@@ -248,33 +248,33 @@ class KMSecureTextFiled: NSView {
     }
     
     func password() -> String {
-        return self.mode == .ciphertext ? self.secureTextField.stringValue : self.textFiled.stringValue
+        return self.mode == .ciphertext ? secureTextField.stringValue : textFiled.stringValue
     }
     
     override func becomeFirstResponder() -> Bool {
-        self.window?.makeFirstResponder(self.mode == .ciphertext ? self.secureTextField : self.textFiled)
+        self.window?.makeFirstResponder(self.mode == .ciphertext ? secureTextField : textFiled)
         
         return super.becomeFirstResponder()
     }
     
     internal func updateRightViewStateIfNeed(editing: Bool) {
-        guard let view = self.rightView else {
+        guard let view = rightView else {
             return
         }
         
-        if (self.rightViewMode == .always) {
+        if (rightViewMode == .always) {
             view.isHidden = false
             return
         }
-        if (self.rightViewMode == .never) {
+        if (rightViewMode == .never) {
             view.isHidden = true
             return
         }
         
         if (editing) { // 开始编辑
-            view.isHidden = self.rightViewMode != .whileEditing
+            view.isHidden = rightViewMode != .whileEditing
         } else { // 结束编辑
-            view.isHidden = self.rightViewMode == .whileEditing
+            view.isHidden = rightViewMode == .whileEditing
         }
     }
 }
@@ -282,12 +282,12 @@ class KMSecureTextFiled: NSView {
 extension KMSecureTextFiled: NSTextFieldDelegate {
     func controlTextDidChange(_ obj: Notification) {
         if (self.mode == .ciphertext) {
-            if (self.secureTextField.isEqual(to: obj.object)) {
+            if (secureTextField.isEqual(to: obj.object)) {
                 guard let callback = valueDidChange else {
                     return
                 }
                 
-                callback(self, self.secureTextField.stringValue)
+                callback(self, secureTextField.stringValue)
             }
         } else {
             if (self.textFiled.isEqual(to: obj.object)) {
@@ -295,19 +295,19 @@ extension KMSecureTextFiled: NSTextFieldDelegate {
                     return
                 }
                 
-                callback(self, self.secureTextField.stringValue)
+                callback(self, secureTextField.stringValue)
             }
         }
     }
     
     func controlTextDidEndEditing(_ obj: Notification) {
-        if (!self.secureTextField.isEqual(to: obj.object) && !self.textFiled.isEqual(to: obj.object)) {
+        if (!secureTextField.isEqual(to: obj.object) && !self.textFiled.isEqual(to: obj.object)) {
             return
         }
         
-        self.updateRightViewStateIfNeed(editing: false)
+        updateRightViewStateIfNeed(editing: false)
         
-        guard let callback = self.didEndEditHandler else {
+        guard let callback = didEndEditHandler else {
             return
         }
         callback(self.password())
@@ -318,8 +318,8 @@ extension KMSecureTextFiled: NSTextFieldDelegate {
         case #selector(NSResponder.insertNewline(_:)):
             if let inputView = control as? NSTextField {
 //                //当当前TextField按下enter
-                if inputView == self.textFiled ||
-                    inputView == self.secureTextField {
+                if inputView == textFiled ||
+                    inputView == secureTextField {
                     guard let callBack = enterAction else { return false}
                     
                     callBack()

+ 568 - 0
PDF Office/PDF Master/KMClass/Tools/Secure/Window/KMPasswordInputWindow.swift

@@ -0,0 +1,568 @@
+//
+//  KMPasswordInputWindow.swift
+//  PDF Reader Pro
+//
+//  Created by tangchao on 2022/11/29.
+//
+
+import Cocoa
+import PDFKit
+import KMComponentLibrary
+
+@objc enum KMPasswordInputWindowType: Int {
+    case open = 1
+    case owner = 2
+}
+
+@objc enum KMPasswordInputWindowResult: Int {
+    case cancel = 1
+    case success = 2
+}
+
+typealias KMPasswordInputWindowItemClick = (KMPasswordInputWindow, Int, String) -> ()
+
+@objcMembers class KMPasswordInputWindow: NSWindow, NibLoadable {
+    @IBOutlet weak var titleLabel: NSTextField!
+    
+    @IBOutlet weak var despLabel: NSTextField!
+    @IBOutlet weak var secureTextFiled: KMSecureTextFiled!
+    
+    @IBOutlet weak var iconImageView: NSImageView!
+    
+    @IBOutlet weak var passwordErrorLabel: NSTextField!
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var confirmButton: NSButton!
+    
+    var confirmButtonVC: KMDesignButton?
+    
+    var documentURL: URL?
+    var itemClick: KMPasswordInputWindowItemClick?
+    
+    var type: KMPasswordInputWindowType = .open {
+        didSet {
+            titleLabel?.stringValue = KMLocalizedString("Permission Password")
+            
+            var fileName = KMLocalizedString("")
+            if (self.documentURL != nil) {
+                fileName.append("\(self.documentURL!.lastPathComponent)")
+            }
+            despLabel?.maximumNumberOfLines = 3
+            despLabel?.lineBreakMode = .byTruncatingTail
+            despLabel?.cell?.truncatesLastVisibleLine = true
+            let ps = NSMutableParagraphStyle()
+            ps.lineSpacing = 5
+            let despLabelString = "\"\(fileName)\"\(KMLocalizedString("This PDF is password protected. Please enter the password below to access this PDF."))"
+            despLabel?.attributedStringValue = NSAttributedString(string: despLabelString, attributes: [.foregroundColor : ComponentLibrary.shared.getComponentColorFromKey("colorText/1"), .font : ComponentLibrary.shared.getFontFromKey("mac/body-m-bold"), .paragraphStyle : ps])
+        }
+    }
+    
+    var canEncrpty = false
+    
+    static var permissionsStatus: CPDFDocumentPermissions = .none
+    
+    deinit {
+        KMPrint("KMPasswordInputWindow 已释放了")
+    }
+    
+    static var nibName: String? {
+        return "KMPasswordInputWindow"
+    }
+    
+    static func createFromNib(in bundle: Bundle) -> Self? {
+        guard let nibName = self.nibName else {
+            return nil
+        }
+        var topLevelArray: NSArray? = nil
+        bundle.loadNibNamed(NSNib.Name(nibName), owner: self, topLevelObjects: &topLevelArray)
+        guard let results = topLevelArray else {
+            return nil
+        }
+        let views = Array<Any>(results).filter { $0 is Self }
+        return views.last as? Self
+    }
+    
+    class func createWindow() -> Self? {
+        KMPasswordInputWindow.permissionsStatus = .none
+        
+        return createFromNib(in: MainBundle)
+    }
+    
+    override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) {
+        super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag)
+    }
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        titleLabel.stringValue = KMLocalizedString("Permission Password")
+        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-l-bold")
+        
+        despLabel.stringValue = KMLocalizedString("This PDF is password protected. Please enter the password below to access this PDF.")
+        despLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        despLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-bold")
+        despLabel.isSelectable = false
+        let ps = NSMutableParagraphStyle()
+        ps.lineSpacing = 5
+        despLabel.maximumNumberOfLines = 2
+        despLabel.lineBreakMode = .byTruncatingTail
+        ps.lineBreakMode = .byTruncatingTail
+        despLabel.attributedStringValue = NSAttributedString(string: despLabel.stringValue, attributes: [.foregroundColor : ComponentLibrary.shared.getComponentColorFromKey("colorText/1"), .font : ComponentLibrary.shared.getFontFromKey("mac/body-m-bold"), .paragraphStyle : ps])
+        
+        iconImageView.image = NSImage(named: "KMImageNameSecureIcon")
+        
+        secureTextFiled.backgroundView.wantsLayer = true
+        secureTextFiled.backgroundView.layer?.borderWidth = 1
+        secureTextFiled.backgroundView.layer?.cornerRadius = 4
+        secureTextFiled.placeholderString = KMLocalizedString("Password")
+        
+        let rightView = NSView()
+        rightView.frame = NSMakeRect(0, 0, 40, 32);
+        secureTextFiled.rightView = rightView
+        let clearButton = NSButton()
+        rightView.addSubview(clearButton)
+        clearButton.frame = NSMakeRect(10, 6, 20, 20)
+        clearButton.wantsLayer = true
+        clearButton.image = NSImage(named: "KMImageNameSecureClearIcon")
+        clearButton.isBordered = false
+        clearButton.target = self
+        clearButton.action = #selector(clearButtonAction)
+        rightView.isHidden = true
+        
+        secureTextFiled.becomeFirstResponderHandler = { [unowned self] securetextFiled in
+            let mySecureTextField: KMSecureTextFiled = securetextFiled as! KMSecureTextFiled
+            mySecureTextField.backgroundView.wantsLayer = true
+            mySecureTextField.backgroundView.layer?.borderColor = NSColor.km_init(hex: "#1770F4").cgColor
+            
+            if mySecureTextField.password().isEmpty {
+                secureTextFiled.rightView?.isHidden = true
+            } else {
+                secureTextFiled.rightView?.isHidden = false
+            }
+            passwordErrorLabel.isHidden = true
+        }
+        secureTextFiled.valueDidChange = { [unowned self] view, string in
+            view.backgroundView.layer?.borderColor = NSColor.km_init(hex: "#1770F4").cgColor
+            passwordErrorLabel.isHidden = true
+            if string.isEmpty {
+                view.rightView?.isHidden = true
+                dealConfirmButtonEnabledState(enabled: false)
+            } else {
+                view.rightView?.isHidden = false
+                dealConfirmButtonEnabledState(enabled: true)
+            }
+        }
+        
+        secureTextFiled.enterAction = { [unowned self] in
+            self.confirmButtonAction()
+        }
+        
+        passwordErrorLabel.stringValue = KMLocalizedString("Incorrect password. Please try again.")
+        passwordErrorLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-xs-regular")
+        passwordErrorLabel.wantsLayer = true
+        passwordErrorLabel.textColor = NSColor.km_init(hex: "#F3465B")
+        passwordErrorLabel.isHidden = true
+        
+        for button in [cancelButton, confirmButton] {
+            button!.target = self
+            if ((button?.isEqual(to: cancelButton))!) {
+            } else {
+            }
+        }
+        
+        let cancelButtonVC = KMDesignButton(withType: .Text)
+        cancelButtonVC.view.frame = self.cancelButton.bounds
+        cancelButtonVC.view.autoresizingMask = [.width, .height]
+        cancelButtonVC.stringValue = KMLocalizedString("Cancel")
+        cancelButtonVC.button(type: .Sec_Icon, size: .m)
+        cancelButtonVC.target = self
+        cancelButtonVC.action = #selector(cancelButtonAction)
+        cancelButtonVC.button.keyEquivalent = KMKeyEquivalent.esc.string()
+        cancelButton.title = KMLocalizedString("Cancel")
+        cancelButton.action = #selector(cancelButtonAction)
+        
+        let confirmButtonVC = KMDesignButton(withType: .Text)
+        confirmButtonVC.view.frame = self.confirmButton.bounds
+        confirmButtonVC.view.autoresizingMask = [.width, .height]
+        confirmButtonVC.stringValue = KMLocalizedString("Open")
+        confirmButtonVC.button(type: .Cta, size: .m)
+        confirmButtonVC.target = self
+        confirmButtonVC.action = #selector(confirmButtonAction)
+        
+        self.confirmButtonVC = confirmButtonVC
+        self.confirmButtonVC?.button.keyEquivalent = KMKeyEquivalent.enter
+        confirmButton.title = KMLocalizedString("Open")
+        confirmButton.action = #selector(confirmButtonAction)
+        
+        dealConfirmButtonEnabledState(enabled: true)
+    }
+    
+    // MARK: - Actions
+    
+    @objc func cancelButtonAction() {
+        guard let callback = self.itemClick else {
+            return
+        }
+        
+        callback(self, 1, "")
+    }
+    
+    @objc func confirmButtonAction() {
+        if (!self.canEncrpty) {
+            return
+        }
+        guard let documentURL = self.documentURL else {
+            return
+        }
+        
+        if (self.type == .open) {
+            let document: CPDFDocument = CPDFDocument(url: documentURL)
+            if document.permissionsStatus == .none {
+                let reuslt = document.unlock(withPassword: secureTextFiled.password())
+                /// CPDFDocumentPermissionsNone 解锁失败
+                /// CPDFDocumentPermissionsUser 输入的开启密码
+                /// CPDFDocumentPermissionsOwner 输入的权限密码
+                KMPasswordInputWindow.permissionsStatus = document.permissionsStatus
+                if document.permissionsStatus != CPDFDocumentPermissions.none { /// 密码正确
+                    guard let callback = self.itemClick else {
+                        return
+                    }
+                    
+                    callback(self ,2, secureTextFiled.password())
+                } else { /// 密码错误
+                     passwordErrorLabel.isHidden = false
+                    passwordErrorLabel.stringValue = KMLocalizedString("Incorrect password. Please try again.")
+                    secureTextFiled.backgroundView.layer?.borderColor = NSColor.km_init(hex: "#F3465B").cgColor
+                }
+            }
+            return
+        }
+        
+        /// 权限密码类型
+        let document: CPDFDocument = CPDFDocument(url: documentURL)
+        if (document.isLocked) {
+            if document.permissionsStatus == CPDFDocumentPermissions.none {
+                let reuslt = document.unlock(withPassword: secureTextFiled.password())
+                KMPasswordInputWindow.permissionsStatus = document.permissionsStatus
+                
+                if document.permissionsStatus == .owner { /// 密码正确
+                    guard let callback = self.itemClick else {
+                        return
+                    }
+                    
+                    callback(self, 2, secureTextFiled.password())
+                } else { /// 密码错误
+                    passwordErrorLabel.isHidden = false
+                    passwordErrorLabel.stringValue = KMLocalizedString("Incorrect password. Please try again.")
+                    secureTextFiled.backgroundView.layer?.borderColor = NSColor.km_init(hex: "#F3465B").cgColor
+                }
+            }
+        } else {
+            if document.permissionsStatus == CPDFDocumentPermissions.user {
+                document.unlock(withPassword: secureTextFiled.password())
+                KMPasswordInputWindow.permissionsStatus = document.permissionsStatus
+                if document.permissionsStatus == .owner { /// 密码正确
+                    guard let callback = self.itemClick else {
+                        return
+                    }
+                    
+                    callback(self, 2, secureTextFiled.password())
+                } else { /// 密码错误
+                    passwordErrorLabel.isHidden = false
+                    passwordErrorLabel.stringValue = KMLocalizedString("Incorrect password. Please try again.")
+                    secureTextFiled.backgroundView.layer?.borderColor = NSColor.km_init(hex: "#F3465B").cgColor
+                }
+            }
+        }
+    }
+    
+    @objc func clearButtonAction() {
+        secureTextFiled.clear()
+    }
+    
+    func dealConfirmButtonEnabledState(enabled: Bool) {
+        canEncrpty = enabled
+        
+        confirmButton.isEnabled = enabled
+    }
+    
+    override func mouseUp(with event: NSEvent) {
+        super.mouseUp(with: event)
+        
+        makeFirstResponder(nil)
+        passwordErrorLabel.isHidden = true
+    }
+}
+
+extension KMPasswordInputWindow {
+    @objc class func openWindow(window: NSWindow, type: KMPasswordInputWindowType = .open, url: URL, callback: @escaping (KMPasswordInputWindowResult, String?)->Void) -> KMPasswordInputWindow {
+        let passwordWindow = KMPasswordInputWindow.createWindow()
+        passwordWindow?.documentURL = url
+        passwordWindow?.type = type
+        
+        passwordWindow?.itemClick = { pwdWin, index, string in
+            if let sheetParent = pwdWin.sheetParent {
+                sheetParent.endSheet(pwdWin)
+            }
+            if index == 1 { /// 关闭
+                callback(.cancel, "")
+                return
+            }
+            /// 解密成功
+            callback(.success, string)
+        }
+        
+        window.beginSheet(passwordWindow!)
+        return passwordWindow!
+    }
+    
+    @objc class func success_openWindow(window: NSWindow, type: KMPasswordInputWindowType = .open, url: URL, callback: @escaping (String)->Void) {
+        let passwordWindow = KMPasswordInputWindow.createWindow()
+        passwordWindow?.documentURL = url
+        passwordWindow?.type = type
+        
+        passwordWindow?.itemClick = { pwdWin, index, string in
+            if let sheetParent = pwdWin.sheetParent {
+                sheetParent.endSheet(pwdWin)
+            }
+            if index == 1 { /// 关闭
+                return
+            }
+            /// 解密成功
+            callback(string)
+        }
+        
+        window.beginSheet(passwordWindow!)
+    }
+    
+    @objc class func openWindow(window: NSWindow, url: URL, needOwner: Bool, callback: @escaping (KMPasswordInputWindowResult, String?)->Void) {
+        let passwordWindow = KMPasswordInputWindow.createWindow()
+        passwordWindow?.documentURL = url
+        
+        let document = CPDFDocument(url: url)
+        if (document?.isLocked != nil && document!.isLocked) {
+            passwordWindow?.type = .open
+        } else if (document?.isEncrypted != nil && document!.isEncrypted) {
+            passwordWindow?.type = .owner
+        } else {
+            passwordWindow?.type = .open
+        }
+        
+        
+        passwordWindow?.itemClick = { pwdWin, index, string in
+            let type = pwdWin.type
+            if let sheetParent = pwdWin.sheetParent {
+                sheetParent.endSheet(pwdWin)
+            }
+            if index == 1 { /// 关闭
+                callback(.cancel, "")
+                return
+            }
+            /// 解密成功
+            if (type == .owner) { // 解除的是权限密码
+                callback(.success, string)
+                return
+            }
+            
+            // 解除的是开启密码
+            if (needOwner == false) { // 不需要解除权限密码
+                callback(.success, string)
+                return
+            }
+            
+            if (document == nil) {
+                callback(.success, string)
+                return
+            }
+            
+            document?.unlock(withPassword: string)
+            if (document?.permissionsStatus == .owner) { // 用户是使用的权限密码解密
+                callback(.success, string)
+                return
+            }
+            if (document!.allowsCopying == true && document!.allowsPrinting == true) { // 文件没有权限限制
+                callback(.success, string)
+                return
+            }
+            
+            // 需要解除权限密码
+            KMPasswordInputWindow.openWindow(window: window, type: .owner, url: url) { result, password in
+                if (result == .cancel) {
+                    callback(.cancel, "")
+                    return
+                }
+                callback(.success, password)
+            }
+        }
+        
+        window.beginSheet(passwordWindow!)
+    }
+    
+    class func saveDocument(_ document: CPDFDocument) -> Bool {
+        let toPath = document.documentURL.path
+        
+        let tempFilePath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.applicationSupportDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last?.stringByAppendingPathComponent(Bundle.main.bundleIdentifier!).stringByAppendingPathComponent("\((document.documentURL.lastPathComponent))")
+        if (FileManager.default.fileExists(atPath: tempFilePath!)) {
+            /// 清空数据
+            try?FileManager.default.removeItem(atPath: tempFilePath!)
+        }
+        
+        var result: Bool = document.write(to: URL(fileURLWithPath: tempFilePath!))
+        if (result == false) {
+            return false
+        }
+        
+        try?FileManager.default.removeItem(atPath: toPath)
+        result = ((try?FileManager.default.moveItem(atPath: tempFilePath!, toPath: toPath)) != nil)
+        /// 清空数据
+        try?FileManager.default.removeItem(atPath: tempFilePath!)
+        return result
+    }
+    
+    class func saveDocumentForRemovePassword(_ document: CPDFDocument) -> Bool {
+        let toPath = document.documentURL.path
+        
+        let tempFilePath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.applicationSupportDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last?.stringByAppendingPathComponent(Bundle.main.bundleIdentifier!).stringByAppendingPathComponent("\((document.documentURL.lastPathComponent))")
+        if (FileManager.default.fileExists(atPath: tempFilePath!)) {
+            /// 清空数据
+            try?FileManager.default.removeItem(atPath: tempFilePath!)
+        }
+        
+        var result: Bool = document.writeDecrypt(to: URL(fileURLWithPath: tempFilePath!))
+        if (result == false) {
+            return false
+        }
+        
+        try?FileManager.default.removeItem(atPath: toPath)
+        result = ((try?FileManager.default.moveItem(atPath: tempFilePath!, toPath: toPath)) != nil)
+        /// 清空数据
+        try?FileManager.default.removeItem(atPath: tempFilePath!)
+        return result
+    }
+}
+
+extension NSOpenPanel {
+    /**
+     * 打开 NSOpenPanel 窗口(如果文档存在开启密码或者权限密码,则会弹密码输入框)
+     * @param window 弹出 NSOpenPanel 的窗口 [可选] [默认为 主窗口]
+     * @param needOwner 是否需要限制权限密码(如果存在权限密码,会在解锁后再弹权限密码弹窗(目前未实现)) [可选] [默认为 false]
+     * @param callback 回调
+     *
+     *  默认弹开启密码输入框,needOwner = true 弹权限密码输入框
+     */
+    class func km_secure_openPanel(window: NSWindow = NSApp.mainWindow!, needOwner: Bool = false, callback:@escaping (URL?, KMPasswordInputWindowResult? , String?)->Void) {
+        let panel = NSOpenPanel()
+        panel.allowedFileTypes = ["pdf"]
+        panel.beginSheetModal(for: window) { response in
+            if (response == .cancel) {
+                callback(nil, nil, nil)
+                return
+            }
+            
+            let document = CPDFDocument(url: panel.url)
+            if ((document?.isLocked)! == false) {
+                if (document?.isEncrypted == false) {
+                    callback(panel.url, nil, nil)
+                    return
+                }
+                
+                if (!needOwner) {
+                    callback(panel.url, nil, nil)
+                    return
+                }
+                
+                KMPasswordInputWindow.openWindow(window: window, type: .owner, url: panel.url!) { result, password in
+                    if (result == .cancel) {
+                        callback(panel.url, .cancel , nil)
+                        return
+                    }
+                    
+                    callback(panel.url, .success , password)
+                }
+                return
+            }
+            
+            /// 已加锁(开启密码)
+            KMPasswordInputWindow.openWindow(window: window, url: panel.url!) { result, password in
+                if (result == .cancel) {
+                    callback(panel.url, .cancel, nil)
+                    return
+                }
+                
+                if (!needOwner) {
+                    callback(panel.url, .success, password)
+                    return
+                }
+                
+                /// 用户输入的是权限密码
+                if (KMPasswordInputWindow.permissionsStatus == .owner) {
+                    callback(panel.url, .success ,password)
+                    return
+                }
+                
+                callback(panel.url, .success ,password)
+            }
+        }
+    }
+    
+    /**
+     * 打开 NSOpenPanel 窗口(如果文档存在开启密码或者权限密码,则会弹密码输入框)
+     * @param window 弹出 NSOpenPanel 的窗口 [可选] [默认为 主窗口]
+     * @param needOwner 是否需要限制权限密码(如果存在权限密码,会在解锁后再弹权限密码弹窗(目前未实现)) [可选] [默认为 false]
+     * @param callback 回调
+     *
+     *  默认弹开启密码输入框,needOwner = true 弹权限密码输入框
+     *  只返回成功的结果, 用户关闭的操作都未回调(如果有需要回调的需求可以使用 km_secure_openPanel 方法)
+     */
+    class func km_secure_openPanel_success(window: NSWindow = NSApp.mainWindow!, needOwner: Bool = false, callback:@escaping (URL, String?)->Void) {
+        let panel = NSOpenPanel()
+        panel.allowedFileTypes = ["pdf"]
+        panel.beginSheetModal(for: window) { response in
+            if (response == .cancel) {
+                return
+            }
+            
+            let document = CPDFDocument(url: panel.url)
+            if ((document?.isLocked)! == false) {
+                if (document?.isEncrypted == false) {
+                    callback(panel.url!, nil)
+                    return
+                }
+                
+                if (!needOwner) {
+                    callback(panel.url!, nil)
+                    return
+                }
+                
+                KMPasswordInputWindow.openWindow(window: window, type: .owner, url: panel.url!) { result, password in
+                    if (result == .cancel) {
+                        return
+                    }
+                    
+                    callback(panel.url!, password)
+                }
+                return
+            }
+            
+            /// 已加锁(开启密码)
+            KMPasswordInputWindow.openWindow(window: window, url: panel.url!) { result, password in
+                if (result == .cancel) {
+                    return
+                }
+                
+                if (!needOwner) {
+                    callback(panel.url!, password)
+                    return
+                }
+                
+                /// 用户输入的是权限密码
+                if (KMPasswordInputWindow.permissionsStatus == .owner) {
+                    callback(panel.url!, password)
+                    return
+                }
+                
+                callback(panel.url!, password)
+            }
+        }
+    }
+}

+ 199 - 0
PDF Office/PDF Master/KMClass/Tools/Secure/Window/KMPasswordInputWindow.xib

@@ -0,0 +1,199 @@
+<?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="KMPasswordInputWindow" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="cancelButton" destination="jwm-QT-mwz" id="4v7-86-Phe"/>
+                <outlet property="confirmButton" destination="Dpd-lf-2h1" id="wfr-lB-56E"/>
+                <outlet property="despLabel" destination="xRE-aR-QBJ" id="uoL-wc-jr4"/>
+                <outlet property="iconImageView" destination="hRH-zQ-1pZ" id="lmC-2Z-CLW"/>
+                <outlet property="passwordErrorLabel" destination="gST-4X-s69" id="YFV-hm-e3n"/>
+                <outlet property="secureTextFiled" destination="nlf-dC-L2j" id="gJk-vY-Srn"/>
+                <outlet property="titleLabel" destination="X38-4p-51v" id="Ho5-lD-x5l"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="KMPasswordInputWindow" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="432" height="220"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1025"/>
+            <value key="minSize" type="size" width="432" height="220"/>
+            <value key="maxSize" type="size" width="432" height="220"/>
+            <view key="contentView" wantsLayer="YES" misplaced="YES" id="EiT-Mj-1SZ">
+                <rect key="frame" x="0.0" y="0.0" width="432" height="220"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ezx-3i-oVb" userLabel="titleBarBox">
+                        <rect key="frame" x="0.0" y="150" width="432" height="44"/>
+                        <view key="contentView" id="7XT-MV-6Sp">
+                            <rect key="frame" x="0.0" y="0.0" width="432" height="44"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="X38-4p-51v">
+                                    <rect key="frame" x="14" y="16" width="37" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="mNB-xx-ixe">
+                                        <font key="font" usesAppearanceFont="YES"/>
+                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <box hidden="YES" verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="nqX-vA-qnf">
+                                    <rect key="frame" x="0.0" y="-2" width="432" height="5"/>
+                                </box>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="bottom" secondItem="nqX-vA-qnf" secondAttribute="bottom" id="CGZ-3m-Sbd"/>
+                                <constraint firstItem="X38-4p-51v" firstAttribute="top" secondItem="7XT-MV-6Sp" secondAttribute="top" constant="12" id="GHy-aU-Uqh"/>
+                                <constraint firstItem="X38-4p-51v" firstAttribute="leading" secondItem="7XT-MV-6Sp" secondAttribute="leading" constant="16" id="Pap-PA-hh5"/>
+                                <constraint firstAttribute="trailing" secondItem="nqX-vA-qnf" secondAttribute="trailing" id="kjd-Yd-SAZ"/>
+                                <constraint firstItem="nqX-vA-qnf" firstAttribute="leading" secondItem="7XT-MV-6Sp" secondAttribute="leading" id="yqX-eq-eY1"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="44" id="LRx-PM-eiy"/>
+                        </constraints>
+                    </box>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="PKr-DW-Os9" userLabel="contentBox">
+                        <rect key="frame" x="0.0" y="48" width="432" height="102"/>
+                        <view key="contentView" id="gDx-hG-Mwb">
+                            <rect key="frame" x="0.0" y="0.0" width="432" height="102"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="xRE-aR-QBJ">
+                                    <rect key="frame" x="102" y="80" width="316" height="16"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" relation="lessThanOrEqual" constant="66" id="Usx-e2-2hd"/>
+                                    </constraints>
+                                    <textFieldCell key="cell" selectable="YES" title="Multiline Label" id="s9C-YB-w17">
+                                        <font key="font" usesAppearanceFont="YES"/>
+                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="nlf-dC-L2j" customClass="KMSecureTextFiled" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                    <rect key="frame" x="104" y="40" width="312" height="32"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="32" id="jiZ-zN-rn8"/>
+                                    </constraints>
+                                </customView>
+                                <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="gST-4X-s69">
+                                    <rect key="frame" x="102" y="16" width="304" height="16"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="300" id="N0S-qp-xpS"/>
+                                    </constraints>
+                                    <textFieldCell key="cell" selectable="YES" title="Multiline Label" id="Ixw-Xd-q48">
+                                        <font key="font" metaFont="system"/>
+                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="hRH-zQ-1pZ">
+                                    <rect key="frame" x="16" y="12" width="80" height="84"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="84" id="4aP-JT-QFl"/>
+                                        <constraint firstAttribute="width" constant="80" id="H5c-QJ-eOo"/>
+                                    </constraints>
+                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="oAN-Bk-Kba"/>
+                                </imageView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="bottom" secondItem="gST-4X-s69" secondAttribute="bottom" constant="16" id="8ez-k9-du5"/>
+                                <constraint firstItem="nlf-dC-L2j" firstAttribute="leading" secondItem="gDx-hG-Mwb" secondAttribute="leading" constant="104" id="J7z-6h-hAm"/>
+                                <constraint firstItem="xRE-aR-QBJ" firstAttribute="leading" secondItem="gDx-hG-Mwb" secondAttribute="leading" constant="104" id="Otg-Bw-160"/>
+                                <constraint firstAttribute="trailing" secondItem="xRE-aR-QBJ" secondAttribute="trailing" constant="16" id="Rwn-iF-WDO"/>
+                                <constraint firstItem="hRH-zQ-1pZ" firstAttribute="leading" secondItem="gDx-hG-Mwb" secondAttribute="leading" constant="16" id="VOc-6y-Lc2"/>
+                                <constraint firstAttribute="trailing" secondItem="nlf-dC-L2j" secondAttribute="trailing" constant="16" id="fq3-8P-sQB"/>
+                                <constraint firstItem="xRE-aR-QBJ" firstAttribute="top" secondItem="gDx-hG-Mwb" secondAttribute="top" constant="6" id="jo1-Wt-TwO"/>
+                                <constraint firstItem="gST-4X-s69" firstAttribute="top" secondItem="nlf-dC-L2j" secondAttribute="bottom" constant="8" id="nJ1-tA-F4V"/>
+                                <constraint firstItem="gST-4X-s69" firstAttribute="leading" secondItem="gDx-hG-Mwb" secondAttribute="leading" constant="104" id="osW-yM-Baf"/>
+                                <constraint firstItem="nlf-dC-L2j" firstAttribute="top" secondItem="xRE-aR-QBJ" secondAttribute="bottom" constant="8" id="pKs-cR-Zan"/>
+                                <constraint firstItem="hRH-zQ-1pZ" firstAttribute="top" secondItem="gDx-hG-Mwb" secondAttribute="top" constant="6" id="zkj-Tf-XdN"/>
+                            </constraints>
+                        </view>
+                    </box>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="vAH-Gb-6tR" userLabel="bottomBarBox">
+                        <rect key="frame" x="0.0" y="0.0" width="432" height="48"/>
+                        <view key="contentView" id="tRi-Ry-6h1">
+                            <rect key="frame" x="0.0" y="0.0" width="432" height="48"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <box hidden="YES" verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="vfd-Uw-Vuz">
+                                    <rect key="frame" x="0.0" y="45" width="432" height="5"/>
+                                </box>
+                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jwm-QT-mwz">
+                                    <rect key="frame" x="247" y="9" width="92" height="44"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="78" id="9On-lg-Ifu"/>
+                                        <constraint firstAttribute="height" constant="32" id="YVJ-Ck-tWB"/>
+                                    </constraints>
+                                    <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="9ln-dP-nCD">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                        <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                                    </buttonCell>
+                                </button>
+                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Dpd-lf-2h1">
+                                    <rect key="frame" x="341" y="9" width="82" height="44"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="32" id="19C-1p-OYf"/>
+                                        <constraint firstAttribute="width" constant="68" id="OOr-ag-SdW"/>
+                                    </constraints>
+                                    <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="uBB-Ls-gQs">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                        <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                                    </buttonCell>
+                                </button>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="bottom" secondItem="Dpd-lf-2h1" secondAttribute="bottom" constant="16" id="64r-TA-sUX"/>
+                                <constraint firstItem="vfd-Uw-Vuz" firstAttribute="leading" secondItem="tRi-Ry-6h1" secondAttribute="leading" id="KKn-9i-ORc"/>
+                                <constraint firstAttribute="bottom" secondItem="jwm-QT-mwz" secondAttribute="bottom" constant="16" id="aLD-gh-UJH"/>
+                                <constraint firstAttribute="trailing" secondItem="vfd-Uw-Vuz" secondAttribute="trailing" id="hiq-WK-Wy8"/>
+                                <constraint firstItem="Dpd-lf-2h1" firstAttribute="leading" secondItem="jwm-QT-mwz" secondAttribute="trailing" constant="16" id="mxM-rl-PVh"/>
+                                <constraint firstAttribute="trailing" secondItem="Dpd-lf-2h1" secondAttribute="trailing" constant="16" id="xA1-XG-Xy8"/>
+                                <constraint firstItem="vfd-Uw-Vuz" firstAttribute="top" secondItem="tRi-Ry-6h1" secondAttribute="top" id="xgz-cx-dxi"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="48" id="8pF-Y2-n3g"/>
+                        </constraints>
+                    </box>
+                </subviews>
+                <constraints>
+                    <constraint firstAttribute="trailing" secondItem="PKr-DW-Os9" secondAttribute="trailing" id="Bcv-FR-vOF"/>
+                    <constraint firstItem="PKr-DW-Os9" firstAttribute="top" secondItem="ezx-3i-oVb" secondAttribute="bottom" id="DAo-Ya-b5c"/>
+                    <constraint firstItem="vAH-Gb-6tR" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="HLA-fV-UAc"/>
+                    <constraint firstItem="ezx-3i-oVb" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="JuI-0N-ZAq"/>
+                    <constraint firstAttribute="bottom" secondItem="vAH-Gb-6tR" secondAttribute="bottom" id="S3D-Se-YE1"/>
+                    <constraint firstAttribute="trailing" secondItem="vAH-Gb-6tR" secondAttribute="trailing" id="j6Y-Cy-QdA"/>
+                    <constraint firstAttribute="trailing" secondItem="ezx-3i-oVb" secondAttribute="trailing" id="l6t-Mw-ArG"/>
+                    <constraint firstItem="PKr-DW-Os9" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="teb-18-cSn"/>
+                    <constraint firstItem="vAH-Gb-6tR" firstAttribute="top" secondItem="PKr-DW-Os9" secondAttribute="bottom" id="ws7-Iy-tFb"/>
+                    <constraint firstItem="ezx-3i-oVb" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="z4x-Jd-Tt5"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="cancelButton" destination="jwm-QT-mwz" id="owI-qe-VM9"/>
+                <outlet property="confirmButton" destination="Dpd-lf-2h1" id="ExL-Jf-SeP"/>
+                <outlet property="despLabel" destination="xRE-aR-QBJ" id="anM-rS-9UT"/>
+                <outlet property="iconImageView" destination="hRH-zQ-1pZ" id="7qd-oa-CLl"/>
+                <outlet property="passwordErrorLabel" destination="gST-4X-s69" id="t8b-EJ-11R"/>
+                <outlet property="secureTextFiled" destination="nlf-dC-L2j" id="omH-Df-hvy"/>
+                <outlet property="titleLabel" destination="X38-4p-51v" id="4qf-4E-g3F"/>
+            </connections>
+            <point key="canvasLocation" x="83" y="-5"/>
+        </window>
+    </objects>
+</document>

+ 12 - 0
PDF Office/PDF Master/KMClass/Tools/Tool/KMNConvertTool.swift

@@ -21,6 +21,18 @@ class KMNConvertTool: NSObject {
         return pdfExtensions
     }
     
+    @objc class func isImageType(_ exn: String) -> Bool {
+        return KMNConvertTool.imageExtensions.contains(exn.lowercased())
+    }
+    
+    @objc class func isPDFType(_ exn: String) -> Bool {
+        return KMNConvertTool.pdfExtensions.contains(exn.lowercased())
+    }
+    
+    @objc class func isOfficeType(_ exn: String) -> Bool {
+        return KMNConvertTool.officeExtensions.contains(exn.lowercased())
+    }
+    
     class func convertOffice(filePath: String, completionBlock:@escaping (String?)->Void) -> Void {
         let today = Date()
         let dateFormatter = DateFormatter()

+ 56 - 48
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -3815,9 +3815,6 @@
 		BB5A9D6A2CB6521400F64C1F /* KMPDFToolbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5A9D4B2CB6521400F64C1F /* KMPDFToolbarController.swift */; };
 		BB5A9D6B2CB6521400F64C1F /* KMPDFToolbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5A9D4B2CB6521400F64C1F /* KMPDFToolbarController.swift */; };
 		BB5A9D6C2CB6521400F64C1F /* KMPDFToolbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5A9D4B2CB6521400F64C1F /* KMPDFToolbarController.swift */; };
-		BB5A9D6F2CB6525C00F64C1F /* BaseXibView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5A9D6E2CB6525C00F64C1F /* BaseXibView.swift */; };
-		BB5A9D702CB6525C00F64C1F /* BaseXibView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5A9D6E2CB6525C00F64C1F /* BaseXibView.swift */; };
-		BB5A9D712CB6525C00F64C1F /* BaseXibView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5A9D6E2CB6525C00F64C1F /* BaseXibView.swift */; };
 		BB5A9D722CB6526E00F64C1F /* KMComponentLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB5A9D232CB64F1D00F64C1F /* KMComponentLibrary.framework */; };
 		BB5A9D732CB6527600F64C1F /* KMComponentLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB5A9D232CB64F1D00F64C1F /* KMComponentLibrary.framework */; };
 		BB5BE4ED2B060E2100D51BF2 /* KMLanguageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5BE4EC2B060E2100D51BF2 /* KMLanguageViewController.swift */; };
@@ -4035,9 +4032,6 @@
 		BB6DD81829348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD81729348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift */; };
 		BB6DD81929348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD81729348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift */; };
 		BB6DD81A29348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD81729348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift */; };
-		BB6DD81C29348F31001F0544 /* KMSecureTextFiled.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD81B29348F31001F0544 /* KMSecureTextFiled.swift */; };
-		BB6DD81D29348F31001F0544 /* KMSecureTextFiled.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD81B29348F31001F0544 /* KMSecureTextFiled.swift */; };
-		BB6DD81E29348F31001F0544 /* KMSecureTextFiled.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD81B29348F31001F0544 /* KMSecureTextFiled.swift */; };
 		BB6DD821293497B6001F0544 /* KMSecureEncryptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */; };
 		BB6DD822293497B6001F0544 /* KMSecureEncryptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */; };
 		BB6DD823293497B6001F0544 /* KMSecureEncryptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */; };
@@ -4586,12 +4580,6 @@
 		BBA8B7AA2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA8B7A92935DC120097D183 /* KMRemovePasswordResultTipView.swift */; };
 		BBA8B7AB2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA8B7A92935DC120097D183 /* KMRemovePasswordResultTipView.swift */; };
 		BBA8B7AC2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA8B7A92935DC120097D183 /* KMRemovePasswordResultTipView.swift */; };
-		BBA8B7AF293600D70097D183 /* KMPasswordInputWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA8B7AE293600D70097D183 /* KMPasswordInputWindow.swift */; };
-		BBA8B7B0293600D70097D183 /* KMPasswordInputWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA8B7AE293600D70097D183 /* KMPasswordInputWindow.swift */; };
-		BBA8B7B1293600D70097D183 /* KMPasswordInputWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA8B7AE293600D70097D183 /* KMPasswordInputWindow.swift */; };
-		BBA8B7B3293635D80097D183 /* KMPasswordInputWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBA8B7B2293635D80097D183 /* KMPasswordInputWindow.xib */; };
-		BBA8B7B4293635D80097D183 /* KMPasswordInputWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBA8B7B2293635D80097D183 /* KMPasswordInputWindow.xib */; };
-		BBA8B7B5293635D80097D183 /* KMPasswordInputWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBA8B7B2293635D80097D183 /* KMPasswordInputWindow.xib */; };
 		BBA922152B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBA922132B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib */; };
 		BBA922162B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBA922132B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib */; };
 		BBA922172B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBA922132B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib */; };
@@ -5632,6 +5620,18 @@
 		F30B22882CB8D9630041002E /* KMNQuickToolCollectionViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = F30B22842CB8D9630041002E /* KMNQuickToolCollectionViewItem.xib */; };
 		F30B22892CB8D9630041002E /* KMNQuickToolCollectionViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = F30B22842CB8D9630041002E /* KMNQuickToolCollectionViewItem.xib */; };
 		F30B228A2CB8D9630041002E /* KMNQuickToolCollectionViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = F30B22842CB8D9630041002E /* KMNQuickToolCollectionViewItem.xib */; };
+		F321C1E42CD9EF74009982C8 /* KMPasswordInputWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C1E22CD9EF73009982C8 /* KMPasswordInputWindow.swift */; };
+		F321C1E52CD9EF74009982C8 /* KMPasswordInputWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C1E22CD9EF73009982C8 /* KMPasswordInputWindow.swift */; };
+		F321C1E62CD9EF74009982C8 /* KMPasswordInputWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C1E22CD9EF73009982C8 /* KMPasswordInputWindow.swift */; };
+		F321C1E72CD9EF74009982C8 /* KMPasswordInputWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = F321C1E32CD9EF73009982C8 /* KMPasswordInputWindow.xib */; };
+		F321C1E82CD9EF74009982C8 /* KMPasswordInputWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = F321C1E32CD9EF73009982C8 /* KMPasswordInputWindow.xib */; };
+		F321C1E92CD9EF74009982C8 /* KMPasswordInputWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = F321C1E32CD9EF73009982C8 /* KMPasswordInputWindow.xib */; };
+		F321C1F62CD9F0DD009982C8 /* KMSecureTextFiled.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C1EC2CD9F0DD009982C8 /* KMSecureTextFiled.swift */; };
+		F321C1F72CD9F0DD009982C8 /* KMSecureTextFiled.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C1EC2CD9F0DD009982C8 /* KMSecureTextFiled.swift */; };
+		F321C1F82CD9F0DD009982C8 /* KMSecureTextFiled.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C1EC2CD9F0DD009982C8 /* KMSecureTextFiled.swift */; };
+		F321C2102CDA0C5E009982C8 /* BaseXibView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C20F2CDA0C5E009982C8 /* BaseXibView.swift */; };
+		F321C2112CDA0C5E009982C8 /* BaseXibView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C20F2CDA0C5E009982C8 /* BaseXibView.swift */; };
+		F321C2122CDA0C5F009982C8 /* BaseXibView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321C20F2CDA0C5E009982C8 /* BaseXibView.swift */; };
 		F326EE2E2CA2D27100EAE792 /* KMDrawViewSDK_Mac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F326EE2A2CA2D25600EAE792 /* KMDrawViewSDK_Mac.framework */; };
 		F326EE2F2CA2D27100EAE792 /* KMDrawViewSDK_Mac.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F326EE2A2CA2D25600EAE792 /* KMDrawViewSDK_Mac.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F328C0AB2CA16C6000BFDD23 /* ComDocumentAIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65C9CAE72CA16232009794E5 /* ComDocumentAIKit.framework */; };
@@ -7427,7 +7427,6 @@
 		BB5A9D492CB6521400F64C1F /* KMPDFSecToolbarController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMPDFSecToolbarController.xib; sourceTree = "<group>"; };
 		BB5A9D4A2CB6521400F64C1F /* KMPDFSecToolbarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMPDFSecToolbarController.swift; sourceTree = "<group>"; };
 		BB5A9D4B2CB6521400F64C1F /* KMPDFToolbarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMPDFToolbarController.swift; sourceTree = "<group>"; };
-		BB5A9D6E2CB6525C00F64C1F /* BaseXibView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseXibView.swift; sourceTree = "<group>"; };
 		BB5BE4EC2B060E2100D51BF2 /* KMLanguageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLanguageViewController.swift; sourceTree = "<group>"; };
 		BB5BE4F02B060EB400D51BF2 /* KMLanguageViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMLanguageViewController.xib; sourceTree = "<group>"; };
 		BB5DA5472BCFF4B200849E86 /* KMPageEditPopViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMPageEditPopViewController.m; sourceTree = "<group>"; };
@@ -7532,7 +7531,6 @@
 		BB6DD80B29347F77001F0544 /* KMSecureEncryptWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMSecureEncryptWindowController.xib; sourceTree = "<group>"; };
 		BB6DD813293486FA001F0544 /* KMSecureEncryptPasswordCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptPasswordCellView.swift; sourceTree = "<group>"; };
 		BB6DD81729348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptComboBoxCellView.swift; sourceTree = "<group>"; };
-		BB6DD81B29348F31001F0544 /* KMSecureTextFiled.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureTextFiled.swift; sourceTree = "<group>"; };
 		BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptModel.swift; sourceTree = "<group>"; };
 		BB6EA28E2B70AF43000D4490 /* KMConvertCompareViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMConvertCompareViewController.xib; sourceTree = "<group>"; };
 		BB6EA28F2B70AF44000D4490 /* KMConvertCompareViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMConvertCompareViewController.h; sourceTree = "<group>"; };
@@ -7762,8 +7760,6 @@
 		BBA8B7A12935CD740097D183 /* KMRemovePasswordAlertWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMRemovePasswordAlertWindowController.swift; sourceTree = "<group>"; };
 		BBA8B7A22935CD740097D183 /* KMRemovePasswordAlertWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMRemovePasswordAlertWindowController.xib; sourceTree = "<group>"; };
 		BBA8B7A92935DC120097D183 /* KMRemovePasswordResultTipView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMRemovePasswordResultTipView.swift; sourceTree = "<group>"; };
-		BBA8B7AE293600D70097D183 /* KMPasswordInputWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPasswordInputWindow.swift; sourceTree = "<group>"; };
-		BBA8B7B2293635D80097D183 /* KMPasswordInputWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMPasswordInputWindow.xib; sourceTree = "<group>"; };
 		BBA922122B4E783F0061057A /* KMPurchaseCompareDMGWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMPurchaseCompareDMGWindowController.h; sourceTree = "<group>"; };
 		BBA922132B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMPurchaseCompareDMGWindowController.xib; sourceTree = "<group>"; };
 		BBA922142B4E783F0061057A /* KMPurchaseCompareDMGWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMPurchaseCompareDMGWindowController.m; sourceTree = "<group>"; };
@@ -8187,6 +8183,10 @@
 		F30B227B2CB7DAF10041002E /* KMNQuickToolWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMNQuickToolWindowController.xib; sourceTree = "<group>"; };
 		F30B22832CB8D9630041002E /* KMNQuickToolCollectionViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMNQuickToolCollectionViewItem.swift; sourceTree = "<group>"; };
 		F30B22842CB8D9630041002E /* KMNQuickToolCollectionViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMNQuickToolCollectionViewItem.xib; sourceTree = "<group>"; };
+		F321C1E22CD9EF73009982C8 /* KMPasswordInputWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMPasswordInputWindow.swift; sourceTree = "<group>"; };
+		F321C1E32CD9EF73009982C8 /* KMPasswordInputWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMPasswordInputWindow.xib; sourceTree = "<group>"; };
+		F321C1EC2CD9F0DD009982C8 /* KMSecureTextFiled.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMSecureTextFiled.swift; sourceTree = "<group>"; };
+		F321C20F2CDA0C5E009982C8 /* BaseXibView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseXibView.swift; sourceTree = "<group>"; };
 		F326EE2A2CA2D25600EAE792 /* KMDrawViewSDK_Mac.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = KMDrawViewSDK_Mac.framework; sourceTree = "<group>"; };
 		F328C0B42CA16F0500BFDD23 /* KMPresentationTopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPresentationTopViewController.swift; sourceTree = "<group>"; };
 		F328C0B52CA16F0500BFDD23 /* KMPresentationTopViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMPresentationTopViewController.xib; sourceTree = "<group>"; };
@@ -10843,14 +10843,6 @@
 			path = View;
 			sourceTree = "<group>";
 		};
-		ADBC2D0A299CAA51006280C8 /* KMBaseXibView */ = {
-			isa = PBXGroup;
-			children = (
-				BB5A9D6E2CB6525C00F64C1F /* BaseXibView.swift */,
-			);
-			path = KMBaseXibView;
-			sourceTree = "<group>";
-		};
 		ADBC2D0F299CCCE8006280C8 /* KMTextfieldButton */ = {
 			isa = PBXGroup;
 			children = (
@@ -11110,7 +11102,6 @@
 				ADBC2D26299DCA51006280C8 /* NSTextFieldExtension */,
 				ADBC2D18299CD8A6006280C8 /* KMBaseViewLayerExtension */,
 				ADBC2D0F299CCCE8006280C8 /* KMTextfieldButton */,
-				ADBC2D0A299CAA51006280C8 /* KMBaseXibView */,
 				ADE614AF29779C5600F62ED7 /* KMImageTitleButton */,
 				ADB2D6F7294882390029D2B3 /* KMTextFieldStepperView */,
 				ADD1B7002946C88300C3FFF7 /* TextField */,
@@ -13478,7 +13469,6 @@
 		BB6DD80829347EFC001F0544 /* Secure */ = {
 			isa = PBXGroup;
 			children = (
-				BBA8B7AD293600590097D183 /* Window */,
 				BB6DD81F29349797001F0544 /* Model */,
 				BB6DD812293486E5001F0544 /* View */,
 				BB6DD80929347EFC001F0544 /* Controller */,
@@ -13502,7 +13492,6 @@
 			children = (
 				BB6DD813293486FA001F0544 /* KMSecureEncryptPasswordCellView.swift */,
 				BB6DD81729348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift */,
-				BB6DD81B29348F31001F0544 /* KMSecureTextFiled.swift */,
 				BB8115FE2992682F0008F536 /* KMSecureLimitAlertView.swift */,
 				BBA8B7A92935DC120097D183 /* KMRemovePasswordResultTipView.swift */,
 				BB8115FA29924A5F0008F536 /* KMSecureEncryptCheckCellView.swift */,
@@ -14141,15 +14130,6 @@
 			path = CheckFileUpdate;
 			sourceTree = "<group>";
 		};
-		BBA8B7AD293600590097D183 /* Window */ = {
-			isa = PBXGroup;
-			children = (
-				BBA8B7AE293600D70097D183 /* KMPasswordInputWindow.swift */,
-				BBA8B7B2293635D80097D183 /* KMPasswordInputWindow.xib */,
-			);
-			path = Window;
-			sourceTree = "<group>";
-		};
 		BBA9220F2B4E77BA0061057A /* Purchase */ = {
 			isa = PBXGroup;
 			children = (
@@ -15183,6 +15163,32 @@
 			path = KMHomeQuickTools;
 			sourceTree = "<group>";
 		};
+		F321C1E02CD9EF73009982C8 /* Secure */ = {
+			isa = PBXGroup;
+			children = (
+				F321C1EA2CD9F0DD009982C8 /* View */,
+				F321C1E12CD9EF73009982C8 /* Window */,
+			);
+			path = Secure;
+			sourceTree = "<group>";
+		};
+		F321C1E12CD9EF73009982C8 /* Window */ = {
+			isa = PBXGroup;
+			children = (
+				F321C1E22CD9EF73009982C8 /* KMPasswordInputWindow.swift */,
+				F321C1E32CD9EF73009982C8 /* KMPasswordInputWindow.xib */,
+			);
+			path = Window;
+			sourceTree = "<group>";
+		};
+		F321C1EA2CD9F0DD009982C8 /* View */ = {
+			isa = PBXGroup;
+			children = (
+				F321C1EC2CD9F0DD009982C8 /* KMSecureTextFiled.swift */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
 		F337CC422CC7EDD000D46AF4 /* KMNPDFInsert */ = {
 			isa = PBXGroup;
 			children = (
@@ -15366,6 +15372,7 @@
 		F3D395632CBD2BE7000C6729 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
+				F321C1E02CD9EF73009982C8 /* Secure */,
 				9FAAA33C290FEC4D0046FFCE /* Category */,
 				650FF6732CC896D90019FAE1 /* PDFPreview */,
 				F352428B2CCB768B0000A901 /* KMNFileAttribute */,
@@ -15390,6 +15397,7 @@
 		F3DB85E82CCA209600D0AFDE /* Base */ = {
 			isa = PBXGroup;
 			children = (
+				F321C20F2CDA0C5E009982C8 /* BaseXibView.swift */,
 				F3DB85E92CCA209600D0AFDE /* KMNBaseViewController.swift */,
 				F3DB85EB2CCA209600D0AFDE /* KMNBaseWindowController.swift */,
 			);
@@ -15874,6 +15882,7 @@
 				F328C0BD2CA177DD00BFDD23 /* PresentImage.xcassets in Resources */,
 				AD8810AC29A8463600178CA1 /* KMAccountInfoWindowController.xib in Resources */,
 				ADDF835C2B391A5C00A81A4E /* CDSignatureCertificateStateViewController.xib in Resources */,
+				F321C1E72CD9EF74009982C8 /* KMPasswordInputWindow.xib in Resources */,
 				ADC63E432A49817400854E02 /* KMSubscribeSuccessView.xib in Resources */,
 				ADE86AF22B0AF56C00414DFA /* KMCompareCoveringSettingView.xib in Resources */,
 				9FF371C22C69A6BB005F9CC5 /* CPerimeterMeasureInfoWindowController.xib in Resources */,
@@ -16203,7 +16212,6 @@
 				BBFE6E782930E53000142C01 /* KMMergePopoverViewController.xib in Resources */,
 				AD58F41A2B1DAC1500299EE0 /* KMPrintSettingView.xib in Resources */,
 				9F8539DA294318D600DF644E /* TabsImage.xcassets in Resources */,
-				BBA8B7B3293635D80097D183 /* KMPasswordInputWindow.xib in Resources */,
 				8997010128F40710009AF911 /* KMBookMarkViewController.xib in Resources */,
 				BBE788A52CBD2463008086E2 /* SliderVC.xib in Resources */,
 				89E4E7382964148E002DBA6F /* KMAnnotationPropertiesViewController.xib in Resources */,
@@ -16607,7 +16615,6 @@
 				BB88106B2B4F771D00AFA63E /* KMVerificationInfoViewController.xib in Resources */,
 				ADDF833F2B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib in Resources */,
 				BBEC00DD295C39FD00A26C98 /* KMBatesPropertyInfoController.xib in Resources */,
-				BBA8B7B4293635D80097D183 /* KMPasswordInputWindow.xib in Resources */,
 				BBBAECF92B57672C00266BD3 /* TransitionSheet.xib in Resources */,
 				BBD8EE912B8EC86900EB05FE /* AutoSavePopController.xib in Resources */,
 				9FDCD8122B6C904900E22166 /* KMFormListMenuPopWindowController.xib in Resources */,
@@ -16891,6 +16898,7 @@
 				BB6710622BC672260018CE54 /* KMSignatureWindowController.xib in Resources */,
 				BB5DA54E2BCFF4B300849E86 /* KMPageEditPopViewController.xib in Resources */,
 				ADD1B6FD2946C0D400C3FFF7 /* KMPrintChoosePageSizePamphletView.xib in Resources */,
+				F321C1E82CD9EF74009982C8 /* KMPasswordInputWindow.xib in Resources */,
 				BB276A5D2B038D3A00AB5578 /* KMOCRPDFWindowController.xib in Resources */,
 				ADF9ED3429A850D200C4A943 /* KMAccountInfoView.xib in Resources */,
 				ADE787AF2AA5AA50002EC85A /* KMAccountExceptionView.xib in Resources */,
@@ -17123,6 +17131,7 @@
 				BB96A0B62AFCD56B00559E24 /* KMToolCompareWindowController.xib in Resources */,
 				9FDD0F9E2952FF4D000C4DAD /* comp-light.json in Resources */,
 				9F94747D29FA22700042F949 /* InfoPlist.strings in Resources */,
+				F321C1E92CD9EF74009982C8 /* KMPasswordInputWindow.xib in Resources */,
 				BB955ECA2CD8ED0F0042FDE1 /* KMNWatermarkTemplateItem.xib in Resources */,
 				BBE788E32CBD2464008086E2 /* InputDemoVC.xib in Resources */,
 				9FF94F0E29A62B5000B1EF69 /* KMDesignSelect.xib in Resources */,
@@ -17184,7 +17193,6 @@
 				AD7D5CF22B96B9E1006562CD /* KMBookmarkOutlineRowView.xib in Resources */,
 				AD1FE8492BD7C98300AA4A9B /* KMPDFPosterPrintWindowController.xib in Resources */,
 				AD1CA41E2A061CE10070541F /* KMAnnotationScreenTypeViewItem.xib in Resources */,
-				BBA8B7B5293635D80097D183 /* KMPasswordInputWindow.xib in Resources */,
 				89752DB22936F505003FF08E /* KMCustomButtonPopMenuViewController.xib in Resources */,
 				BB9DEE862A14A01D00351CC4 /* PDF-Reader-Pro-DMG-Info.plist in Resources */,
 				BB8810A52B4F7D1000AFA63E /* KMVerificationActivateViewController.xib in Resources */,
@@ -18010,7 +18018,6 @@
 				AD59993E2AD7E88600412F8B /* KMStampManager.swift in Sources */,
 				BB147014299DC0D100784A6A /* OIDAuthState.m in Sources */,
 				BB3AAB9029878CE000992A5A /* KMWatermarkAdjectivePropertyMainController.swift in Sources */,
-				BB5A9D6F2CB6525C00F64C1F /* BaseXibView.swift in Sources */,
 				BB147038299DC0D200784A6A /* OIDAuthorizationResponse.m in Sources */,
 				899700FE28F40710009AF911 /* KMBookMarkViewController.swift in Sources */,
 				BB2EDF6D296ECE17003BCF58 /* KMPageEditInsertDirectionItemView.swift in Sources */,
@@ -18195,6 +18202,7 @@
 				AD68782129A5FADC005B5210 /* KMLightMemberCache.swift in Sources */,
 				AD8F06172999DB5900D93CBC /* KMPrintDrawPage.swift in Sources */,
 				BB14702F299DC0D100784A6A /* OIDTokenUtilities.m in Sources */,
+				F321C2102CDA0C5E009982C8 /* BaseXibView.swift in Sources */,
 				89752E042939DB42003FF08E /* KMToolbarViewController.swift in Sources */,
 				BB146FD5299DC0D100784A6A /* GTLRObject.m in Sources */,
 				8942F7F02926087200389627 /* KMSearchViewController.swift in Sources */,
@@ -18234,6 +18242,7 @@
 				F3EF178F2CD5FD4B0007D364 /* KMNLeftSideViewController.swift in Sources */,
 				6554450E2C88483C00BD9010 /* KMDiscountToSaveWindowController.m in Sources */,
 				BB93CDE92AE7B6E100B29C57 /* KMToolbarView.swift in Sources */,
+				F321C1E42CD9EF74009982C8 /* KMPasswordInputWindow.swift in Sources */,
 				BB2F18462A0C7E250003F65E /* KMConvertBaseView.swift in Sources */,
 				BB99ACCA292DEE6E0048AFD9 /* KMMergeTitleBar.swift in Sources */,
 				ADBC174F2A2991F700959CEE /* KMPurchaseManager.swift in Sources */,
@@ -18320,7 +18329,6 @@
 				F3DB86062CCA691B00D0AFDE /* KMNExtractPDFWindowController.swift in Sources */,
 				AD1FE82C2BD7C98300AA4A9B /* KMPDFBookletWindowController.m in Sources */,
 				BB14701A299DC0D100784A6A /* OIDURLSessionProvider.m in Sources */,
-				BBA8B7AF293600D70097D183 /* KMPasswordInputWindow.swift in Sources */,
 				BBEC00A4295BD42D00A26C98 /* KMHeaderFooterPageInfoView.swift in Sources */,
 				BBD1F787296FAC7C00343885 /* KMPageEditSettingBaseView.swift in Sources */,
 				ADE86AC02B034C7100414DFA /* KMBackgroundWindowController.swift in Sources */,
@@ -18471,7 +18479,6 @@
 				BB6013902AD3AFF000A76FB2 /* NSPopover+KMExtension.swift in Sources */,
 				BB2EDF79296ECE17003BCF58 /* KMPageEditThumbnailItem.swift in Sources */,
 				899700E828F3E4D3009AF911 /* MainWindowController.swift in Sources */,
-				BB6DD81C29348F31001F0544 /* KMSecureTextFiled.swift in Sources */,
 				BB8F4572295ACE380037EA22 /* KMHeaderFooterAdjectiveListCell.swift in Sources */,
 				BB072D662C05B44300779B45 /* KMToolbarConfigModel.swift in Sources */,
 				BB0FE04C2B734DD1001E0F88 /* AIPurchaseWindowController.swift in Sources */,
@@ -18793,6 +18800,7 @@
 				BB3D971A2B3060B5007094C8 /* KMPDFAnnotationRedactConfig.swift in Sources */,
 				BB14703B299DC0D200784A6A /* OIDErrorUtilities.m in Sources */,
 				BB853C862AF8BC12009C20C1 /* KMAddPasswordOperationQueue.swift in Sources */,
+				F321C1F62CD9F0DD009982C8 /* KMSecureTextFiled.swift in Sources */,
 				F34BF93529530708002C25A2 /* NSImage+PDFListView.m in Sources */,
 				BBAC26A42AFE134300563A08 /* KMToolbarItemPopViewController.swift in Sources */,
 				BB5DA54A2BCFF4B300849E86 /* KMPageEditPopViewController.m in Sources */,
@@ -19057,6 +19065,7 @@
 				9FD0D2B42AD5265A00DA3FF8 /* CPDFListAnnotationNoteWindowController.swift in Sources */,
 				9F3D819429A33A290087B5AD /* KMDesignDropdown.swift in Sources */,
 				9F0CB4802967F64D00007028 /* KMPropertiesPanelReadOnlySubVC.swift in Sources */,
+				F321C1F72CD9F0DD009982C8 /* KMSecureTextFiled.swift in Sources */,
 				BB8810862B4F7C2200AFA63E /* KMVerificationAlertViewController.m in Sources */,
 				65D88ED32C85826A00DD06E0 /* KMRSAUtils.swift in Sources */,
 				BB2EDF77296ECE17003BCF58 /* KMPageEditInsertPageSizeItemView.swift in Sources */,
@@ -19068,6 +19077,7 @@
 				BB1CA5CC298E5F540059E31C /* KMMergeTools.swift in Sources */,
 				89D9896D28FD50EF003A3E87 /* KMAnnotationCollectionViewItem.swift in Sources */,
 				BB146FDF299DC0D100784A6A /* GTLRDriveObjects.m in Sources */,
+				F321C2112CDA0C5E009982C8 /* BaseXibView.swift in Sources */,
 				BB30D4832B90249D00702541 /* KMStatusBar.m in Sources */,
 				9F0CB5122986565700007028 /* KMDesignToken+BorderRadius.swift in Sources */,
 				9F69DBB32B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */,
@@ -19588,7 +19598,6 @@
 				BB03D68D2B01C782008C9976 /* KMPDFEditInsertBlankPageWindow.swift in Sources */,
 				BB031B612C47BB080099F7AD /* KMUserFeekbackWindowController.swift in Sources */,
 				BBE7891B2CBD2464008086E2 /* ModalVC.swift in Sources */,
-				BBA8B7B0293600D70097D183 /* KMPasswordInputWindow.swift in Sources */,
 				ADC63E382A49813E00854E02 /* KMSubscribeSuccessWindowController.swift in Sources */,
 				BB853C9E2AF8E436009C20C1 /* KMBatchRemovePasswordOperation.swift in Sources */,
 				BB74DA782AC41182006EDFE7 /* NSFont+KMExtension.swift in Sources */,
@@ -19698,7 +19707,6 @@
 				AD3AAD5D2B0DA3D400DE5FE7 /* KMCompareTextViewItem.swift in Sources */,
 				AD3AAD242B0B6F9E00DE5FE7 /* KMCompareContentView.swift in Sources */,
 				BB10FAE62AFE039E00F18D65 /* KMPDFEditPageRangeWindowController.swift in Sources */,
-				BB5A9D702CB6525C00F64C1F /* BaseXibView.swift in Sources */,
 				BB183DE42B4EC0AF00F99C7E /* KMRepeatVerifyExpireController.m in Sources */,
 				BBC3482F29559E12008D2CD1 /* KMBackgroundModel.swift in Sources */,
 				BB24FFDE2B28578C00A59054 /* KMTTSWindowController.swift in Sources */,
@@ -19819,7 +19827,6 @@
 				BB88107D2B4F7A1F00AFA63E /* KMActivityALertViewController.m in Sources */,
 				BB6B436C2A04935000E02B54 /* KMPDFThumbViewBaseController.swift in Sources */,
 				ADE3C1FA29A5C42300793B13 /* KMLightMemberUserInfo.swift in Sources */,
-				BB6DD81D29348F31001F0544 /* KMSecureTextFiled.swift in Sources */,
 				BBC3482A29559B22008D2CD1 /* KMBackgroundListCell.swift in Sources */,
 				ADAC0DE62AC2B04900FD4F52 /* KMNoteTypeImageView.swift in Sources */,
 				BBB9B317299A5D6D004F3235 /* KMDropboxManager.m in Sources */,
@@ -19836,6 +19843,7 @@
 				BB42A5D92B8F0F840092C524 /* KMTabbingHintWindowController.swift in Sources */,
 				BB67EE1B2B54FFEF00573BF0 /* ASIHTTPRequest.m in Sources */,
 				BB031B7C2C47BB090099F7AD /* KMUserFbListHeaderItemView.swift in Sources */,
+				F321C1E52CD9EF74009982C8 /* KMPasswordInputWindow.swift in Sources */,
 				BB147000299DC0D100784A6A /* OIDRedirectHTTPHandler.m in Sources */,
 				AD055E672B872FB50035F824 /* SKAlias.m in Sources */,
 				BB147003299DC0D100784A6A /* OIDScopeUtilities.m in Sources */,
@@ -20367,6 +20375,7 @@
 				9FCFEC8A2AD0EF9900EAD2CB /* KMPopMenuButton.swift in Sources */,
 				BB6DD80E29347F77001F0544 /* KMSecureEncryptWindowController.swift in Sources */,
 				AD53B70029AC5FCD00D61E81 /* KMLightMemberToken.swift in Sources */,
+				F321C1F82CD9F0DD009982C8 /* KMSecureTextFiled.swift in Sources */,
 				BB4A94A22B04D8EC00940F8B /* KMGOCRManager.m in Sources */,
 				F337CC1E2CC6456D00D46AF4 /* KMNThumbnailBaseViewController.swift in Sources */,
 				9F1FE4A129406E4700E952CA /* HoverButton.m in Sources */,
@@ -20569,7 +20578,6 @@
 				89752E1B2941FD48003FF08E /* KMSearchCellView.swift in Sources */,
 				BB146FC8299DC0D100784A6A /* GTMSessionFetcherService.m in Sources */,
 				ADE86AD82B05A52B00414DFA /* KMCompareFilesConfig.swift in Sources */,
-				BB6DD81E29348F31001F0544 /* KMSecureTextFiled.swift in Sources */,
 				BB2EDF7B296ECE17003BCF58 /* KMPageEditThumbnailItem.swift in Sources */,
 				9FD0FA4D29D43D6800F2AB0D /* KMDeviceBrowserWindowController.swift in Sources */,
 				BB146FC2299DC0D100784A6A /* GTMSessionFetcherLogging.m in Sources */,
@@ -20632,7 +20640,6 @@
 				AD199DFA2B26A36500D56FEE /* KMPrintPosterPreviewView.swift in Sources */,
 				ADFA8EFF2B5649AE002595A4 /* KMAutoFlowOptionsSheetController.swift in Sources */,
 				BB88109C2B4F7CD100AFA63E /* KMVerificationTrialViewController.m in Sources */,
-				BB5A9D712CB6525C00F64C1F /* BaseXibView.swift in Sources */,
 				BB2EDF6C296ECE17003BCF58 /* KMPageEditInsertTypeItemView.swift in Sources */,
 				BBD7FE052A1323A400F96075 /* KMEditImagePropertyViewController.swift in Sources */,
 				BBBB6CD02AD13E210035AA66 /* CPDFButtonWidgetAnnotation+PDFListView.swift in Sources */,
@@ -20656,7 +20663,6 @@
 				651559212CCA6E3100C0F0D9 /* KMConvertExcelWindowController.swift in Sources */,
 				BBBE208D2B21649100509C4E /* KMPDFEditWindowController.swift in Sources */,
 				F30B22872CB8D9630041002E /* KMNQuickToolCollectionViewItem.swift in Sources */,
-				BBA8B7B1293600D70097D183 /* KMPasswordInputWindow.swift in Sources */,
 				BB14701F299DC0D100784A6A /* OIDIDToken.m in Sources */,
 				65D88ED42C85826A00DD06E0 /* KMRSAUtils.swift in Sources */,
 				89D2D30A295A83B500BFF5FE /* KMEditPDFTextPropertyViewController.swift in Sources */,
@@ -20899,6 +20905,7 @@
 				BB2C846B2BAE716600AF6142 /* KMSegmentedControl.swift in Sources */,
 				9F0CB4612966C9E200007028 /* KMFormPropertPanelViewController.swift in Sources */,
 				9F1FE4EF29406E4700E952CA /* ThrobberView.m in Sources */,
+				F321C1E62CD9EF74009982C8 /* KMPasswordInputWindow.swift in Sources */,
 				BB3A668E2B06FD0100575343 /* KMBotaEnum.swift in Sources */,
 				AD867F9229D9554F00F00440 /* KMBOTAOutlineItem.swift in Sources */,
 				BBB9B327299A5D6D004F3235 /* GTMKeychain_macOS.m in Sources */,
@@ -21070,6 +21077,7 @@
 				BB2C846E2BAE716600AF6142 /* KMBotaTableRowView.swift in Sources */,
 				BB897253294C3F660045787C /* KMMenuTableView.swift in Sources */,
 				BB88E45A29404752002B3655 /* KMPDFConvert.swift in Sources */,
+				F321C2122CDA0C5F009982C8 /* BaseXibView.swift in Sources */,
 				BB147004299DC0D100784A6A /* OIDScopeUtilities.m in Sources */,
 				AD3AAD832B0E004B00DE5FE7 /* KMPostionIndicateView.swift in Sources */,
 				BB4D02AB2C22D17B0001474A /* KMEditPDFPopGuideView.swift in Sources */,

+ 3 - 3
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/dinglingui.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,17 +7,17 @@
 		<key>PDF Reader Pro DMG.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>3</integer>
 		</dict>
 		<key>PDF Reader Pro Edition.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>2</integer>
+			<integer>5</integer>
 		</dict>
 		<key>PDF Reader Pro.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>0</integer>
+			<integer>1</integer>
 		</dict>
 	</dict>
 </dict>