From 8c847f02b2ff79db0f8ecc0a3041d964f0658c37 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 16 Feb 2003 20:22:24 +0000 Subject: - factorize "Help"-button handling - fix interactive_help_get_id (happily, it was no pb :) --- perl-install/interactive.pm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'perl-install/interactive.pm') diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index 2af88092a..d9c4b2f3b 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -364,7 +364,7 @@ sub ask_from_normalize { ($common->{title} = $0) =~ s|.*/||; } $common->{interactive_help} ||= $o->{interactive_help}; - $common->{interactive_help} ||= $common->{interactive_help_id} && sub { $o->interactive_help_get_id($common->{interactive_help_id}) }; + $common->{interactive_help} ||= $common->{interactive_help_id} && $o->interactive_help_sub_get_id($common->{interactive_help_id}); $common->{advanced_label} ||= N("Advanced"); $common->{advanced_label_close} ||= N("Basic"); $common->{$_} = [ deref($common->{$_}) ] foreach qw(messages advanced_messages); @@ -394,7 +394,7 @@ sub ask_from_real { sub ask_browse_tree_info { my ($o, $title, $message, $common) = @_; - $common->{interactive_help} ||= $common->{interactive_help_id} && sub { $o->interactive_help_get_id($common->{interactive_help_id}) }; + $common->{interactive_help} ||= $common->{interactive_help_id} && $o->interactive_help_sub_get_id($common->{interactive_help_id}); add2hash_($common, { ok => $::isWizard ? ($::Wizard_finished ? N("Finish") : N("Next ->")) : N("Ok"), cancel => $::isWizard ? N("<- Previous") : N("Cancel") }); add2hash_($common, { title => $title, message => $message }); @@ -470,11 +470,27 @@ sub helper_separator_tree_to_tree { } +sub interactive_help_has_id { + my ($_o, $id) = @_; + exists $help::steps{$id}; +} + sub interactive_help_get_id { - my @l = map { + my ($_o, @l) = @_; + @l = map { join("\n\n", map { s/\n/ /mg; $_ } split("\n\n", translate($help::steps{$_}))) - } grep { exists $help::steps{$_} } @_; + } grep { exists $help::steps{$_} } @l; join("\n\n\n", @l); } +sub interactive_help_sub_get_id { + my ($o, $id) = @_; + $o->interactive_help_has_id($id) && sub { $o->interactive_help_get_id($id) }; +} + +sub interactive_help_sub_display_id { + my ($o, $id) = @_; + $o->interactive_help_has_id($id) && sub { $o->ask_warn(N("Help"), $o->interactive_help_get_id($id)) }; +} + 1; -- cgit v1.2.1