Hello community,
here is the log from the commit of package yast2-printer
checked in at Sat Aug 30 02:15:59 CEST 2008.
--------
--- yast2-printer/yast2-printer.changes 2008-08-27 16:29:59.000000000 +0200
+++ yast2-printer/yast2-printer.changes 2008-08-29 14:50:16.488015000 +0200
@@ -1,0 +2,14 @@
+Fri Aug 29 14:45:28 CEST 2008 - jsmeix@suse.de
+
+- Some code cleanup.
+- 2.17.7
+
+-------------------------------------------------------------------
+Thu Aug 28 18:19:32 CEST 2008 - jsmeix@suse.de
+
+- Fixed build (new scripts were not packaged).
+- The 'Printing via Network' dialog UI should now work correctly
+ but writing the values to the system is not yet implemented.
+- 2.17.6
+
+-------------------------------------------------------------------
Old:
----
yast2-printer-2.17.5.tar.bz2
New:
----
yast2-printer-2.17.7.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-printer.spec ++++++
--- /var/tmp/diff_new_pack.Is4273/_old 2008-08-30 02:12:50.000000000 +0200
+++ /var/tmp/diff_new_pack.Is4273/_new 2008-08-30 02:12:50.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-printer (Version 2.17.5)
+# spec file for package yast2-printer (Version 2.17.7)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -20,12 +20,12 @@
Url: http://en.opensuse.org/YaST/Modules/Printer
Name: yast2-printer
-Version: 2.17.5
+Version: 2.17.7
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-printer-2.17.5.tar.bz2
+Source0: yast2-printer-2.17.7.tar.bz2
Prefix: /usr
BuildRequires: cups-devel update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-testsuite
Recommends: netcat
@@ -64,7 +64,7 @@
Michal Zugec
%prep
-%setup -n yast2-printer-2.17.5
+%setup -n yast2-printer-2.17.7
%build
%{prefix}/bin/y2tool y2autoconf
@@ -106,6 +106,8 @@
%{prefix}/lib/YaST2/bin/autodetect_printers
%{prefix}/lib/YaST2/bin/create_printer_ppd_database
%{prefix}/lib/YaST2/bin/determine_printer_driver_options
+%{prefix}/lib/YaST2/bin/cups_client_only
+%{prefix}/lib/YaST2/bin/modify_cupsd_conf
#Documentation
%dir %{prefix}/share/doc/packages/yast2-printer
%{prefix}/share/doc/packages/yast2-printer/COPYING
@@ -117,6 +119,14 @@
%exclude %{prefix}/share/doc/packages/yast2-printer/COPYING
%exclude %{prefix}/share/doc/packages/yast2-printer/README
%changelog
+* Fri Aug 29 2008 jsmeix@suse.de
+- Some code cleanup.
+- 2.17.7
+* Thu Aug 28 2008 jsmeix@suse.de
+- Fixed build (new scripts were not packaged).
+- The 'Printing via Network' dialog UI should now work correctly
+ but writing the values to the system is not yet implemented.
+- 2.17.6
* Wed Aug 27 2008 jsmeix@suse.de
- Enhanced scripts in the tools directory to make them
safe for a client-only setup and two new scripts
++++++ yast2-printer-2.17.5.tar.bz2 -> yast2-printer-2.17.7.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/configure new/yast2-printer-2.17.7/configure
--- old/yast2-printer-2.17.5/configure 2008-08-27 16:24:21.000000000 +0200
+++ new/yast2-printer-2.17.7/configure 2008-08-29 14:46:13.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for yast2-printer 2.17.5.
+# Generated by GNU Autoconf 2.61 for yast2-printer 2.17.7.
#
# Report bugs to http://bugs.opensuse.org/.
#
@@ -574,8 +574,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-printer'
PACKAGE_TARNAME='yast2-printer'
-PACKAGE_VERSION='2.17.5'
-PACKAGE_STRING='yast2-printer 2.17.5'
+PACKAGE_VERSION='2.17.7'
+PACKAGE_STRING='yast2-printer 2.17.7'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -1197,7 +1197,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures yast2-printer 2.17.5 to adapt to many kinds of systems.
+\`configure' configures yast2-printer 2.17.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1268,7 +1268,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-printer 2.17.5:";;
+ short | recursive ) echo "Configuration of yast2-printer 2.17.7:";;
esac
cat <<\_ACEOF
@@ -1346,7 +1346,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-printer configure 2.17.5
+yast2-printer configure 2.17.7
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1360,7 +1360,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by yast2-printer $as_me 2.17.5, which was
+It was created by yast2-printer $as_me 2.17.7, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2181,7 +2181,7 @@
# Define the identity of the package.
PACKAGE='yast2-printer'
- VERSION='2.17.5'
+ VERSION='2.17.7'
cat >>confdefs.h <<_ACEOF
@@ -2409,7 +2409,7 @@
-VERSION="2.17.5"
+VERSION="2.17.7"
RPMNAME="yast2-printer"
MAINTAINER="Michal Zugec "
@@ -3304,7 +3304,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by yast2-printer $as_me 2.17.5, which was
+This file was extended by yast2-printer $as_me 2.17.7, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3347,7 +3347,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-printer config.status 2.17.5
+yast2-printer config.status 2.17.7
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/configure.in new/yast2-printer-2.17.7/configure.in
--- old/yast2-printer-2.17.5/configure.in 2008-08-27 16:24:17.000000000 +0200
+++ new/yast2-printer-2.17.7/configure.in 2008-08-29 14:46:09.000000000 +0200
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.16.7 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-printer, 2.17.5, http://bugs.opensuse.org/, yast2-printer)
+AC_INIT(yast2-printer, 2.17.7, http://bugs.opensuse.org/, yast2-printer)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -18,7 +18,7 @@
AM_INIT_AUTOMAKE(tar-ustar -Wno-portability)
dnl Important YaST2 variables
-VERSION="2.17.5"
+VERSION="2.17.7"
RPMNAME="yast2-printer"
MAINTAINER="Michal Zugec "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/src/basicmodify.ycp new/yast2-printer-2.17.7/src/basicmodify.ycp
--- old/yast2-printer-2.17.5/src/basicmodify.ycp 2008-08-26 13:09:40.000000000 +0200
+++ new/yast2-printer-2.17.7/src/basicmodify.ycp 2008-08-29 12:29:31.000000000 +0200
@@ -446,10 +446,13 @@
Wizard::EnableNextButton();
}
else
- { Popup::TimedMessage( // Message of a Popup where %1 will be replaced by the queue name:
- sformat( _("Nothing changed for queue %1."), name ),
- 2
+ { Popup::ShowFeedback( // No title for such a simple feedback message:
+ "",
+ // Message of a Popup::ShowFeedback when nothing was changed:
+ _("Nothing changed.")
);
+ sleep( 1000 );
+ Popup::ClearFeedback();
}
// Exit this dialog in any case:
break;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/src/dialogs.ycp new/yast2-printer-2.17.7/src/dialogs.ycp
--- old/yast2-printer-2.17.5/src/dialogs.ycp 2008-08-26 15:00:25.000000000 +0200
+++ new/yast2-printer-2.17.7/src/dialogs.ycp 2008-08-28 12:52:25.000000000 +0200
@@ -262,8 +262,10 @@
"NETWORKPRINTING" : $[
"widget" : `custom,
"custom_widget" : widgetNetworkPrinting,
+ "init" : initNetworkPrinting,
"handle" : handleNetworkPrinting,
- "help" : HELPS["printing_via_network_dialog"]:""
+ "store" : storeNetworkPrinting,
+ "help" : HELPS["printing_via_network_dialog"]:""
],
"SHARING" : $[
"widget" : `custom,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/src/overview.ycp new/yast2-printer-2.17.7/src/overview.ycp
--- old/yast2-printer-2.17.5/src/overview.ycp 2008-08-26 13:09:40.000000000 +0200
+++ new/yast2-printer-2.17.7/src/overview.ycp 2008-08-29 11:16:45.000000000 +0200
@@ -87,14 +87,11 @@
// By default there is no /etc/cups/client.conf file at all
// and usually there is no ServerName entry in a /etc/cups/client.conf file.
// Therefore client_only is only true if there is a /etc/cups/client.conf file
- // with an active ServerName entry:
+ // with an active ServerName entry which is not "localhost" or "127.0.0.1".
if( Printerlib::client_only )
- { // YCP string quoting: A double backslash '\\' results a single backslash '\' in the string.
- // At least the trailing newline character must be removed.
-
- if( Printerlib::client_conf_server_name == "localhost" )
- {
- local_content_selected = true;
+ { if( Printerlib::client_conf_server_name == "localhost"
+ || Printerlib::client_conf_server_name == "127.0.0.1" )
+ { local_content_selected = true;
remote_content_selected = true;
}
else
@@ -104,11 +101,9 @@
}
}
if( local_cupsd_required && ! local_cupsd_accessible )
- {
- Popup::ErrorDetails( _("Start local running CUPS daemon"),
- _("A local running CUPS daemon is needed for your setup.")
- );
-
+ { Popup::ErrorDetails( _("Start local running CUPS daemon"),
+ _("A local running CUPS daemon is needed for your setup.")
+ );
if( ! Service::Start("cups") )
{ Report::Error( // Message of a Report::Error.
// Only a simple message because this error does not happen on a normal system
@@ -180,21 +175,20 @@
_("Do not delete it"),
`focus_no
))
- {
- // To be safe invalidate Printer::selected_queues_index in any case:
- Printer::selected_queues_index = -1;
- y2milestone( "To be deleted:'%1', selected_queue_index = %2", queue_name, selected_queue_index );
- if( ! Printer::DeleteQueue( queue_name ) )
- { Popup::Error( // Message of a Popup::Error
- // where %1 will be replaced by the queue name.
- // Only a simple message because before the function Printer::DeleteQueue
- // was called and this function would have shown more specific messages.
- sformat( _("Failed to delete queue %1."), queue_name )
- );
- }
- // Re-run the OverviewDialog (with a re-created list of queues) via the sequencer:
- return `delete;
- }
+ { // To be safe invalidate Printer::selected_queues_index in any case:
+ Printer::selected_queues_index = -1;
+ y2milestone( "To be deleted:'%1', selected_queue_index = %2", queue_name, selected_queue_index );
+ if( ! Printer::DeleteQueue( queue_name ) )
+ { Popup::Error( // Message of a Popup::Error
+ // where %1 will be replaced by the queue name.
+ // Only a simple message because before the function Printer::DeleteQueue
+ // was called and this function would have shown more specific messages.
+ sformat( _("Failed to delete queue %1."), queue_name )
+ );
+ }
+ // Re-run the OverviewDialog (with a re-created list of queues) via the sequencer:
+ return `delete;
+ }
}
if (event["EventReason"]:"" == "Activated" && event["ID"]:nil == `test){
@@ -226,11 +220,12 @@
return nil;
}
if( "local" == Printer::queues[selected_queue_index,"config"]:"remote" )
- Printer::selected_queues_index = selected_queue_index;
+ { Printer::selected_queues_index = selected_queue_index;
+ }
if( ! Printerlib::ExecuteBashCommand( "/usr/bin/lp -d '"
- + queue_name
- + "' -o page-label=\"Testprint:$(hostname)\" /usr/share/cups/data/testprint.ps"
- )
+ + queue_name
+ + "' -o page-label=\"Testprint:$(hostname)\" /usr/share/cups/data/testprint.ps"
+ )
)
{ Popup::Error( // Message of a Popup::Error
// where %1 will be replaced by the queue name.
@@ -251,18 +246,20 @@
if (event["EventReason"]:"" == "Activated" && event["ID"]:nil == `add){
// client only
- if( Printerlib::client_only && Printerlib::client_conf_server_name != "localhost" )
+ if( Printerlib::client_only
+ && Printerlib::client_conf_server_name != "localhost"
+ && Printerlib::client_conf_server_name != "127.0.0.1" )
{ if( ! Popup::YesNoHeadline( "Disable remote CUPS server setting",
"A remote CUPS server setting conflicts with adding a print queue."
)
)
return nil;
- // Disable the 'ServerName' entry in /etc/cups/client.conf:
- if( ! Printerlib::ExecuteBashCommand( "sed -i.yast2.save -e 's/^[Se][Ee][Rr][Vv][Ee][Rr][Nn][Aa][Mm][Ee]/#ServerName/' /etc/cups/client.conf" ) )
+ // Remove the 'ServerName' entry in /etc/cups/client.conf:
+ if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "cups_client_only none" ) )
{ Report::Error( // Message of a Report::Error.
// Only a simple message because this error does not happen on a normal system
// (i.e. a system which is not totally broken or totally messed up).
- _("Failed to disable the 'ServerName' entry in /etc/cups/client.conf")
+ _("Failed to remove the 'ServerName' entry in /etc/cups/client.conf")
);
return nil;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/src/Printerlib.ycp new/yast2-printer-2.17.7/src/Printerlib.ycp
--- old/yast2-printer-2.17.5/src/Printerlib.ycp 2008-08-26 14:53:09.000000000 +0200
+++ new/yast2-printer-2.17.7/src/Printerlib.ycp 2008-08-29 12:54:14.000000000 +0200
@@ -1,20 +1,14 @@
+
{
+
module "Printerlib";
textdomain "printer";
-global boolean client_only = false;
-global string client_conf_server_name = "";
-
-// By default there is "Browsing On" in /etc/cups/cupsd.conf
-// which is even the fallback if there is no "Browsing" entry at all
-// or when the "Browsing" entry is deactivated by a leading '#' character.
-// Therefore browsing_on is only false if "Browsing Off" or "Browsing No"
-// is explicitely set in /etc/cups/cupsd.conf.
-global boolean browsing_on = true;
-
-// By default there is no "BrowseDeny" entry in /etc/cups/cupsd.conf
-// but there can be such entries of the form "BrowseDeny .*" or "BrowseDeny from .*":
-global string cupsd_conf_browse_deny = "";
+// Fortunately the tools are for all architectures always
+// installed in /usr/lib/YaST2/bin/ (i.e. no "lib64").
+// I tested this on Thu Aug 28 2008 using the command
+// rpm -qlp /work/CDs/all/full-sle10-sp2*/suse/*/yast2-printer.rpm | grep '/YaST2/bin/' | grep -v '/usr/lib/YaST2/bin/'
+global string yast_bin_dir = "/usr/lib/YaST2/bin/";
// The result map is used as a simple common local store for whatever additional results
// (in particular commandline exit code, stdout, stderr, and whatever messages)
@@ -47,26 +41,107 @@
return true;
}
+// By default there is no active "ServerName" entry in /etc/cups/client.conf:
+global string client_conf_server_name = "";
+global boolean client_only = false;
+
+global boolean DetermineClientOnly()
+{ // Determine the 'ServerName' value in /etc/cups/client.conf:
+ if( ExecuteBashCommand( yast_bin_dir + "cups_client_only" ) )
+ { client_conf_server_name = result["stdout"]:"";
+ if( "" != client_conf_server_name
+ && "localhost" != client_conf_server_name
+ && "127.0.0.1" != client_conf_server_name )
+ { // Note that even 'localhost' or '127.0.0.1' is a valid ServerName value
+ // which is used to force client tools (e.g. lpadmin, lpinfo, lpstat)
+ // to ask the local cupsd via the IPP port on localhost (127.0.0.1:631)
+ // and not via the domain socket (/var/run/cups/cups.sock) because
+ // the latter failed in the past for certain third-party clients (e.g. Java).
+ // If the ServerName value in /etc/cups/client.conf is 'localhost'
+ // it is actually no client-only config because the local cupsd is used.
+ client_only = true;
+ }
+ else
+ { client_only = false;
+ }
+ }
+ else
+ { client_conf_server_name = "";
+ client_only = false;
+ }
+ // Ignore when it fails:
+ return true;
+}
+
+// By default there is "Browsing On" in /etc/cups/cupsd.conf
+// which is even the fallback if there is no "Browsing" entry at all
+// or when the "Browsing" entry is deactivated by a leading '#' character.
+// Therefore browsing_on is only false if "Browsing Off" or "Browsing No"
+// is explicitely set in /etc/cups/cupsd.conf.
+global boolean browsing_on = true;
+
+global boolean DetermineBrowsing()
+{ // Determine the 'Browsing [ On | Off ]' value in /etc/cups/cupsd.conf:
+ if( ExecuteBashCommand( yast_bin_dir + "modify_cupsd_conf Browsing" ) )
+ { string browsing = tolower( result["stdout"]:"On" );
+ if( "off" == browsing || "no" == browsing )
+ { browsing_on = false;
+ }
+ else
+ { browsing_on = true;
+ }
+ }
+ // Ignore when it fails:
+ return true;
+}
+
+// By default there is "BrowseAllow all" in /etc/cups/cupsd.conf
+// which is even the fallback if there is no "BrowseAllow" entry at all
+// or when the "BrowseAllow" entries are deactivated by a leading '#' character.
+// Multiple BrowseAllow lines are allowed, e.g.:
+// BrowseAllow from @LOCAL
+// BrowseAllow from 192.168.200.1
+// BrowseAllow from 192.168.100.0/255.255.255.0
+// so that each BrowseAllow line value is stored as one string
+// in the cupsd_conf_browse_allow list of strings:
+global list< string > cupsd_conf_browse_allow = [ "all" ];
+
+global boolean DetermineBrowseAllow()
+{ // Determine the 'BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]' values in /etc/cups/cupsd.conf:
+ if( ExecuteBashCommand( yast_bin_dir + "modify_cupsd_conf BrowseAllow" ) )
+ { // The command outputs a line where multiple BrowseAllow values are separated by space
+ // but possible duplicate BrowseAllow values are not removed in the command output:
+ cupsd_conf_browse_allow = toset( splitstring( Printerlib::result["stdout"]:"all", " " ) );
+ }
+ else
+ { cupsd_conf_browse_allow = [ "all" ];
+ }
+ // Ignore when it fails:
+ return true;
+}
+
global map operation_policy = $[];
global map cups_autoconfig = $[];
-global void Read(){
- client_only = ExecuteBashCommand( "egrep -i '^ServerName[[:space:]]+[[:alnum:]]' /etc/cups/client.conf" );
- if( ExecuteBashCommand( "sed -n -e 's/^[Se][Ee][Rr][Vv][Ee][Rr][Nn][Aa][Mm][Ee][[:space:]][[:space:]]*\\(.*\\)$/\\1/p' /etc/cups/client.conf | tr -d '[:space:]'" ) )
- client_conf_server_name = result["stdout"]:"";
-
- if( Printerlib::ExecuteBashCommand( "egrep -i '^Browsing[[:space:]]+Off|^Browsing[[:space:]]+No' /etc/cups/cupsd.conf" ) )
- browsing_on = false;
- string commandline = "egrep -i '^BrowseDeny[[:space:]]+|^BrowseDeny[[:space:]]+from[[:space:]]+' /etc/cups/cupsd.conf | sed -e 's/[Ff][Rr][Oo][Mm]//' | tr -s '[:space:]' | cut -d ' ' -f 2 | tr '[:space:]' ' '";
- if( Printerlib::ExecuteBashCommand( commandline ) ) cupsd_conf_browse_deny = Printerlib::result["stdout"]:"";
- // read cups-autoconfiguration settings
- cups_autoconfig = (map)SCR::Read(.etc.cups-auto.all);
-y2internal("read cups-auto %1", cups_autoconfig);
-}
-
-global void Write(){
- y2milestone("Writing cups-autoconfig.conf\n%1", cups_autoconfig);
- SCR::Write(.etc.cups-auto.all, cups_autoconfig);
+global void Read()
+{ // Determine the 'Browsing [ On | Off ]' value in /etc/cups/cupsd.conf and ignore when it fails:
+ DetermineBrowsing();
+ // Determine the 'BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]'
+ // values in /etc/cups/cupsd.conf and ignore when it fails:
+ DetermineBrowseAllow();
+ // Determine the 'ServerName' value in /etc/cups/client.conf and ignore when it fails:
+ DetermineClientOnly();
+ // Read cups-autoconfiguration settings:
+ cups_autoconfig = (map)SCR::Read(.etc.cups-auto.all);
+ y2internal("read cups-auto %1", cups_autoconfig);
}
+
+global void Write()
+{ // Write cups-autoconfiguration settings:
+ y2milestone("Writing cups-autoconfig.conf\n%1", cups_autoconfig);
+ SCR::Write(.etc.cups-auto.all, cups_autoconfig);
}
+
+}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/src/printingvianetwork.ycp new/yast2-printer-2.17.7/src/printingvianetwork.ycp
--- old/yast2-printer-2.17.5/src/printingvianetwork.ycp 2008-08-26 13:56:48.000000000 +0200
+++ new/yast2-printer-2.17.7/src/printingvianetwork.ycp 2008-08-29 13:07:20.000000000 +0200
@@ -41,111 +41,260 @@
include "printer/helps.ycp";
-term widgetNetworkPrinting =
- `VBox( `VStretch(),
- `Frame( _("Use CUPS to Print Via Network"),
- `RadioButtonGroup( `id(`browsing_or_client_only_check_boxs),
- `VBox( `Left( `RadioButton( `id(`cupsd_conf_browsing_off_radio_button),
- `opt(`notify),
- _("&Do not Receive Printer Information from Remote CUPS servers"),
- ! Printerlib::client_only && ! Printerlib::browsing_on
- )
- ),
- `Left( `RadioButton( `id(`cupsd_conf_browsing_on_radio_button),
- `opt(`notify),
- _("&Receive Printer Information from Remote CUPS servers"),
- ! Printerlib::client_only && Printerlib::browsing_on
- )
- ),
- `HBox( `HSpacing( 3 ),
- `TextEntry( `id(`cupsd_conf_browse_deny_input),
- _("&Show Printers Published by CUPS Servers Except the Following (separated by spaces)"),
- Printerlib::cupsd_conf_browse_deny
- )
- ),
- `VSpacing( 1 ),
- `Left( `RadioButton( `id(`client_only_check_box),
- `opt(`notify),
- _("Do All Your Printing Directly via One Remote &CUPS Server"),
- Printerlib::client_only
- )
- ),
- `HBox( `HSpacing( 3 ),
- `HWeight( 2,
- `TextEntry( `id(`client_conf_server_name_input),
- _("&Hostname / IP Address"),
- Printerlib::client_conf_server_name
- )
- ),
- `HWeight( 1,
- `PushButton( `id(`test_client_conf_server),
- _("&Test Server")
- )
- ),
- `HStretch()
- )
- )
- )
- ),
- `VStretch(),
- `Frame( _("Use Another Print Server or Use a Network Printer Directly"),
- `Left( `PushButton( `id(`connection_wizard),
- _("&Connection Wizard")
- )
- )
- ),
- `VStretch()
+boolean something_has_changed = false;
+boolean cupsd_restart_required = false;
+boolean cupsd_start_required = false;
+boolean cupsd_stop_required = false;
+
+boolean ApplyNetworkPrintingSettings()
+{ if( ! something_has_changed )
+ { y2milestone( "Nothing changed in 'Printing via Network' dialog." );
+ Popup::ShowFeedback( // No title for such a simple feedback message:
+ "",
+ // Message of a Popup::ShowFeedback when nothing was changed:
+ _("Nothing changed.")
);
+ sleep( 1000 );
+ Popup::ClearFeedback();
+ return true;
+ }
+ y2milestone( "Writing 'NetworkPrinting' settings to the system." );
+ // Nothing implemented yet:
+ Popup::AnyMessage( // Header of a Popup::AnyMessage when "ApplyNetworkPrintingSettings" is called:
+ _("Not yet implemented"),
+ // Body of a Popup::AnyMessage when the "ApplyNetworkPrintingSettings" is called:
+ _("Writing the settings to the system is not yet implemented.")
+ );
+ return false;
+}
+term widgetNetworkPrinting = `VBox
+ ( `VStretch(),
+ `Frame
+ ( _("Use CUPS to Print Via Network"),
+ `RadioButtonGroup
+ ( `id(`browsing_or_client_only_check_boxs),
+ `VBox
+ ( `Left
+ ( `RadioButton
+ ( `id(`cupsd_conf_browsing_off_radio_button),
+ `opt(`notify),
+ _("&Do not Receive Printer Information from Remote CUPS servers")
+ )
+ ),
+ `Left
+ ( `RadioButton
+ ( `id(`cupsd_conf_browsing_on_radio_button),
+ `opt(`notify),
+ _("Receive Printer &Information from Remote CUPS servers")
+ )
+ ),
+ `HBox
+ ( `HSpacing( 3 ),
+ `VBox
+ ( `Left
+ ( `Label
+ ( `id(`cupsd_conf_browse_allow_label),
+ _("Accept Information from the Following Servers")
+ )
+ ),
+ `Left
+ ( `ComboBox
+ ( `id(`cupsd_conf_browse_allow_combo_box),
+ _("Usual &General Setting"),
+ [ `item( `id(`browse_allow_local), "hosts in the local network" ),
+ `item( `id(`browse_allow_all), "all hosts" )
+ ]
+ )
+ ),
+ `Left
+ ( `TextEntry
+ ( `id(`cupsd_conf_browse_allow_input),
+ _("Specific IP Addresses or &Network/Netmask (separated by space)")
+ )
+ )
+ )
+ ),
+ `VSpacing( 1 ),
+ `Left
+ ( `RadioButton
+ ( `id(`client_only_radio_button),
+ `opt(`notify),
+ _("Do All Your Printing Directly via &One Remote CUPS Server")
+ )
+ ),
+ `HBox
+ ( `HSpacing( 3 ),
+ `HWeight
+ ( 2,
+ `TextEntry
+ ( `id(`client_conf_server_name_input),
+ _("&Hostname / IP Address")
+ )
+ ),
+ `HWeight
+ ( 1,
+ `PushButton
+ ( `id(`test_client_conf_server),
+ _("&Test Server")
+ )
+ ),
+ `HStretch()
+ )
+ )
+ )
+ ),
+ `VStretch(),
+ `Frame
+ ( _("Use Another Print Server or Use a Network Printer Directly"),
+ `Left
+ ( `PushButton
+ ( `id(`connection_wizard),
+ _("&Connection Wizard")
+ )
+ )
+ ),
+ `VStretch(),
+ `Right
+ ( `PushButton
+ ( `id(`apply),
+ _("Apply")
+ )
+ )
+ );
-symbol handleNetworkPrinting(string key, map event){
- if( Printerlib::browsing_on )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, true );
- UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
- UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
- UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
- }
- else
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
- UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
- UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
- UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
- }
+void initNetworkPrinting( string key )
+{ y2milestone( "entering initNetworkPrinting with key '%1'", key );
+ // Determine the 'Browsing [ On | Off ]' value in /etc/cups/cupsd.conf and ignore when it fails:
+ Printerlib::DetermineBrowsing();
+ // Determine the 'BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]'
+ // values in /etc/cups/cupsd.conf and ignore when it fails:
+ Printerlib::DetermineBrowseAllow();
+ // Determine the 'ServerName' value in /etc/cups/client.conf and ignore when it fails:
+ Printerlib::DetermineClientOnly();
+ // Have all widgets disabled initially
+ // but nevertheless fill in the values of the current settings in the system:
+ UI::ChangeWidget( `id(`cupsd_conf_browsing_off_radio_button), `Value, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browsing_on_radio_button), `Value, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_label), `Enabled, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_combo_box), `Enabled, false );
+ // When by accident "all" and "@LOCAL" were set as BrowseAllow values,
+ // the "@LOCAL" entry is preselected in cupsd_conf_browse_allow_combo_box
+ // because this is the more secure setting:
+ if( contains( Printerlib::cupsd_conf_browse_allow, "all" ) )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_combo_box), `Value, `id(`browse_allow_all) );
+ }
+ if( contains( Printerlib::cupsd_conf_browse_allow, "@LOCAL" ) )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_combo_box), `Value, `id(`browse_allow_local) );
+ }
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, false );
+ // The preset entry in cupsd_conf_browse_allow_input field
+ // should not contain "all" or "@LOCAL" because those are
+ // already selectable via cupsd_conf_browse_allow_combo_box
+ // and it should also not contain "none" because this setting
+ // is implicitely done via cupsd_conf_browsing_off_radio_button:
+ string cupsd_conf_browse_allow_input_value = mergestring( filter( string value,
+ Printerlib::cupsd_conf_browse_allow,
+ { value = tolower( value ) ;
+ return( "all" != value
+ && "@local" != value
+ && "none" != value
+ );
+ }
+ ),
+ " "
+ );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Value, cupsd_conf_browse_allow_input_value );
+ UI::ChangeWidget( `id(`client_only_radio_button), `Value, false );
+ UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
+ UI::ChangeWidget( `id(`client_conf_server_name_input), `Value, Printerlib::client_conf_server_name );
+ UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
+ UI::ChangeWidget( `id(`connection_wizard), `Enabled, false );
+ // Enable those widgets which match to the current settings in the system:
+ // If there is 'Browsing On' in /etc/cups/cupsd.conf
+ // but there is also an active ServerName (!="localhost") in /etc/cups/client.conf
+ // have only the client-only widgets avtivated because client-only has topmost priority:
if( Printerlib::client_only )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
+ { UI::ChangeWidget( `id(`client_only_radio_button), `Value, true );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, true );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, true );
- UI::ChangeWidget( `id(`connection_wizard), `Enabled, false );
}
+ else
+ { UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
+ // If "none" is present as a BrowseAllow value, no 'Browsing On' widget is enabled:
+ if( Printerlib::browsing_on
+ && ! contains( Printerlib::cupsd_conf_browse_allow, "none" )
+ )
+ { UI::ChangeWidget( `id(`cupsd_conf_browsing_on_radio_button), `Value, true );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_label), `Enabled, true );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_combo_box), `Enabled, true );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, true );
+ }
+ else
+ { UI::ChangeWidget( `id(`cupsd_conf_browsing_off_radio_button), `Value, true );
+ }
+ }
+ y2milestone( "leaving initNetworkPrinting" );
+}
- if ( event["EventReason"]:"" == "ValueChanged" ){
- if( event["ID"]:nil == `cupsd_conf_browsing_on_radio_button )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, true );
+symbol handleNetworkPrinting( string key, map event )
+{ y2milestone( "entering handleNetworkPrinting with key '%1'\nand event '%2'", key, event );
+ if( "ValueChanged" == event["EventReason"]:"" )
+ { if( `cupsd_conf_browsing_on_radio_button == event["ID"]:nil )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_label), `Enabled, true );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_combo_box), `Enabled, true );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, true );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
}
- if( event["ID"]:nil == `cupsd_conf_browsing_off_radio_button )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
+ if( `cupsd_conf_browsing_off_radio_button == event["ID"]:nil )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_label), `Enabled, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_combo_box), `Enabled, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, false );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
}
- if( event["ID"]:nil == `client_only_check_box)
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
+ if( `client_only_radio_button == event["ID"]:nil )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_label), `Enabled, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_combo_box), `Enabled, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, false );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, true );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, true );
UI::ChangeWidget( `id(`connection_wizard), `Enabled, false );
}
}
-
- if (event["EventReason"]:""=="Activated" && event["ID"]:nil==`connection_wizard) return `connection_wizard;
-
- y2internal("event %1", event);
- return nil;
+ if( "Activated" == event["EventReason"]:"" )
+ { if( `apply == event["ID"]:nil )
+ { if( ! ApplyNetworkPrintingSettings() )
+ { Report::Error( // Message of a Report::Error.
+ // Only a simple message because this error does not happen on a normal system
+ // (i.e. a system which is not totally broken or totally messed up).
+ _("Failed to apply the settings to the system.")
+ );
+ }
+ }
+ if( `connection_wizard == event["ID"]:nil )
+ { return `connection_wizard;
+ }
+ }
+ y2internal("event %1", event);
+ y2milestone( "leaving handleNetworkPrinting" );
+ return nil;
}
-
+void storeNetworkPrinting( string key, map event )
+{ y2milestone( "entering storeNetworkPrinting with key '%1'\nand event '%2'", key, event );
+ if( ! ApplyNetworkPrintingSettings() )
+ { Report::Error( // Message of a Report::Error.
+ // Only a simple message because this error does not happen on a normal system
+ // (i.e. a system which is not totally broken or totally messed up).
+ _("Failed to apply the settings to the system.")
+ );
+ }
+ y2milestone( "leaving storeNetworkPrinting" );
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/tools/cups_client_only new/yast2-printer-2.17.7/tools/cups_client_only
--- old/yast2-printer-2.17.5/tools/cups_client_only 2008-08-27 14:21:43.000000000 +0200
+++ new/yast2-printer-2.17.7/tools/cups_client_only 2008-08-29 10:40:18.000000000 +0200
@@ -9,15 +9,18 @@
export LANG="POSIX"
umask 022
-SERVERNAME="$1"
+# When 'localhost' or its IP-address is to be set,
+# it is unified so that only 'localhost' or '127.0.0.1' are set
+# (but not stuff like 'LocalHost' or '127.000.000.001').
+SERVERNAME="$( echo $1 | sed -e 's/localhost/localhost/i' -e 's/127\.0*0\.0*0\.0*1/127.0.0.1/' )"
if test -n "$SERVERNAME"
then # When a SERVERNAME is specified, set it in /etc/cups/client.conf
# if SERVERNAME is not the magic word 'none' which
# is used to only remove all active ServerName entries.
- # Note that even 'localhost' is a valid entry there
+ # Note that even 'localhost' or '127.0.0.1' is a valid entry there
# which is used to force client tools (e.g. lpadmin, lpinfo, lpstat)
- # to ask the local cupsd via the IPP port on localhost (localhost:631)
+ # to ask the local cupsd via the IPP port on localhost (127.0.0.1:631)
# and not via the domain socket (/var/run/cups/cups.sock) because
# the latter failed in the past for certain third-party clients (e.g. Java).
# Note that (according to Michael Sweet) it is not a supported configuration
@@ -45,7 +48,10 @@
# the output is the empty string (i.e. nothing at all - not even a '\n' character).
# The 'tr ... [:blank:]' makes sure that all active ServerName entries
# are found if there is more than one which is a broken config.
-SERVERNAME="$( grep -i '^ServerName ' /etc/cups/client.conf | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 )"
+# Trailing spaces are removed and when 'localhost' or its IP-address is set,
+# it is unified so that YaST only needs to test for 'localhost' and '127.0.0.1'
+# (but not for stuff like 'LocalHost' or '127.000.000.001').
+SERVERNAME="$( grep -i '^ServerName ' /etc/cups/client.conf | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 | tr -s '\n' ' ' | sed -e 's/ *$//' -e 's/localhost/localhost/i' -e 's/127\.0*0\.0*0\.0*1/127.0.0.1/' )"
echo -n "$SERVERNAME"
# For a nicer output on a terminal where stdout and stderr is mixed up,
# output a '\n' on stderr to get subsequent stuff (e.g. the shell prompt
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/tools/modify_cupsd_conf new/yast2-printer-2.17.7/tools/modify_cupsd_conf
--- old/yast2-printer-2.17.5/tools/modify_cupsd_conf 2008-08-27 16:01:29.000000000 +0200
+++ new/yast2-printer-2.17.7/tools/modify_cupsd_conf 2008-08-29 10:41:19.000000000 +0200
@@ -17,7 +17,12 @@
echo "Without a new value, the current value is reported." 1>&2
echo "Supported keywords and possible new values are:" 1>&2
echo "Browsing [ On | Off ]" 1>&2
- echo "BrowseAllow [ all | none | @LOCAL | IP-address ]" 1>&2
+ echo "BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]" 1>&2
+ echo "E.g.: BrowseAllow '@LOCAL 192.168.100.1 192.168.200.0/255.255.255.0'" 1>&2
+ echo "There is a strict syntax for keywords and values:" 1>&2
+ echo "Case matters." 1>&2
+ echo "Neither leading nor trailing nor in-between spaces are allowed." 1>&2
+ echo "Multiple values for a keyword must be separated by exactly one space." 1>&2
exit 1
fi
@@ -34,7 +39,7 @@
{ if test -n "$VALUE"
then # If a value was specified, only 'On' or 'Off' (case sensitive) are allowed:
if ! test "On" = "$VALUE" -o "Off" = "$VALUE"
- then echo "Only '$KEY [ On | Off ]' is allowed." 1>&2
+ then echo "Only '$KEY [ On | Off ]' is supported." 1>&2
exit 4
fi
# Try to substitute an existing Browsing line (ignore case):
@@ -54,7 +59,8 @@
# Report the resulting setting in any case:
# The 'tr ... [:blank:]' makes sure that all active Browsing entries
# are found if there is more than one which is a broken config.
- RESULT="$( grep -i "^$KEY " $CUPSDCONF | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 )"
+ # Remove trailing spaces (needed for the test below).
+ RESULT="$( grep -i "^$KEY " $CUPSDCONF | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 | tr -s '\n' ' ' | sed -e 's/ *$//' )"
echo -n "$RESULT"
# For a nicer output on a terminal where stdout and stderr is mixed up,
# output a '\n' on stderr to get subsequent stuff (e.g. the shell prompt
@@ -67,20 +73,23 @@
fi
}
-# Function to deal with 'BrowseAllow [ all | none | @LOCAL | IP-address ]'
+# Function to deal with 'BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]'
BrowseAllow()
{ if test -n "$VALUE"
then # If a value was specified, only 'all' or 'none' or '@LOCAL' (case sensitive)
- # or a single IP-address is allowed:
- if ! test "all" = "$VALUE" -o "none" = "$VALUE" -o "@LOCAL" = "$VALUE"
- then # Test if value matches to IP-address syntax:
- if ! echo $VALUE | egrep -q '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'
- then echo "Only '$KEY [ all | none | @LOCAL | IP-address ]' is allowed." 1>&2
- exit 4
- fi
- fi
+ # or one or more IP-addresses are allowed:
+ for V in $VALUE
+ do if ! test "all" = "$V" -o "none" = "$V" -o "@LOCAL" = "$V"
+ then # Test if value matches to IP-address syntax:
+ if ! echo "$V" | egrep -q '^([0-9]{1,3}\.){3}[0-9]{1,3}(/([0-9]{1,2})|/(([0-9]{1,3}\.){3}[0-9]{1,3}))?$'
+ then echo "Only '$KEY [ all | none | @LOCAL | IP-address[/netmask] ]' is supported." 1>&2
+ exit 4
+ fi
+ fi
+ done
# Set 'BrowseOrder allow,deny' to deny browse packets by default
- # and then allow them from certain sources via a BrowseAllow entry.
+ # and then allow them from certain sources via BrowseAllow entries
+ # and finally deny from certain sources via BrowseDeny entries.
# All existing BrowseOrder lines are removed (ignore case).
sed -i.yast2save -e '/^BrowseOrder.*/Id' $CUPSDCONF
# Append the new BrowseOrder line below the last 'Brows' line (ignore case)
@@ -91,16 +100,22 @@
then sed -i -e "${LAST_BROWSE_LINE}aBrowseOrder allow,deny" $CUPSDCONF
else echo -en "\nBrowseOrder allow,deny\n\n" >>$CUPSDCONF
fi
- # All existing BrowseAllow lines are removed (ignore case):
+ # All existing active BrowseAllow lines are removed (ignore case):
sed -i -e '/^BrowseAllow.*/Id' $CUPSDCONF
- # Append a BrowseAllow line below the BrowseOrder line
- # to have the new BrowseAllow line at the matching place:
- sed -i -e "/^BrowseOrder /a$KEY from $VALUE" $CUPSDCONF
+ # All existing active BrowseDeny lines are deactivated (ignore case):
+ sed -i -e 's/^\(BrowseDeny.*\)$/#\1/i' $CUPSDCONF
+ # Insert BrowseAllow lines before the BrowseOrder line
+ # to have the new BrowseAllow lines at the matching place
+ # and in the ordering of the values (needed for the test below):
+ for V in $VALUE
+ do sed -i -e "/^BrowseOrder /i$KEY from $V" $CUPSDCONF
+ done
fi
# Report the resulting setting in any case:
# The 'tr ... [:blank:]' makes sure that all active BrowseAllow entries
# are found if there is more than one which is allowed.
- RESULT="$( grep -i "^$KEY " $CUPSDCONF | tr -s '[:blank:]' ' ' | cut -s -d' ' -f3 )"
+ # Remove trailing spaces (needed for the test below).
+ RESULT="$( grep -i "^$KEY " $CUPSDCONF | sed -e 's/from//I' | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 | tr -s '\n' ' ' | sed -e 's/ *$//' )"
echo -n "$RESULT"
# For a nicer output on a terminal where stdout and stderr is mixed up,
# output a '\n' on stderr to get subsequent stuff (e.g. the shell prompt
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.17.5/VERSION new/yast2-printer-2.17.7/VERSION
--- old/yast2-printer-2.17.5/VERSION 2008-08-27 16:22:22.000000000 +0200
+++ new/yast2-printer-2.17.7/VERSION 2008-08-29 14:45:23.000000000 +0200
@@ -1 +1 @@
-2.17.5
+2.17.7
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org