diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2005-10-20 14:05:54 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2005-10-20 14:05:54 +0000 |
commit | 89a0b8ea361cfbb76ab7134bbde229ddc26aa385 (patch) | |
tree | e76808781669e666500d40c932ed6a3bfdff52ac /perl-install/printer/cups.pm | |
parent | 427e75a16cb154abb9560314c3e9ea820b2ea072 (diff) | |
download | drakx-backup-do-not-use-89a0b8ea361cfbb76ab7134bbde229ddc26aa385.tar drakx-backup-do-not-use-89a0b8ea361cfbb76ab7134bbde229ddc26aa385.tar.gz drakx-backup-do-not-use-89a0b8ea361cfbb76ab7134bbde229ddc26aa385.tar.bz2 drakx-backup-do-not-use-89a0b8ea361cfbb76ab7134bbde229ddc26aa385.tar.xz drakx-backup-do-not-use-89a0b8ea361cfbb76ab7134bbde229ddc26aa385.zip |
- Updated printerdrake to the state of Mandriva 2006:
o HPLIP support
o Gutenprint support
o support for several other new drivers
o Printer communication error handling
o Main window of printerdrake comes up faster
o Many bug fixes and detail improvements
Diffstat (limited to 'perl-install/printer/cups.pm')
-rw-r--r-- | perl-install/printer/cups.pm | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/perl-install/printer/cups.pm b/perl-install/printer/cups.pm index ab9e28b21..eb443482e 100644 --- a/perl-install/printer/cups.pm +++ b/perl-install/printer/cups.pm @@ -27,15 +27,17 @@ sub lpstat_lpv() { my $currentitem = -1; for my $line (@lpstat) { - chomp ($line); - if (!($line =~ m!^\s*$!)) { - if ($line =~ m!^printer\s+(\S+)\s+(\S.*)$!) { + chomp($line); + if ($line !~ m!^\s*$!) { + if ($line =~ m!^printer\s+(\S+)\s+.*\b(enabled|disabled)\b!) { # Beginning of new printer's entry my $name = $1; + my $state = $2; push(@items, {}); $currentitem = $#items; $itemshash->{$name} = $currentitem; $items[$currentitem]{queuename} ||= $name; + $items[$currentitem]{state} ||= $state; } elsif ($line =~ m!^\s+Description:\s+(\S.*)$!) { # Description field if ($currentitem != -1) { @@ -51,7 +53,7 @@ sub lpstat_lpv() { my $name = $1; my $uri = $2; if (defined($itemshash->{$name})) { - if ($uri !~ /:/) {$uri = "file:" . $uri}; + if ($uri !~ /:/) { $uri = "file:" . $uri } $currentitem = $itemshash->{$name}; if (($currentitem <= $#items) && ($items[$currentitem]{queuename} eq $name)) { @@ -114,10 +116,10 @@ sub get_formatted_remote_queues { map { join('!', if_($printer->{expert}, N("CUPS")), N("Configured on other machines"), $_); } map { - my $comment = N("On CUPS server \"%s\"", $_->{ipp}) . ($_->{queuename} eq $printer->{DEFAULT} ? N(" (Default)") : ""); + my $comment = N("On CUPS server \"%s\"", ($_->{ipp} ? $_->{ipp} : $printer->{remote_cups_server})) . ($_->{queuename} eq $printer->{DEFAULT} ? N(" (Default)") : ""); "$_->{queuename}: $comment"; } grep { - $_->{ipp} && !$printer->{configured}{$_->{queuename}}; + !$printer->{configured}{$_->{queuename}}; } lpstat_v(); } @@ -133,4 +135,13 @@ sub get_remote_queues { } lpstat_v(); } +sub queue_enabled { + my ($queue) = @_; + 0 != grep { + /\b$queue\b.*\benabled\b/i; + } run_program::rooted_get_stdout($::prefix, 'lpstat', '-p', $queue); +} + + + 1; |