summaryrefslogtreecommitdiffstats
path: root/perl-install/printer
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/printer')
-rw-r--r--perl-install/printer/main.pm33
-rw-r--r--perl-install/printer/printerdrake.pm17
2 files changed, 31 insertions, 19 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index 9eb64ad99..fd96b9b39 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -41,6 +41,11 @@ our %thedb;
our $hplipdevicesdb;
+# Translation of the "(recommended)" in printer driver entries
+our $recstr = N("recommended");
+our $precstr = "($recstr)";
+our $sprecstr = quotemeta($precstr);
+
#------------------------------------------------------------------------------
sub spooler() {
@@ -568,7 +573,7 @@ sub read_printer_db {
$driverstr = "GhostScript + $driver";
}
if ($driver eq $entry->{defaultdriver}) {
- $driverstr .= " (recommended)";
+ $driverstr .= " $precstr";
}
$entry->{ENTRY} = "$entry->{make}|$entry->{model}|$driverstr";
$entry->{ENTRY} =~ s/^CITOH/C.ITOH/i;
@@ -1652,6 +1657,8 @@ sub ppd_entry_str {
# model name, this with the cleaned manufacturer name
$model =~ s/^$mf[\s\-]+//i
if $mf && $mf !~ m![\\/\(\)\[\]\|\.\$\@\%\*\?]!;
+ # Translate "(recommended)" in the driver string
+ $driver =~ s/\(recommended\)/$precstr/gi;
# Put out the resulting description string
uc($mf) . '|' . $model . '|' . $driver .
($lang && " (" . lang::locale_to_main_locale($lang) . ")");
@@ -1739,7 +1746,7 @@ sub poll_ppd_base {
$driver =~ s/\s*\([a-z]{2}(|_[A-Z]{2})\)\s*$//;
# Recommended Foomatic PPD? Extract "(recommended)"
my $isrecommended =
- $driver =~ s/\s+\(recommended\)\s*$//i;
+ $driver =~ s/\s+$sprecstr\s*$//i;
# Remove trailing white space
$driver =~ s/\s+$//;
# For Foomatic: Driver with "GhostScript + "
@@ -1802,7 +1809,7 @@ sub poll_ppd_base {
} elsif ((defined
$thedb{"$mf|$model|$fullfoomaticdriver"} ||
defined
- $thedb{"$mf|$model|$fullfoomaticdriver (recommended)"}) &&
+ $thedb{"$mf|$model|$fullfoomaticdriver $precstr"}) &&
$isfoomatic) {
# Expert mode: There is already an entry for the
# same printer/driver combo produced by the
@@ -1810,20 +1817,20 @@ sub poll_ppd_base {
# entry
next;
} elsif (defined
- $thedb{"$mf|$model|PostScript (recommended)"} &&
+ $thedb{"$mf|$model|PostScript $precstr"} &&
$isnativeps) {
# Expert mode: "Foomatic + Postscript" driver is
# recommended and this is a PostScript PPD? Make
# this PPD the recommended one
foreach (keys
- %{$thedb{"$mf|$model|PostScript (recommended)"}}) {
+ %{$thedb{"$mf|$model|PostScript $precstr"}}) {
$thedb{"$mf|$model|PostScript"}{$_} =
- $thedb{"$mf|$model|PostScript (recommended)"}{$_};
+ $thedb{"$mf|$model|PostScript $precstr"}{$_};
}
delete
- $thedb{"$mf|$model|PostScript (recommended)"};
+ $thedb{"$mf|$model|PostScript $precstr"};
if (!$isrecommended) {
- $key .= " (recommended)";
+ $key .= " $precstr";
}
} elsif ($driver =~ /PostScript/i &&
$isrecommended && $isfoomatic &&
@@ -1835,20 +1842,20 @@ sub poll_ppd_base {
# recommended and there was a PostScript PPD? Make
# the PostScript PPD the recommended one
my $firstfound = $foundkeys[0];
- if (!(any { /\(recommended\)/ } @foundkeys)) {
+ if (!(any { /$sprecstr/ } @foundkeys)) {
# Do it only if none of the native PostScript
# PPDs for this printer is already "recommended"
foreach (keys %{$thedb{$firstfound}}) {
- $thedb{"$firstfound (recommended)"}{$_} =
+ $thedb{"$firstfound $precstr"}{$_} =
$thedb{$firstfound}{$_};
}
delete $thedb{$firstfound};
}
- $key =~ s/\s*\(recommended\)//;
+ $key =~ s/\s*$sprecstr//;
} elsif ($driver !~ /PostScript/i &&
$isrecommended && $isfoomatic &&
(@foundkeys = grep {
- /^$mf\|$model\|.*\(recommended\)/ &&
+ /^$mf\|$model\|.*$sprecstr/ &&
!/CUPS/i && $thedb{$_}{driver} eq "PPD"
} keys %thedb)) {
# Expert mode: Foomatic driver other than "Foomatic +
@@ -1858,7 +1865,7 @@ sub poll_ppd_base {
foreach my $sourcekey (@foundkeys) {
# Remove the "recommended" tag
my $destkey = $sourcekey;
- $destkey =~ s/\s+\(recommended\)\s*$//i;
+ $destkey =~ s/\s+$sprecstr\s*$//i;
foreach (keys %{$thedb{$sourcekey}}) {
$thedb{$destkey}{$_} = $thedb{$sourcekey}{$_};
}
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index eda1f11ba..8389262aa 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -14,6 +14,11 @@ use printer::detect;
use printer::default;
use printer::data;
+# Overtake translation for "(recommended)" from printer/main.pm
+my $recstr = $printer::main::recstr;
+my $precstr = $printer::main::precstr;
+my $sprecstr = $printer::main::sprecstr;
+
my $shortdistroname = "Mandrakelinux";
my $hp1000fwtext = N("The HP LaserJet 1000 needs its firmware to be uploaded after being turned on. Download the Windows driver package from the HP web site (the firmware on the printer's CD does not work) and extract the firmware file from it by decompressing the self-extracting '.exe' file with the 'unzip' utility and searching for the 'sihp1000.img' file. Copy this file into the '/etc/printer' directory. There it will be found by the automatic uploader script and uploaded whenever the printer is connected and turned on.
@@ -2821,7 +2826,7 @@ sub get_db_entry {
# database key contains the "(recommended)" for the
# recommended driver, so add it if necessary
unless (exists($printer::main::thedb{$printer->{DBENTRY}})) {
- $printer->{DBENTRY} .= " (recommended)";
+ $printer->{DBENTRY} .= " $precstr";
}
} else {
$printer->{DBENTRY} = "$make|$model";
@@ -2833,7 +2838,7 @@ sub get_db_entry {
printer::main::get_descr_from_ppd($printer) ||
$printer->{DBENTRY};
unless (exists($printer::main::thedb{$printer->{DBENTRY}})) {
- $printer->{DBENTRY} .= " (recommended)";
+ $printer->{DBENTRY} .= " $precstr";
}
$printer->{OLD_CHOICE} = $printer->{DBENTRY};
}
@@ -2855,7 +2860,7 @@ sub get_db_entry {
}
foreach my $key (keys %printer::main::thedb) {
if ($printer->{expert} &&
- $key =~ /^$make\|$model\|.*\(recommended\).*$/ ||
+ $key =~ /^$make\|$model\|.*$sprecstr.*$/ ||
!$printer->{expert} && $key =~ /^$make\|$model$/) {
$printer->{DBENTRY} = $key;
}
@@ -2868,7 +2873,7 @@ sub get_db_entry {
$model =~ s/PostScript//i;
$model =~ s/Series//i;
foreach my $key (keys %printer::main::thedb) {
- if ($printer->{expert} && $key =~ /^$make\|$model\|.*\(recommended\).*$/ ||
+ if ($printer->{expert} && $key =~ /^$make\|$model\|.*$sprecstr.*$/ ||
!$printer->{expert} && $key =~ /^$make\|$model$/) {
$printer->{DBENTRY} = $key;
}
@@ -2892,10 +2897,10 @@ sub get_db_entry {
$printer->{OLD_CHOICE} = "XXX";
}
} else {
- if ($printer->{expert} && $printer->{DBENTRY} !~ /(recommended)/) {
+ if ($printer->{expert} && $printer->{DBENTRY} !~ /$sprecstr/) {
my ($make, $model) = $printer->{DBENTRY} =~ /^([^\|]+)\|([^\|]+)\|/;
foreach my $key (keys %printer::main::thedb) {
- if ($key =~ /^$make\|$model\|.*\(recommended\).*$/) {
+ if ($key =~ /^$make\|$model\|.*$sprecstr.*$/) {
$printer->{DBENTRY} = $key;
}
}
32'>432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719
package install_steps_gtk; # $Id$

use diagnostics;
use strict;
use vars qw(@ISA);

@ISA = qw(install_steps_interactive interactive::gtk);

#-######################################################################################
#- misc imports
#-######################################################################################
use pkgs;
use install_steps_interactive;
use interactive::gtk;
use xf86misc::main;
use common;
use mygtk2;
use ugtk2 qw(:helpers :wrappers :create);
use devices;
use modules;
use install_gtk;
use install_any;
use mouse;
use help;
use log;

#-######################################################################################
#- In/Out Steps Functions
#-######################################################################################
sub new($$) {
    my ($type, $o) = @_;

    $ENV{DISPLAY} ||= $o->{display} || ":0";
    my $wanted_DISPLAY = $::testing && -x '/usr/X11R6/bin/Xnest' ? ':9' : $ENV{DISPLAY};

    if (!$::local_install && 
	($::testing ? $ENV{DISPLAY} ne $wanted_DISPLAY : $ENV{DISPLAY} =~ /^:\d/)) { #- is the display local or distant?
	my $f = "/tmp/Xconf";
	if (!$::testing) {
	    devices::make("/dev/kbd");
	}
	my $launchX = sub {
	    my ($server, $Driver) = @_;

	    mkdir '/var/log' if !-d '/var/log';

	    my @options = $wanted_DISPLAY;
	    if ($server eq 'Xnest') {
		push @options, '-ac', '-geometry', $o->{vga} || ($o->{vga16} ? '640x480' : '800x600');
	    } elsif ($::globetrotter || !$::move) {
		install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{mouse}{wacom}[0], $Driver);

		push @options, if_(!$::globetrotter, '-kb'), '-allowMouseOpenFail', '-xf86config', $f if arch() !~ /^sparc/;
		push @options, 'tty7', '-dpms', '-s', '240';

		#- old weird servers: Xsun
		push @options, '-fp', '/usr/X11R6/lib/X11/fonts:unscaled' if $server =~ /Xsun/;
	    }

	    if (!fork()) {