diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-11-05 23:42:40 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-11-05 23:42:40 +0000 |
commit | bebd541064aad79235a8bd1d25660295ee0582ca (patch) | |
tree | 1ba44913bfe3a023f81f21f13e1f74c0712e0af8 /perl-install/interactive.pm | |
parent | bc448596b2bbc05117484155c7b23aa74de237a6 (diff) | |
download | drakx-bebd541064aad79235a8bd1d25660295ee0582ca.tar drakx-bebd541064aad79235a8bd1d25660295ee0582ca.tar.gz drakx-bebd541064aad79235a8bd1d25660295ee0582ca.tar.bz2 drakx-bebd541064aad79235a8bd1d25660295ee0582ca.tar.xz drakx-bebd541064aad79235a8bd1d25660295ee0582ca.zip |
- do not handle "format"ing in interactive for combos
- do it in interactive::gtk instead (that way, "val" is back"format"ed in callbacks as wanted)
- die when editable combos are used with non-strings (like arrays or hashes)
Diffstat (limited to 'perl-install/interactive.pm')
-rw-r--r-- | perl-install/interactive.pm | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index bc7f5cdb6..6fec361b6 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -274,14 +274,12 @@ sub ask_from_normalize { $e->{type} = 'treelist' if $e->{separator}; add2hash_($e, { not_edit => 1 }); $e->{type} ||= 'combo'; - ${$e->{val}} = $li->[0] if ($e->{type} ne 'combo' || $e->{not_edit}) && !member(${$e->{val}}, @$li); - if ($e->{type} eq 'combo' && $e->{format}) { - my @l = map { $e->{format}->($_) } @{$e->{list}}; - delete $e->{format}; - each_index { - ${$e->{val}} = $l[$::i] if $_ eq ${$e->{val}}; - } @{$e->{list}}; - ($e->{list}, $e->{saved_list}) = (\@l, $e->{list}); + + if (!$e->{not_edit}) { + die q(when using "not_edit" you must use strings, not a data structure) if ref ${$e->{val}} || grep { ref } @$li; + } + if ($e->{type} ne 'combo' || $e->{not_edit}) { + ${$e->{val}} = $li->[0] if !member(may_apply($e->{format}, ${$e->{val}}), map { may_apply($e->{format}, $_) } @$li); } } elsif ($e->{type} eq 'range') { $e->{min} <= $e->{max} or die "bad range min $e->{min} > max $e->{max} (called from " . join(':', caller()) . ")"; @@ -338,13 +336,6 @@ sub ask_from_real { my ($o, $common, $l) = @_; my $v = $o->ask_fromW($common, [ grep { !$_->{advanced} } @$l ], [ grep { $_->{advanced} } @$l ]); %$common = (); - foreach my $e (@$l) { - my $l = delete $e->{saved_list} or next; - each_index { - ${$e->{val}} = $l->[$::i] if $_ eq ${$e->{val}}; - } @{$e->{list}}; - $e->{list} = $l; - } $v; } |