Delete profiles to 0 stop the app, and Not auto connect if no activeProfile

This commit is contained in:
秦宇航
2017-07-22 13:14:03 +08:00
parent b143d78ef0
commit d529c29b20
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -201,7 +201,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
applyConfig()
SyncSSLocal()
if defaults.bool(forKey: "ConnectAtLaunch") {
if defaults.bool(forKey: "ConnectAtLaunch") && ServerProfileManager.instance.getActiveProfileId() != "" {
toggleRunning(toggleRunningMenuItem)
}
@@ -133,6 +133,9 @@ class PreferencesWindowController: NSWindowController
self.profilesTableView.scrollRowToVisible(index-1)
self.profilesTableView.selectRowIndexes(IndexSet(integer: index-1), byExtendingSelection: false)
updateProfileBoxVisible()
if profileMgr.profiles.count == 0 {
(NSApplication.shared().delegate as! AppDelegate).toggleRunning((NSApplication.shared().delegate as! AppDelegate).toggleRunningMenuItem)
}
}
@IBAction func ok(_ sender: NSButton) {