summaryrefslogtreecommitdiffstats
path: root/perl-install/diskdrake/dav.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/diskdrake/dav.pm')
-rw-r--r--perl-install/diskdrake/dav.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/perl-install/diskdrake/dav.pm b/perl-install/diskdrake/dav.pm
index 13f6e09fa..ad06f958c 100644
--- a/perl-install/diskdrake/dav.pm
+++ b/perl-install/diskdrake/dav.pm
@@ -42,9 +42,9 @@ sub config {
my $dav = { %$dav_ }; #- working on a local copy so that "Cancel" works
- my %actions = my @actions = actions();
my $action;
while ($action ne 'Done') {
+ my %actions = my @actions = actions($dav);
$action = $in->ask_from_list_('', format_dav_info($dav),
[ map { $_->[0] } group_by2 @actions ], 'Done') or return;
$actions{$action}->($in, $dav, $all_hds);
@@ -53,7 +53,11 @@ sub config {
}
sub actions {
+ my ($dav) = @_;
+
(
+ if_($dav && $dav->{isMounted}, __("Unmount") => sub { try('Unmount', @_) }),
+ if_($dav && $dav->{mntpoint} && !$dav->{isMounted}, __("Mount") => sub { try('Mount', @_) }),
__("Server") => \&ask_server,
__("Mount point") => \&mount_point,
__("Options") => \&options,
@@ -61,6 +65,15 @@ sub actions {
);
}
+sub try {
+ my ($name, $in, $dav) = @_;
+ my $f = $diskdrake::interactive::{$name} or die "unknown function $name";
+ eval { $f->($in, {}, $dav) };
+ if (my $err = $@) {
+ $in->ask_warn(_("Error"), formatError($err));
+ }
+}
+
sub ask_server {
my ($in, $dav, $all_hds) = @_;