[BUG] Show import/export panel as modal panel.
This approach would ensure the panel show in most front and in center of screen.
This commit is contained in:
@ -79,7 +79,7 @@ class ServerProfileManager: NSObject {
|
||||
openPanel.canCreateDirectories = false
|
||||
openPanel.canChooseFiles = true
|
||||
openPanel.becomeKey()
|
||||
openPanel.begin { (result) -> Void in
|
||||
let result = openPanel.runModal()
|
||||
if (result == NSFileHandlingPanelOKButton && (openPanel.url) != nil) {
|
||||
let fileManager = FileManager.default
|
||||
let filePath:String = (openPanel.url?.path)!
|
||||
@ -124,7 +124,6 @@ class ServerProfileManager: NSObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func exportConfigFile() {
|
||||
//读取example文件,删掉configs里面的配置,再用NSDictionary填充到configs里面
|
||||
@ -164,7 +163,7 @@ class ServerProfileManager: NSObject {
|
||||
savePanel.allowedFileTypes = ["json"]
|
||||
savePanel.nameFieldStringValue = "export.json"
|
||||
savePanel.becomeKey()
|
||||
savePanel.begin { (result) -> Void in
|
||||
let result = savePanel.runModal()
|
||||
if (result == NSFileHandlingPanelOKButton && (savePanel.url) != nil) {
|
||||
//write jsonArr1 back to file
|
||||
try! jsonString.write(toFile: (savePanel.url?.path)!, atomically: true, encoding: String.Encoding.utf8)
|
||||
@ -176,7 +175,6 @@ class ServerProfileManager: NSObject {
|
||||
.deliver(notification)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class func showExampleConfigFile() {
|
||||
//copy file to ~/Downloads folder
|
||||
|
Reference in New Issue
Block a user