From b11bd6c8151fd5052206d03d42dc2cf6c2a1d5fa Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 13 Feb 2004 23:12:05 +0000 Subject: add 'default' field in order to be able to enforce default answer for yes/no like questions or when data does not conatains any fields (needed for last #7705 bit) --- perl-install/wizards.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'perl-install/wizards.pm') diff --git a/perl-install/wizards.pm b/perl-install/wizards.pm index e9f493eac..e875de052 100644 --- a/perl-install/wizards.pm +++ b/perl-install/wizards.pm @@ -31,6 +31,7 @@ wizards - a layer on top of interactive that ensure proper stepping post => sub { }, # code executing when stepping forward; # returned value is next step name (it overrides "next" field) end => , # is it the last step ? + default => , # default answer for yes/no or when data does not conatains any fields no_cancel => , # do not display the cancel button (eg for first step) no_back => , # do not display the back button (eg for first step) ignore => , # do not stack this step for back stepping (eg for warnings and the like steps) @@ -153,7 +154,7 @@ sub process { } my $name = ref($page->{name}) ? $page->{name}->() : $page->{name}; my %yesno = (yes => N("Yes"), no => N("No")); - my $yes; + my $yes = $page->{default}; $data2 = [ { val => \$yes, type => 'list', list => [ values %yesno ], gtk => { use_boxradio => 1 } } ] if $page->{type} eq "yesorno"; my $a; if (ref $data2 eq 'ARRAY' && @$data2) { @@ -163,7 +164,7 @@ sub process { if_($page->{interactive_help_id}, interactive_help_id => $page->{interactive_help_id}), }, $data2); } else { - $a = $in->ask_okcancel($o->{name}, $name); + $a = $in->ask_okcancel($o->{name}, $name, $yes); } # interactive->ask_yesorno does not support stepping forward or backward: $a = $yes if $a && $page->{type} eq "yesorno"; -- cgit v1.2.1