### Copyright (C) 1996 Rasmus Ingemann Hansen
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 2 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

proc generel {} {
    # Generel
    Desc "Generel options"
    ShortDesc "Generel options"

    Header head1 \
	-text "Options for Elm in generel" \
	-background gray\
	-help ""

    CheckBox generelCheckBox1 \
	-text "When resync or change folders then display questions." \
	-help "Deselected to tell Elm that you rather not be asked `Delete messages?' and such each time  you quit, resynchronize, change folders, or return from the alias system, but that it should just use the values of alwaysdelete, alwaysstore, and alwayskeep without prompting."

    Int generelInt01 \
	-text "After displaying a transient message wait" \
	-textafter " sec., before erasing it and continuing" \
	-help "0 or positive number of seconds Elm should wait after displaying a transient message and before erasing it." \
	-width 3

    CheckBox generelCheckBox00 \
	-text "Allow sending mail without being presented the \"Copies to:\" prompt" \
	-help "This still allows you to explicitly include addresses in the \"Cc:\" list either via the header editor or \"~c\" in the builtin editor. Default is selected."

    CheckBox generelCheckBox2 \
	-text "Enable the generation of \"forms\" type messages." \
	-help "To be able to mail out AT&T Mail Forms."

    CheckBox generelCheckBox02 \
	-text "Use the \"termcap/terminfo\" ti/te capabilities" \
	-help "Select this to use the \"termcap/terminfo\" capabilities; some terminal emulators require it and some terminal emulators (xterms) clear the screen on \"te\". Default is selected."

####
    Line linea

    CheckBox generelCheckBox3 \
	-text "Enable a hop count treshold for automatically include a \"Cc:\"" \
	-help "Rarely to be used. Default is OFF."

    Entry generelEntry1 \
	-text "Set hop count treshold to " \
	-textafter "machines away" \
	-width 5

    Line lineb
####
    File-Dir-Browser generelDir1 \
	-text "Location of file to append found calendar entries to" \
	-exist 0
    foreach widget { generelDir1 } {
	Help $widget "Default is \"calendar\" in your home directory."
    }

    File-Dir-Browser editorOptionsDir1 \
	-text "The shell to use for shell escapes" \
	-exist 0
    foreach widget { editorOptionsDir1 } {
	Help $widget "If in doubt of location of shell, please type \"which sh\", \"which tcsh\", ..."
    }

    Entry printer\
        -text "When printing messages from Elm, use commands"\
        -default "lpr -P %s"\
        -help "Examples: \[ cat %s | lpr ],  \[ lp -dPS %s ],  \[ a5book | lpr -Pd3 %s ] \nwhere %s is the filename. Check path for the lp/lpr program with \"which lp\" / \"which lpr\", if in doubt." \
	-packFrame:expand 1 -packFrame:fill x -packEntry:fill x -packEntry:expand 1

    Label generel_USER

    Entry generelEE \
	-text "what is your `real'-name?" \
	-packFrame:expand 1 -packFrame:fill x -packEntry:fill x -packEntry:expand 1 \
	-help "For the outgoing mail."

    Frame frr \
	-entries {generel_USER generelEE} \
	-packFrame:fill x

#####
    Header head21 \
	-text "Addresses not to receive mail from" \
	-help ""

    CheckBox actionMenuCheckBox007 \
	-text "Have machine/username combinations that you receive mail from (forwarded):"

    Entry actionMenuEntry007 \
	-packFrame:expand 1 -packFrame:fill x -packEntry:fill x -packEntry:expand 1
    foreach widget { actionMenuCheckBox007 actionMenuEntry007 } {
	Help $widget "To ensure that you don't send yourself a copy of the outbound message, when the 'group reply' feature is invoked. Default is a list of no alternatives."
    }

  ################################ Change #################################
    Change {
	if {$actionMenuCheckBox007==0} {
		Disable actionMenuEntry007
	} else {
		Enable actionMenuEntry007
	}
	if {$generelCheckBox3==0} {
		Disable generelEntry1
	} else {
		Enable generelEntry1
	}
    }
  ################################ Init #################################
    Init {
        ### Read default values from shell ###
	set generel_USER "User \""
        if {[info exists env(USER)]} {
		set temp_generel_USER $env(USER)
		append generel_USER $temp_generel_USER
		append generel_USER "\","
        } {
            set com_generel_USER "hmmmm"
        }
    }


  ############################## Init / Save ##############################

    Init {
    }

    Save {
	print "\n# should the message disposition questions be displayed(ON) or\n# auto-answered(OFF) with the default answers when we resync or\n# change folders?"
	if {$generelCheckBox1==0} {
		print "ask = OFF"
	} else {
		print "ask = ON"
	}

	print "\n# time in seconds which Elm will wait after displaying a transient message\n# and before erasing it. Can be 0 or positive integer."
	if {$generelInt01=="2"} {
		print "###sleepmsg = 2"
	} else {
		print "sleepmsg = $generelInt01"
	}
	
	print "\n# would you like to be asked for Carbon-Copies information each msg?"
	if {$generelCheckBox00==0} {
		print "askcc = OFF"
	} else {
		print "###askcc = ON"
	}

	print "\n# do we want to be able to mail out AT&T Mail Forms?"
	if {$generelCheckBox2==0} {
		print "forms = OFF"
	} else {
		print "forms = ON"
	}

	print "\n# would you like to use termcap/terminfo ti/te entries?"
	if {$generelCheckBox02==0} {
		print "usetite = OFF"
	} else {
		print "usetite = ON"
	}

	print "\n# threshold for bouncing copies of remote uucp msg. 0 = disable"
	if {($generelCheckBox3==0) || ($generelEntry1=="")} {
		print "### bounceback = 0"
	} else {
		print "bounceback = $generelEntry1"
	}

	print "\n# The shell to use for shell escapes"
	print "shell = $editorOptionsDir1"

	print "\n# where to save calendar entries"
	print "calendar = $generelDir1"

	print "\n# how to print a message ('%s' is the filename)"
	print "print = $printer"

	print "\n# The full user name for outbound mail"
	if {$generelEE!=""} {
		print "fullname = $generelEE"
        } else {
		print "### fullname = "
	}

	print "\n# Addresses not to receive mail from (usually a forwarding mailbox)"
	if {$actionMenuCheckBox007==1 && $actionMenuEntry007!=""} {
		print "alternatives = $actionMenuEntry007"
	} else {
		print "\n###alternatives ="
	}
    }
}



