prevent remove all servers
This commit is contained in:
@ -16,6 +16,7 @@
|
||||
<outlet property="profileBox" destination="oZ5-85-pwY" id="D19-PQ-X7E"/>
|
||||
<outlet property="profilesTableView" destination="r91-ho-Lum" id="TNk-f6-Vgo"/>
|
||||
<outlet property="remarkTextField" destination="q3C-S0-iNn" id="DSv-lV-PX7"/>
|
||||
<outlet property="removeButton" destination="3ei-2f-kHB" id="DdP-dA-coT"/>
|
||||
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
|
@ -26,6 +26,7 @@ class PreferencesWindowController: NSWindowController
|
||||
|
||||
@IBOutlet weak var copyURLBtn: NSButton!
|
||||
|
||||
@IBOutlet weak var removeButton: NSButton!
|
||||
let tableViewDragType: String = "ss.server.profile.data"
|
||||
|
||||
var defaults: NSUserDefaults!
|
||||
@ -33,6 +34,7 @@ class PreferencesWindowController: NSWindowController
|
||||
|
||||
var editingProfile: ServerProfile!
|
||||
|
||||
|
||||
override func windowDidLoad() {
|
||||
super.windowDidLoad()
|
||||
|
||||
@ -64,6 +66,7 @@ class PreferencesWindowController: NSWindowController
|
||||
|
||||
@IBAction func addProfile(sender: NSButton) {
|
||||
if editingProfile != nil && !editingProfile.isValid(){
|
||||
shakeWindows()
|
||||
return
|
||||
}
|
||||
profilesTableView.beginUpdates()
|
||||
@ -131,6 +134,12 @@ class PreferencesWindowController: NSWindowController
|
||||
}
|
||||
|
||||
func updateProfileBoxVisible() {
|
||||
if profileMgr.profiles.count == 1 {
|
||||
removeButton.enabled = false
|
||||
}else{
|
||||
removeButton.enabled = true
|
||||
}
|
||||
|
||||
if profileMgr.profiles.isEmpty {
|
||||
profileBox.hidden = true
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user