summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2004-03-05 03:11:09 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2004-03-05 03:11:09 +0000
commit91fa5771511a58bc1dbc33f3a5d65174ec76470c (patch)
tree374395d49b03c8207dcde9aef975903179322968 /perl-install
parent166751791f0845b41a7a27d3bf20d0222f820369 (diff)
downloaddrakx-backup-do-not-use-91fa5771511a58bc1dbc33f3a5d65174ec76470c.tar
drakx-backup-do-not-use-91fa5771511a58bc1dbc33f3a5d65174ec76470c.tar.gz
drakx-backup-do-not-use-91fa5771511a58bc1dbc33f3a5d65174ec76470c.tar.bz2
drakx-backup-do-not-use-91fa5771511a58bc1dbc33f3a5d65174ec76470c.tar.xz
drakx-backup-do-not-use-91fa5771511a58bc1dbc33f3a5d65174ec76470c.zip
Let URIs listed by "lpinfo -v" be shown in the dialog for entering a URI manually.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer/cups.pm16
-rw-r--r--perl-install/printer/printerdrake.pm38
2 files changed, 39 insertions, 15 deletions
diff --git a/perl-install/printer/cups.pm b/perl-install/printer/cups.pm
index 468625d65..ab9e28b21 100644
--- a/perl-install/printer/cups.pm
+++ b/perl-install/printer/cups.pm
@@ -77,6 +77,22 @@ sub lpstat_v() {
} run_program::rooted_get_stdout($::prefix, 'lpstat', '-v');
}
+sub lpinfo_v() {
+ map {
+ if (my ($type, $uri) = m/^\s*(\S+)\s+(\S+)\b/) {
+ if ($uri =~ m!:/!) {
+ $uri;
+ } elsif ($type =~ m/network/i) {
+ "$uri://";
+ } else {
+ "$uri:/";
+ }
+ } else {
+ ();
+ }
+ } run_program::rooted_get_stdout($::prefix, 'lpinfo', '-v');
+}
+
sub read_printer_list {
my ($printer) = @_;
# This function reads in a list of all printers which the local CUPS
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index 45762f1d9..d1944400d 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -512,7 +512,7 @@ Printers on remote CUPS servers do not need to be configured here; these printer
list => \@printertypes,
not_edit => 1, sort => 0,
type => 'list' },
- { text => N("Printer auto-detection (Local, TCP/Socket, and SMB printers)"),
+ { text => N("Printer auto-detection (Local, TCP/Socket, SMB printers, and device URI)"),
type => 'bool', val => \$autodetect }
]
) or return 0;
@@ -1693,24 +1693,32 @@ sub setup_uri {
my ($printer, $in, $upNetwork) = @_;
# $in->set_help('setupURI') if $::isInstall;
+ if ($printer->{AUTODETECT} and ($printer->{SPOOLER} eq 'cups')) {
+ my $_w = $in->wait_message(N("Printerdrake"),
+ N("Refreshing Device URI list..."));
+ printer::services::restart("cups");
+ }
return if !$in->ask_from(N("Printer Device URI"),
N("You can specify directly the URI to access the printer. The URI must fulfill either the CUPS or the Foomatic specifications. Note that not all URI types are supported by all the spoolers."), [
{ label => N("Printer Device URI"),
val => \$printer->{currentqueue}{connect},
-list => [ $printer->{currentqueue}{connect},
- "parallel:/",
- "usb:/",
- "serial:/",
- "http://",
- "ipp://",
- "lpd://",
- "smb://",
- "ncp://",
- "socket://",
- "ptal:/mlc:",
- "ptal:/hpjd:",
- "file:/",
- 'postpipe:""',
+list => [ if_($printer->{currentqueue}{connect},
+ $printer->{currentqueue}{connect}),
+ ($printer->{SPOOLER} eq 'cups' ?
+ printer::cups::lpinfo_v() :
+ ("parallel:/",
+ "usb:/",
+ "serial:/",
+ "http://",
+ "ipp://",
+ "lpd://",
+ "smb://",
+ "ncp://",
+ "socket://",
+ "ptal:/mlc:",
+ "ptal:/hpjd:",
+ "file:/",
+ 'postpipe:""')),
], not_edit => 0, sort => 0 }, ],
complete => sub {
unless ($printer->{currentqueue}{connect} =~ /[^:]+:.+/) {