summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-07-12 11:12:39 +0000
committerFrancois Pons <fpons@mandriva.com>2001-07-12 11:12:39 +0000
commit10fdeb879dd4751110f2c9f7ab7ca96121368558 (patch)
treeeec28416a241fc56ececb4af8a68b066b37d2914 /perl-install
parent503f836b14c309b96d868b3b8027974c73a712aa (diff)
downloaddrakx-backup-do-not-use-10fdeb879dd4751110f2c9f7ab7ca96121368558.tar
drakx-backup-do-not-use-10fdeb879dd4751110f2c9f7ab7ca96121368558.tar.gz
drakx-backup-do-not-use-10fdeb879dd4751110f2c9f7ab7ca96121368558.tar.bz2
drakx-backup-do-not-use-10fdeb879dd4751110f2c9f7ab7ca96121368558.tar.xz
drakx-backup-do-not-use-10fdeb879dd4751110f2c9f7ab7ca96121368558.zip
added ask_browse_tree_info and ask_browse_tree_info_refW (default).
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/interactive.pm36
1 files changed, 36 insertions, 0 deletions
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 6c3558301..ad1d4a380 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -284,6 +284,42 @@ sub ask_from_entries_refH_powered_no_check {
}
+sub ask_browse_tree_info {
+ my ($o, $title, $message, $common) = @_;
+ add2hash_($common, { ok => _("Ok"), cancel => _("Cancel") });
+ add2hash_($common, { title => $title, message => $message });
+ add2hash_($common, { grep_allowed_to_toggle => sub { @_ },
+ grep_unselected => sub { grep { $common->{node_state}($_) eq 'unselected' } @_ },
+ check_interactive_to_toggle => sub { 1 },
+ toggle_nodes => sub {
+ my ($set_state, @nodes) = @_;
+ my $new_state = !$common->{grep_unselected}($nodes[0]) ? 'selected' : 'unselected';
+ $set_state->($_, $new_state) foreach @nodes;
+ },
+ });
+ $o->ask_browse_tree_info_refW($common);
+}
+sub ask_browse_tree_info_refW { #- default definition, do not use with too many items (memory consuming)
+ my ($o, $common) = @_;
+ my ($l, $v, $h) = ([], [], {});
+ $common->{build_tree}(sub {
+ my ($node) = $common->{grep_allowed_to_toggle}(@_);
+ if (my $state = $node && $common->{node_state}($node)) {
+ push @$l, $node;
+ $state eq 'selected' and push @$v, $node;
+ $h->{$node} = $state eq 'selected';
+ }
+ }, 'flat');
+ add2hash_($common, { list => $l, #- TODO interactivity of toggle is missing
+ values => $v,
+ help => sub { $common->{get_info}($_) },
+ });
+ my ($new_v) = $o->ask_many_from_list($common->{title}, $common->{message}, $common) or return;
+ $common->{toggle_nodes}(sub {}, grep { ! delete $h->{$_} } @$new_v);
+ $common->{toggle_nodes}(sub {}, grep { $h->{$_} } keys %$h);
+ 1;
+}
+
sub wait_message {
my ($o, $title, $message, $temp) = @_;