package require java
GuidoForm SaveProfile {
-default_buttons
-label "Save Profile"
-layout BoxLayout Y_AXIS
GuidoFiller filler1 {
-height 0.5
}
GuidoComboBox profiles {
-display_length 16
-exclusive false
-input true
-max_length 32
-null true
-no_mlt
-validation {"[validateProfiles $profiles]"}
}
GuidoFiller filler2 {
-height 1.5
}
GuidoLabel label1 {
-label "Select the profile you wish to save as,"
}
GuidoLabel label2 {
-label "or enter a new profile name."
}
GuidoFiller filler3 {
-height 1.5
}
}
set buffer [ GuidoExecServer GetProfileList {} ]
set profilesSize [ GuidoGetParamBufferValue $buffer "profiles_size" ]
for {set i 0} {$i < $profilesSize} {incr i} {
set next "profile($i)"
$profiles addItem [ GuidoGetParamBufferValue $buffer $next ]
}
set currentProfile [java::call com.surpac.client.Profiles getCurrentProfile]
if {$currentProfile != ""} {
$profiles setCurrentValue $currentProfile
} else {
$profiles setCurrentValue "<new profile>"
}
while {1} {
$SaveProfile show modal
if {[$SaveProfile getStatus] != "apply"} {
break
}
java::call com.surpac.client.ClientManager setProfileModified true
set profile [$profiles getCurrentValue]
java::call com.surpac.client.Profiles setCurrentProfile $profile false
set status [java::call com.surpac.client.Profiles saveConfigResource]
if {$status != 0} {
break
}
java::call com.surpac.client.Profiles removeProfile $profile
java::call com.surpac.client.Profiles setCurrentProfile $currentProfile false
GuidoMessage warning SAVE_PROFILE_FAILED
}
$SaveProfile destroy
java::call com.surpac.client.ClientManager setProfileModified false
