aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-01-03 22:48:05 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-14 14:52:32 +0530
commitf33cd0b6fd1dac1c8e72edd0b950c231f6242918 (patch)
tree8a6af59e22f426bd947d990a1194e2a1b44e5ca8 /WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
parentmacOS: Manage tunnels: Localize pulldown menu items (diff)
downloadwireguard-apple-f33cd0b6fd1dac1c8e72edd0b950c231f6242918.tar.xz
wireguard-apple-f33cd0b6fd1dac1c8e72edd0b950c231f6242918.zip
macOS: Manage tunnels: Import pulldown menu implementation
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift10
1 files changed, 9 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
index ca24acc7..5ceb2a1b 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
@@ -127,7 +127,15 @@ class TunnelsListTableViewController: NSViewController {
}
@objc func importTunnelClicked() {
- print("importTunnelClicked")
+ guard let window = view.window else { return }
+ let openPanel = NSOpenPanel()
+ openPanel.allowedFileTypes = ["conf", "zip"]
+ openPanel.beginSheetModal(for: window) { [weak tunnelsManager] response in
+ guard let tunnelsManager = tunnelsManager else { return }
+ guard response == .OK else { return }
+ guard let url = openPanel.url else { return }
+ TunnelImporter.importFromFile(url: url, into: tunnelsManager, sourceVC: nil, errorPresenterType: ErrorPresenter.self)
+ }
}
@objc func removeTunnelClicked() {