diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2006-01-20 18:55:19 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2006-01-20 18:55:19 +0000 |
commit | 6674469f15a90c92422def34b9e2a05cad7d7c27 (patch) | |
tree | c6331b3e785f73b000c4d01865a06d3e93db04a8 | |
parent | 87b9292ac3034a8d1c0142da390857d179830f0f (diff) | |
download | drakx-6674469f15a90c92422def34b9e2a05cad7d7c27.tar drakx-6674469f15a90c92422def34b9e2a05cad7d7c27.tar.gz drakx-6674469f15a90c92422def34b9e2a05cad7d7c27.tar.bz2 drakx-6674469f15a90c92422def34b9e2a05cad7d7c27.tar.xz drakx-6674469f15a90c92422def34b9e2a05cad7d7c27.zip |
- Fixed HPLIP setup when setting up a printer without auto-detection
(bug #20231).
-rw-r--r-- | perl-install/printer/printerdrake.pm | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index 00366306c..7f63a29a1 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -2423,7 +2423,8 @@ sub hplip_bus_warning { N("What do you want to do?"), [N("Set up with HPLIP"), N("Set up without HPLIP"), - N("Cancel setup")], N("Cancel setup")); + #N("Cancel setup") + ], N("Set up without HPLIP")); if ($choice eq N("Set up with HPLIP")) { return 1; } elsif ($choice eq N("Set up without HPLIP")) { @@ -2525,10 +2526,21 @@ sub setup_common { if !$printer->{noninteractive}; if ($isHPLIP && ($device !~ m!^socket://!)) { + # Determine connection type + my $bus; + if ($device =~ /usb/) { + $bus = "usb"; + } elsif ($device =~ m!/dev/(lp|par.*|printer.*)\d+!) { + $bus = "par"; + } elsif ($device =~ m!^socket://!) { + $bus = "net"; + } else { + $bus = "@@@"; + } my @uris = printer::main::start_hplip_manual(); my (@menu, %menuhash); foreach my $item (@uris) { - if ($item =~ m!^hp:/(usb|par|net)/(\S*?)(\?\S*|)$!) { + if ($item =~ m!^hp:/($bus)/(\S*?)(\?\S*|)$!) { my $modelname = $2; $modelname =~ s/_/ /g; $modelname = "HP " . $modelname @@ -2539,26 +2551,37 @@ sub setup_common { } undef $w; local $::isWizard = 0; - my $choice = $in->ask_from_list - (N("Add a new printer"), - N("Which printer do you want to set up with HPLIP?"), - \@menu, $menu[0]); - $hplipdevice = $menuhash{$choice}; - $hplipentry = - printer::main::hplip_device_entry_from_uri - ($hplipdevice); - if ($hplipentry) { - my $buswarning = - hplip_bus_warning($printer, $in, - $device, $hplipentry); - return 0 if !$buswarning; - if ($buswarning == 2) { + if ($#menu >= 0) { + my $choice = $in->ask_from_list + (N("Add a new printer"), + N("Which printer do you want to set up with HPLIP?"), + \@menu, $menu[0]); + $hplipdevice = $menuhash{$choice}; + $hplipentry = + printer::main::hplip_device_entry_from_uri + ($hplipdevice); + if ($hplipentry) { + my $buswarning = + hplip_bus_warning($printer, $in, + $device, $hplipentry); + return 0 if !$buswarning; + if ($buswarning == 2) { + $hplipaborted = 1; + $hplipdevice = ""; + } else { + $makemodel = $choice; + } + } else { + $in->ask_warn(N("Printerdrake"), + N("HPLIP was not able to communicate with the chosen printer!") . " " . + N("Setting up the printer without HPLIP...")); $hplipaborted = 1; $hplipdevice = ""; - } else { - $makemodel = $choice; } } else { + $in->ask_warn(N("Printerdrake"), + N("HPLIP did not find any local printers (Parallel, USB) which it supports!") . " " . + N("Setting up the printer without HPLIP...")); $hplipaborted = 1; $hplipdevice = ""; } |