From d0491365909800f8010c393eb3a0b99aaceb3b8d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 12 Aug 2002 18:29:18 +0000 Subject: don't switch to 2 buttons dialog box if the labels are too long in ask_from_list (otherwise it's ugly (reported for XFdrake multi-head choice with 67 & 58 chars strings) (fix bug #62) --- perl-install/interactive.pm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index 619eeb3ab..3db0085f4 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -177,17 +177,19 @@ sub ask_from_listf_no_check { my ($o, $title, $message, $f, $l, $def, $help) = @_; if (@$l <= 2 && !$::isWizard) { - my $ret = eval { - ask_from_no_check($o, - { title => $title, messages => $message, ok => $l->[0] && may_apply($f, $l->[0]), - if_($l->[1], cancel => may_apply($f, $l->[1]), focus_cancel => $def eq $l->[1]) }, [] - ) ? $l->[0] : $l->[1]; - }; - die if $@ && $@ !~ /^wizcancel/; - $@ ? undef : $ret; - } else { - ask_from($o, $title, $message, [ { val => \$def, type => 'list', list => $l, help => $help, format => $f } ]) && $def; + my ($ok, $cancel) = map { $_ && may_apply($f, $_) } @$l; + if (length "$ok$cancel" < 70) { + my $ret = eval { + ask_from_no_check($o, + { title => $title, messages => $message, ok => $ok, + if_($cancel, cancel => $cancel, focus_cancel => $def eq $l->[1]) }, [] + ) ? $l->[0] : $l->[1]; + }; + die if $@ && $@ !~ /^wizcancel/; + return $@ ? undef : $ret; + } } + ask_from($o, $title, $message, [ { val => \$def, type => 'list', list => $l, help => $help, format => $f } ]) && $def; } sub ask_from_treelist { -- cgit v1.2.1