|
@@ -369,7 +369,50 @@ extension KMHomeViewController {
|
|
|
|
|
|
let model = KMDocumentModel()
|
|
|
model.documentURL = panel.url!
|
|
|
- if model.isLocked {
|
|
|
+ if model.isLocked && model.isEncrypt {
|
|
|
+ let passwordInputWindow = KMPasswordInputWindow().window()
|
|
|
+ passwordInputWindow?.documentURL = model.documentURL
|
|
|
+ passwordInputWindow?.type = .owner
|
|
|
+
|
|
|
+ passwordInputWindow?.itemClick = {
|
|
|
+ [self] (index: Int, string: String) in
|
|
|
+
|
|
|
+ self.view.window?.endSheet(passwordInputWindow!)
|
|
|
+ if index == 2 { /// 解密成功
|
|
|
+ model.owerPassword = string
|
|
|
+
|
|
|
+ var windowController: KMConvertBaseWindowController!
|
|
|
+ if view.indexOfSelectedItem == 0 { /// Word
|
|
|
+ windowController = KMConvertWordWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 1 {
|
|
|
+ windowController = KMConvertExcelWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 2 {
|
|
|
+ windowController = KMConvertPPTsWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 3 {
|
|
|
+ windowController = KMConvertCSVWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 4 {
|
|
|
+ windowController = KMConvertImageWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ }
|
|
|
+
|
|
|
+// windowController.documentURL = panel.url!
|
|
|
+ windowController.documentModel = model
|
|
|
+
|
|
|
+ windowController.itemClick = {
|
|
|
+ [self] (index: Int) in
|
|
|
+ if index == 1 { /// 批量转档
|
|
|
+ self.view.window?.endSheet(convertWindowController.window!)
|
|
|
+ } else if index == 2 { /// 关闭
|
|
|
+ self.view.window?.endSheet(convertWindowController.window!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ self.view.window?.beginSheet(windowController.window!)
|
|
|
+ convertWindowController = windowController
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.view.window?.beginSheet(passwordInputWindow!)
|
|
|
+ return
|
|
|
+ } else if (model.isLocked) {
|
|
|
let passwordInputWindow = KMPasswordInputWindow().window()
|
|
|
passwordInputWindow?.documentURL = model.documentURL
|
|
|
passwordInputWindow?.type = .open
|
|
@@ -394,6 +437,49 @@ extension KMHomeViewController {
|
|
|
windowController = KMConvertImageWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
}
|
|
|
|
|
|
+// windowController.documentURL = panel.url!
|
|
|
+ windowController.documentModel = model
|
|
|
+
|
|
|
+ windowController.itemClick = {
|
|
|
+ [self] (index: Int) in
|
|
|
+ if index == 1 { /// 批量转档
|
|
|
+ self.view.window?.endSheet(convertWindowController.window!)
|
|
|
+ } else if index == 2 { /// 关闭
|
|
|
+ self.view.window?.endSheet(convertWindowController.window!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ self.view.window?.beginSheet(windowController.window!)
|
|
|
+ convertWindowController = windowController
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.view.window?.beginSheet(passwordInputWindow!)
|
|
|
+ return
|
|
|
+ } else if (model.isEncrypt) {
|
|
|
+ let passwordInputWindow = KMPasswordInputWindow().window()
|
|
|
+ passwordInputWindow?.documentURL = model.documentURL
|
|
|
+ passwordInputWindow?.type = .owner
|
|
|
+
|
|
|
+ passwordInputWindow?.itemClick = {
|
|
|
+ [self] (index: Int, string: String) in
|
|
|
+
|
|
|
+ self.view.window?.endSheet(passwordInputWindow!)
|
|
|
+ if index == 2 { /// 解密成功
|
|
|
+ model.owerPassword = string
|
|
|
+
|
|
|
+ var windowController: KMConvertBaseWindowController!
|
|
|
+ if view.indexOfSelectedItem == 0 { /// Word
|
|
|
+ windowController = KMConvertWordWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 1 {
|
|
|
+ windowController = KMConvertExcelWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 2 {
|
|
|
+ windowController = KMConvertPPTsWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 3 {
|
|
|
+ windowController = KMConvertCSVWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ } else if view.indexOfSelectedItem == 4 {
|
|
|
+ windowController = KMConvertImageWindowController(windowNibName: "KMConvertBaseWindowController")
|
|
|
+ }
|
|
|
+
|
|
|
// windowController.documentURL = panel.url!
|
|
|
windowController.documentModel = model
|
|
|
|