summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2003-08-24 00:47:05 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2003-08-24 00:47:05 +0000
commit992ac618af33d345430bae3a183cd4672d8f76ca (patch)
tree26b4b6cb0f5078f29b7dd34bf1a0f10d0cde70cd /perl-install
parentb5e547d3bbe1a9508087f48245f6ebebbf47cce6 (diff)
downloaddrakx-backup-do-not-use-992ac618af33d345430bae3a183cd4672d8f76ca.tar
drakx-backup-do-not-use-992ac618af33d345430bae3a183cd4672d8f76ca.tar.gz
drakx-backup-do-not-use-992ac618af33d345430bae3a183cd4672d8f76ca.tar.bz2
drakx-backup-do-not-use-992ac618af33d345430bae3a183cd4672d8f76ca.tar.xz
drakx-backup-do-not-use-992ac618af33d345430bae3a183cd4672d8f76ca.zip
- Fixed expert/normal mode switch (it will perhaps be removed, but a
working switch makes the further development easier). - Added connectionstr() function which produces a human-readable string for the connection type, needed for new main window. - Added missing parantheses (there was a warning complaining about this).
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer/main.pm52
-rw-r--r--perl-install/printer/printerdrake.pm5
2 files changed, 51 insertions, 6 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index 9c36fa55a..d9e8ce864 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -377,6 +377,52 @@ sub make_menuentry {
"$localremote$sep$queue: $make $model$connection";
}
+sub connectionstr {
+ my ($connect) = @_;
+ my $connection;
+ if ($connect =~ m!^(file|parallel):/dev/lp(\d+)$!) {
+ my $number = $2;
+ $connection = N("Parallel port #%s", $number);
+ } elsif ($connect =~ m!^(file|usb):/dev/usb/lp(\d+)$!) {
+ my $number = $2;
+ $connection = N("USB printer #%s", $number);
+ } elsif ($connect =~ m!^usb://!) {
+ $connection = N("USB printer");
+ } elsif ($connect =~ m!^ptal://?(.+?)$!) {
+ my $ptaldevice = $1;
+ if ($ptaldevice =~ /^mlc:par:(\d+)$/) {
+ my $number = $1;
+ $connection = N("Multi-function device on parallel port #%s",
+ $number);
+ } elsif ($ptaldevice =~ /^mlc:usb:/) {
+ $connection = N("Multi-function device on USB");
+ } elsif ($ptaldevice =~ /^hpjd:/) {
+ $connection = N("Multi-function device on HP JetDirect");
+ } else {
+ $connection = N("Multi-function device");
+ }
+ } elsif ($connect =~ m!^file:(.+)$!) {
+ $connection = N("Prints into %s", $1);
+ } elsif ($connect =~ m!^lpd://([^/]+)/([^/]+)/?$!) {
+ $connection = N("LPD server \"%s\", printer \"%s\"", $2, $1);
+ } elsif ($connect =~ m!^socket://([^/:]+):([^/:]+)/?$!) {
+ $connection = N("TCP/IP host \"%s\", port %s", $1, $2);
+ } elsif ($connect =~ m!^smb://([^/\@]+)/([^/\@]+)/?$! ||
+ $connect =~ m!^smb://.*/([^/\@]+)/([^/\@]+)/?$! ||
+ $connect =~ m!^smb://.*\@([^/\@]+)/([^/\@]+)/?$!) {
+ $connection = N("SMB/Windows server \"%s\", share \"%s\"", $1, $2);
+ } elsif ($connect =~ m!^ncp://([^/\@]+)/([^/\@]+)/?$! ||
+ $connect =~ m!^ncp://.*/([^/\@]+)/([^/\@]+)/?$! ||
+ $connect =~ m!^ncp://.*\@([^/\@]+)/([^/\@]+)/?$!) {
+ $connection = N("Novell server \"%s\", printer \"%s\"", $1, $2);
+ } elsif ($connect =~ m!^postpipe:(.+)$!) {
+ $connection = N("Uses command %s", $1);
+ } else {
+ $connection = N("URI: %s", $connect);
+ }
+ return $connection;
+}
+
sub read_printer_db(;$) {
my $spooler = $_[0];
@@ -616,7 +662,7 @@ sub set_usermode {
my ($usermode) = @_;
$sysconfig{USER_MODE} = $usermode ? "expert" : "recommended";
setVarsInSh("$::prefix/etc/sysconfig/printing", \%sysconfig);
- return 1;
+ return $usermode;
}
sub get_usermode() { $::expert = $sysconfig{USER_MODE} eq 'expert' ? 1 : 0 }
@@ -1104,7 +1150,7 @@ sub read_cups_config {
handle_configs::read_unique_directive($printer->{cupsconfig}{cupsd_conf},
'Browsing', 'On');
- # Keyword "BrowseInterval"
+ # Keyword "BrowseInterval"
$printer->{cupsconfig}{keys}{BrowseInterval} =
handle_configs::read_unique_directive($printer->{cupsconfig}{cupsd_conf},
'BrowseInterval', '30');
@@ -1542,7 +1588,7 @@ sub poll_ppd_base() {
# Native CUPS?
my $isnativecups = $driver =~ /CUPS/i;
# Native PostScript
- my $isnativeps = !$isfoomatic and !$isnativecups;
+ my $isnativeps = (!$isfoomatic and !$isnativecups);
# Key without language tag (key as it was produced for the
# entries from the Foomatic XML database)
my $keynolang = $key;
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index 4a68cfbac..c5072f743 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -54,7 +54,7 @@ sub config_cups {
# running
if (!check_network($printer, $in, $upNetwork, 0)) { return 0 };
-# $in->set_help('configureRemoteCUPSServer') if $::isInstall;
+ #$in->set_help('configureRemoteCUPSServer') if $::isInstall;
#- hack to handle cups remote server printing,
#- first read /etc/cups/cupsd.conf for variable BrowsePoll address:port
# Return value: 0 when nothing was changed ("Apply" never pressed), 1
@@ -3597,7 +3597,6 @@ sub main {
# clicked on the "Configure" button in the "Summary" step. We do not
# call it during the preparation of the "Summary" screen.
if (!$::isInstall || $install_step == 1) {
-
# Ask for a spooler when none is defined yet
$printer->{SPOOLER} ||=
setup_default_spooler($printer, $in, $upNetwork) || return;
@@ -3737,7 +3736,7 @@ sub main {
]);
# Toggle expert mode and standard mode
if ($menuchoice eq "\@usermode") {
- printer::main::set_usermode(!$::expert);
+ $::expert = printer::main::set_usermode(!$::expert);
# Read printer database for the new user mode
%printer::main::thedb = ();
# Modify menu entries to switch the tree