summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/printerdrake
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2004-08-27 18:19:38 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2004-08-27 18:19:38 +0000
commit115642e472a721aee88a1ba7e4884c8de4799fac (patch)
tree00c9f3d4bd275be39c925fb908af127479ef6ca3 /perl-install/standalone/printerdrake
parentbf4f9fc6e28a877fc9bd0640d31e0af73120f869 (diff)
downloaddrakx-115642e472a721aee88a1ba7e4884c8de4799fac.tar
drakx-115642e472a721aee88a1ba7e4884c8de4799fac.tar.gz
drakx-115642e472a721aee88a1ba7e4884c8de4799fac.tar.bz2
drakx-115642e472a721aee88a1ba7e4884c8de4799fac.tar.xz
drakx-115642e472a721aee88a1ba7e4884c8de4799fac.zip
- Made support for daemon-less CUPS client working.
- Fixed graying out of buttons/menu entries in the main window.
Diffstat (limited to 'perl-install/standalone/printerdrake')
-rwxr-xr-xperl-install/standalone/printerdrake41
1 files changed, 37 insertions, 4 deletions
diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake
index f16cdafe1..a6f0abff8 100755
--- a/perl-install/standalone/printerdrake
+++ b/perl-install/standalone/printerdrake
@@ -95,6 +95,8 @@ $printer->{expert} = printer::main::get_usermode();
$commandline =~ /-expert/ and $printer->{expert} = 1;
$commandline =~ /-cups/ and
$printer->{SPOOLER} = 'cups' and printer::main::read_configured_queues($printer);
+$commandline =~ /-rcups/ and
+ $printer->{SPOOLER} = 'rcups' and printer::main::read_configured_queues($printer);
$commandline =~ /-lpr/ and
$printer->{SPOOLER} = 'lpd' and printer::main::read_configured_queues($printer);
$commandline =~ /-lpd/ and
@@ -139,6 +141,7 @@ $localtree = CreateTree($ltree_model);
$remotetree = CreateTree($rtree_model);
# slightly verbatimed from control-center
my %options = (
+ 'add' => [ N("/_Actions"), N("/_Add Printer") ],
'default' => [ N("/_Actions"), N("/Set as _Default") ],
'edit' => [ N("/_Actions"), N("/_Edit") ],
'delete' => [ N("/_Actions"), N("/_Delete") ],
@@ -175,7 +178,7 @@ my ($menu, $factory) = create_factory_menu($::isEmbedded ? $::Plug : $us->{wnd}{
);
%buttorcheck = map {
$_ => $factory->get_widget("<main>" . join '', map { s/_//; $_ } @{$options{$_}})
-}('default', 'edit', 'delete', 'expert');
+}('add', 'default', 'edit', 'delete', 'expert');
if (defined $buttorcheck{expert}) {
$buttorcheck{expert}->set_active($printer->{expert});
@@ -242,6 +245,9 @@ my @toolbwg = map {
);
my ($_tbadd, $tbdefault, $tbedit, $tbdel, $_tbref, $_tbconfig) = @toolbwg;
GrayDelEdit();
+foreach ($_tbadd, $buttorcheck{add}) { defined $_ and $_->set_sensitive($printer->{SPOOLER} ne "rcups")};
+$localtree->parent->parent->set_sensitive($printer->{SPOOLER} ne "rcups");
+$nb->set_current_page(1) if $printer->{SPOOLER} eq "rcups";
$fbut->signal_connect('clicked', sub { $stringsearch = $filter->get_text; Refresh($stringsearch) });
Refresh($stringsearch);
@@ -282,6 +288,7 @@ sub RefreshLocalPrintersFull {
my @printers;
defined $printer and @printers = keys %{$printer->{configured}};
$ltree_model->clear;
+ return if $printer->{SPOOLER} eq "rcups";
my @LocalReal;
LOOP: foreach my $p (@printers) {
# Apply string search to all fields, not only the printer name
@@ -317,7 +324,8 @@ sub RefreshRemotePrintersFull {
next LOOP if defined($printer->{configured}{$p->{queuename}});
# Apply string search to all fields, not only the printer name
my $queue = $p->{queuename};
- my $server = $p->{ipp};
+ my $server = ($p->{ipp} ?
+ $p->{ipp} : $printer->{remote_cups_server});
my $description = $p->{description};
my $location = $p->{location};
my $searchstr = "$queue|$server|$description|$location";
@@ -327,7 +335,8 @@ sub RefreshRemotePrintersFull {
foreach my $p (sort { lc($a->{queuename}) cmp lc($b->{queuename}) }
@RemoteReal) {
my $queue = $p->{queuename};
- my $server = $p->{ipp};
+ my $server = ($p->{ipp} ?
+ $p->{ipp} : $printer->{remote_cups_server});
my $description = $p->{description};
my $location = $p->{location};
my $default = ($queue eq $printer->{DEFAULT} ? "X" : "");
@@ -393,6 +402,9 @@ sub Delete() {
sub ConfigCUPS() {
deactivate_mainwindow();
printer::printerdrake::config_cups($printer, $in);
+ foreach ($_tbadd, $buttorcheck{add}) { defined $_ and $_->set_sensitive($printer->{SPOOLER} ne "rcups")};
+ $localtree->parent->parent->set_sensitive($printer->{SPOOLER} ne "rcups");
+ $nb->set_current_page(1) if $printer->{SPOOLER} eq "rcups";
Refresh($stringsearch);
activate_mainwindow();
}
@@ -481,7 +493,23 @@ sub CreateTree {
$tree->get_selection->set_mode('browse');
$tree->set_headers_visible(1);
$tree->set_rules_hint(1);
- $tree->get_selection->signal_connect('changed' => sub { foreach ($tbdefault, $tbedit, $tbdel, $buttorcheck{default}, $buttorcheck{edit}, $buttorcheck{delete}) { $_->set_sensitive(1) } });
+ $tree->get_selection->signal_connect('changed' => sub {
+ my (undef, $event) = @_;
+ my (undef, $iter) = $tree->get_selection->get_selected;
+ return unless $iter;
+ foreach ($tbdefault, $tbedit, $tbdel, $buttorcheck{default}, $buttorcheck{edit}, $buttorcheck{delete}) { $_->set_sensitive(1) }
+ my $queue = $tree_model->get($iter, 1);
+ if (!defined($printer->{configured}{$queue})) {
+ foreach ($tbdel, $buttorcheck{delete}) {
+ $_->set_sensitive(0);
+ }
+ }
+ if ($queue eq $printer->{DEFAULT}) {
+ foreach ($tbdefault, $buttorcheck{default}) {
+ $_->set_sensitive(0);
+ }
+ }
+ });
$tree->signal_connect(button_press_event => sub {
my (undef, $event) = @_;
my (undef, $iter) = $tree->get_selection->get_selected;
@@ -493,6 +521,11 @@ sub CreateTree {
$_->set_sensitive(0);
}
}
+ if ($queue eq $printer->{DEFAULT}) {
+ foreach ($tbdefault, $buttorcheck{default}) {
+ $_->set_sensitive(0);
+ }
+ }
Edit() if $event->type eq '2button-press';
});
$tree->signal_connect(key_press_event => sub {