X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Feasydialog.sh;h=0113d9cb18885b997916996245d14d67064318df;hb=fdaede5adbff55369fb797a51af9982052bd6272;hp=5d70653a8f0d65c581cb515476ddd08e4ea54be8;hpb=688e9521a4307ca8510e0a9e9cfada98cdabcd58;p=matthijs%2Fupstream%2Fbackupninja-vserver.git diff --git a/handlers/easydialog.sh b/handlers/easydialog.sh index 5d70653..0113d9c 100644 --- a/handlers/easydialog.sh +++ b/handlers/easydialog.sh @@ -33,7 +33,7 @@ setDimension() { booleanBox() { $DIALOG --backtitle "$BACKTITLE" --title "$1" \ - --yesno "$2" $HEIGHT $WIDTH + `[ "$3" == no ] && echo '--defaultno'` --yesno "$2" $HEIGHT $WIDTH } msgBox() { @@ -157,11 +157,13 @@ listBegin() { _menu_items=0 _menu_text= _menu_labels= + _menu_status= } listItem() { _menu_labels[$_menu_items]=$1 _menu_text[$_menu_items]=$2 + _menu_status[$_menu_items]=$3 # available only for checklist let "_menu_items += 1" } @@ -175,6 +177,9 @@ listDisplay() { local temp=$(mktemp -t) || exit 1 trap "rm -f $temp" 0 + local label + local text + local status ( echo -ne " $HELP $_DEFAULT " echo -ne " --backtitle '$BACKTITLE' " @@ -184,7 +189,8 @@ listDisplay() { for ((i=0; i < $_menu_items ; i++)); do label=${_menu_labels[$i]} text=${_menu_text[$i]} - echo -ne " $label '$text' " + status=${_menu_status[$i]} + echo -ne " $label '$text' $status " done ) | xargs $DIALOG 2> $temp @@ -237,7 +243,13 @@ formDisplay() { done ) | xargs $DIALOG 2> $temp local status=$? - [ $status = 0 ] && REPLY=`cat $temp` + + REPLY= + if [ $status = 0 ]; then + IFS=$'' + REPLY=`cat $temp` + IFS=$' \t\n' + fi rm -f $temp return $status }