From 1f256dcf1775e1ee958a108b9f43e00251b3bbfd Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 11 Mar 2003 15:50:36 +0000 Subject: Added button to switch to japanese text file printing. --- perl-install/printer/main.pm | 17 +++++++++++++++++ perl-install/printer/printerdrake.pm | 13 ++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'perl-install/printer') diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 76a0f74aa..5ca9fc5f8 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -674,6 +674,23 @@ sub get_usermode { return $::expert; } +sub set_jap_textmode { + my $textmode = ($_[0] ? 'cjk' : ''); + my $file = "$::prefix/etc/cups/mime.convs"; + my @mimeconvs = cat_($file) or die "Cannot open $file for reading!"; + (s!^(\s*text/plain\s+\S+\s+\d+\s+)\S+(\s*$)!$1${textmode}texttops$2!) + foreach @mimeconvs; + output($file, @mimeconvs) or die "Cannot open $file for writing!"; + return 1; +} + +sub get_jap_textmode { + my @mimeconvs = cat_("$::prefix/etc/cups/mime.convs"); + (m!^\s*text/plain\s+\S+\s+\d+\s+(\S+)\s*$!m and + ($1 eq 'cjktexttops') and return 1) foreach @mimeconvs; + return 0; +} + #---------------------------------------------------------------------- # Handling of /etc/cups/cupsd.conf diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index 6e5755de2..25aff729f 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -65,6 +65,8 @@ sub config_cups { @{$printer->{cupsconfig}{cupsd_conf}} = printer::main::read_cupsd_conf(); printer::main::read_cups_config($printer); + # Read state of japanese text printing mode + my $jap_textmode = printer::main::get_jap_textmode(); # Read state for auto-correction of cupsd.conf $printer->{cupsconfig}{autocorrection} = printer::main::get_cups_autoconf(); @@ -80,7 +82,7 @@ sub config_cups { if ($in->ask_from_ ( { - title => N("CUPS printer sharing configuration"), + title => N("CUPS printer configuration"), messages => N("Here you can choose whether the printers connected to this machine should be accessable by remote machines and by which remote machines.") . N("You can also decide here whether printers on remote machines should be automatically made available on this machine."), }, @@ -118,6 +120,10 @@ sub config_cups { $buttonclicked = "browsepoll"; 1; } }, + { text => N("Japanese text printing mode"), + help => N("Turning on this allows to print plain text files in japanese language. Only use this function if you really want to print text in japanese, if it is activated you cannot print accentuated characters in latin fonts any more and you will not be able to adjust the margins, the character size, etc. This setting only affects printers defined on this machine. If you want to print japanese text on a printer set up on a remote machine, you have to activate this function on that remote machine."), + type => 'bool', + val => \$jap_textmode }, if_($::expert, { text => N("Automatic correction of CUPS configuration"), type => 'bool', @@ -487,6 +493,8 @@ N("Examples for correct IPs:\n") . printer::main::set_cups_autoconf ($printer->{cupsconfig}{autocorrection}); } + # Write state of japanese text printing mode + printer::main::set_jap_textmode($jap_textmode); # Write cupsd.conf printer::main::write_cups_config($printer); my $w = @@ -3699,8 +3707,7 @@ sub main { $menuchoice = "\@cupsconfig"; 1; }, - val => ($::expert ? N("CUPS configuration") : - N("Printer sharing")) }) : ()), + val => N("CUPS configuration") }) : ()), ($::expert && (files_exist(qw(/usr/bin/pdq)) || files_exist(qw(/usr/lib/filters/lpf -- cgit v1.2.1