Author: jsmeix
Date: Mon Oct 13 10:25:47 2008
New Revision: 52092
URL: http://svn.opensuse.org/viewcvs/yast?rev=52092&view=rev
Log:
- The CUPS Policies dialog should work now.
- Fixed a bug regarding "Share Printers" so that it reports now
the Allow values only from the root location (<Location />).
- 2.17.20
Modified:
trunk/printer/VERSION
trunk/printer/package/yast2-printer.changes
trunk/printer/src/Printerlib.ycp
trunk/printer/src/helps.ycp
trunk/printer/src/policies.ycp
trunk/printer/src/printingvianetwork.ycp
trunk/printer/src/sharing.ycp
Modified: trunk/printer/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=52092&r1=52091&r2=52092&view=diff
==============================================================================
--- trunk/printer/VERSION (original)
+++ trunk/printer/VERSION Mon Oct 13 10:25:47 2008
@@ -1 +1 @@
-2.17.19
+2.17.20
Modified: trunk/printer/package/yast2-printer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=52092&r1=52091&r2=52092&view=diff
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Mon Oct 13 10:25:47 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Mon Oct 13 10:19:40 CEST 2008 - jsmeix@suse.de
+
+- The CUPS Policies dialog should work now.
+- Fixed a bug regarding "Share Printers" so that it reports now
+ the Allow values only from the root location (<Location />).
+- 2.17.20
+
+-------------------------------------------------------------------
Thu Oct 9 12:26:11 CEST 2008 - jsmeix@suse.de
- Check if the cups-client RPM is installed (strictly required)
Modified: trunk/printer/src/Printerlib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printerlib.ycp?rev=52092&r1=52091&r2=52092&view=diff
==============================================================================
--- trunk/printer/src/Printerlib.ycp (original)
+++ trunk/printer/src/Printerlib.ycp Mon Oct 13 10:25:47 2008
@@ -400,8 +400,6 @@
return true;
}
-global map operation_policy = $[];
-
global map cups_autoconfig = $[];
global void Read()
Modified: trunk/printer/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/helps.ycp?rev=52092&r1=52091&r2=52092&view=diff
==============================================================================
--- trunk/printer/src/helps.ycp (original)
+++ trunk/printer/src/helps.ycp Mon Oct 13 10:25:47 2008
@@ -360,6 +360,7 @@
To access print queues on a Novell Netware print server,
the RPM package ncpfs must be installed.
The package provides the CUPS backend 'novell' which runs
+CUPS 1.1.18
the <tt>nprint</tt> program which actually sends the data
to a Novell Netware print queue.
A server name and a printer queue name is needed to access it.
@@ -457,13 +458,35 @@
</p>"),
"policies" :
-// Policies help 1/1:
+// Policies help 1/2:
_("<p>
<b><big>CUPS Operation Policy</big></b><br>
Operation policies are the rules used for each operation in CUPS.
Such operations are for example 'print something', 'cancel a printout',
'configure a printer', 'modify or remove a printer configuration',
and 'enable or disable printing'.
+</p>") +
+// Policies help 2/2:
+_("<p>
+<b><big>CUPS Error Policy</big></b><br>
+The error policy defines the default policy that is used when
+CUPS fails to send a print job to the printer device.<br>
+Depending on the particular way how the printer is connected
+(for example 'parallel', 'usb', 'socket', 'lpd', or 'ipp'),
+and depending on the actual kind of failure,
+the CUPS backend which actually sends the data to the printer
+can overwrite the default error policy
+and enforce another error policy (see 'man backend').
+For example it can stop any further printing attempt
+even when the default error policy is to retry the job.
+This could happen when any attempt to establish
+the communication with the printer is useless
+so that it does no make sense to retry the job.
+<br>
+The following error policies exist:<br>
+Stop the printer and keep the job for future printing.<br>
+Re-send the job from the beginning after waiting some time (30 seconds by default).<br>
+Abort and delete the job and proceed with the next job.
</p>"),
"autoconfig" :
Modified: trunk/printer/src/policies.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/policies.ycp?rev=52092&r1=52091&r2=52092&view=diff
==============================================================================
--- trunk/printer/src/policies.ycp (original)
+++ trunk/printer/src/policies.ycp Mon Oct 13 10:25:47 2008
@@ -39,48 +39,155 @@
include "printer/helps.ycp";
-term widgetPolicies = `VBox(
- `Left( `Label(_("Specify the operation policy")) ),
- `Left( `ComboBox(`id("operationpolicy"), _("The operation &policy"), [""]) ),
- `HSpacing()
-);
-
-void initPolicies(string key){
-# if( Printerlib::ExecuteBashCommand("{ grep -i '^DefaultPolicy ' /etc/cups/cupsd.conf.orig || echo "DefaultPolicy default" ; } | cut -d' ' -f2") ){
- if( Printerlib::ExecuteBashCommand("grep '^' -f1") ){
- UI::ChangeWidget(`id("operationpolicy"), `Items, splitstring(Printerlib::result["stdout"]:"", "\n"));
- }
- foreach(map conf, Printerlib::operation_policy["value", 0, "value"]:[], {
- if (conf["name"]:""=="operationpolicy")
- UI::ChangeWidget(`id(conf["name"]:""), `Value, conf["value"]:"");
- else UI::ChangeWidget(`id(conf["name"]:""), `Value, conf["value"]:""=="yes" ? true : false);
- });
+string initial_operation_policy = "default";
+// An entry for a ComboBox from which the user can select that the CUPS error policy
+// which is used when it fails to send a job to the printer is to
+// stop the printer and keep the job for future printing:
+string error_policy_stop_printer_string = _("stop the printer and keep the job for future printing");
+// An entry for a ComboBox from which the user can select that the CUPS error policy
+// which is used when it fails to send a job to the printer is to
+// re-send the job from the beginning after waiting some time
+// (the default JobRetryInterval is 30 seconds but this can be changed):
+string error_policy_retry_job_string = _("re-send the job from the beginning after waiting some time");
+// An entry for a ComboBox from which the user can select that the CUPS error policy
+// which is used when it fails to send a job to the printer is to
+// abort and delete the job and proceed with the next job:
+string error_policy_abort_job_string = _("abort and delete the job and proceed with the next job");
+string initial_error_policy = "stop-printer";
+
+term widgetPolicies = `VBox
+ ( `VStretch(),
+ `Left
+ ( `ComboBox
+ ( `id("operation_policy"),
+ // Header for a ComboBox to specify the CUPS operation policy:
+ _("Specify the &operation policy"),
+ [""]
+ )
+ ),
+ `VStretch(),
+ `Left
+ ( `ComboBox
+ ( `id("error_policy"),
+ // Header for a ComboBox to specify the CUPS error policy:
+ _("Specify the &error policy"),
+ [ `item( `id("stop-printer"), error_policy_stop_printer_string ),
+ `item( `id("retry-job"), error_policy_retry_job_string ),
+ `item( `id("abort-job"), error_policy_abort_job_string ),
+ ]
+ )
+ ),
+ `VStretch()
+ );
+
+void initPolicies( string key )
+{ y2milestone( "entering initPolicies with key '%1'", key );
+ // Determine the existing policy names in '<Policy policy-name>' sections in /etc/cups/cupsd.conf:
+ list< string > policy_names = [ "" ];
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf Policies" ) )
+ { // The command outputs a line where multiple policy names are separated by space
+ // but possible duplicate policy names are not removed in the command output:
+ policy_names = toset( splitstring( Printerlib::result["stdout"]:"", " " ) );
+ }
+ else
+ { // Use fallback value when the command above failed:
+ policy_names = [ "default" ];
+ }
+ // Determine the DefaultPolicy in /etc/cups/cupsd.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf DefaultPolicy" ) )
+ { // The command outputs a line where multiple DefaultPolicy entries are separated by space
+ // but possible duplicate policy names are not removed in the command output.
+ // Multiple DefaultPolicy entries are a broken config but it can happen
+ // and in this case the first DefaultPolicy entry is used:
+ initial_operation_policy = splitstring( Printerlib::result["stdout"]:"", " " )[0]:"default";
+ }
+ else
+ { // Use fallback value when the command above failed:
+ initial_operation_policy = "default";
+ }
+ // Use only the plain strings in the policy_names list without an id
+ // for the operation_policy ComboBox:
+ UI::ChangeWidget(`id("operation_policy"), `Items, policy_names);
+ // Have the initial_operation_policy preselected:
+ UI::ChangeWidget(`id("operation_policy"), `Value, initial_operation_policy);
+ // Determine the ErrorPolicy in /etc/cups/cupsd.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf ErrorPolicy" ) )
+ { // The command outputs a line where multiple ErrorPolicy entries are separated by space
+ // but possible duplicate policy names are not removed in the command output.
+ // Multiple ErrorPolicy entries are a broken config but it can happen
+ // and in this case the first ErrorPolicy entry is used:
+ initial_error_policy = splitstring( Printerlib::result["stdout"]:"", " " )[0]:"stop-printer";
+ }
+ else
+ { // Use fallback value when the command above failed:
+ initial_error_policy = "stop-printer";
+ }
+ // Have the initial_error_policy preselected:
+ UI::ChangeWidget(`id("error_policy"), `Value, `id(initial_error_policy));
+ y2milestone( "leaving initPolicies with\ninitial_operation_policy = '%1'\ninitial_error_policy = '%2'", initial_operation_policy, initial_error_policy );
}
-void storePolicies(string key, map event){
- y2internal("storeOperationPolicy: here I am ;-)");
- foreach(string key, ["operationpolicy"], {
- map value = $[
- "comment" : "",
- "kind" : "value",
- "name" : key
- ];
- if (key=="operationpolicy") value["value"] = (string) UI::QueryWidget(`id(key), `Value);
- else value["value"] = ((boolean)UI::QueryWidget(`id(key), `Value)) ? "yes" : "no";
-
- y2internal("values for %1 : %2", key, value);
- list<map> config=[];
- boolean found=false;
- foreach(map row, Printerlib::operation_policy["value", 0, "value"]:[], {
- if (row["name"]:""==key){
- row["value"]=value["value"]:"";
- found=true;
- }
- config=add(config, row);
- });
- if (!found) config=add(config, value);
- Printerlib::operation_policy["value", 0, "value"]=config;
- });
+void storePolicies( string key, map event)
+{ y2milestone( "entering storePolicies with key '%1'\nand event '%2'", key, event );
+ boolean applied_policies = true;
+ // Get the actual settings and values from the dialog:
+ string current_operation_policy = (string)UI::QueryWidget( `id("operation_policy"), `Value );
+ y2milestone( "current_operation_policy: '%1'", current_operation_policy );
+ string current_error_policy = (string)UI::QueryWidget( `id("error_policy"), `Value );
+ y2milestone( "current_error_policy: '%1'", current_error_policy );
+ if( current_operation_policy == initial_operation_policy
+ && current_error_policy == initial_error_policy )
+ { y2milestone( "Nothing changed in 'Policies' 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();
+ y2milestone( "leaving storePolicies" );
+ return nil;
+ }
+ if( current_operation_policy != initial_operation_policy )
+ { if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf DefaultPolicy " + current_operation_policy ) )
+ { Popup::ErrorDetails( sformat( // Popup::ErrorDetails message
+ // where %1 will be replaced by the default operation policy value.
+ // Do not change or translate "DefaultPolicy", it is a system settings name.
+ _("Failed to set 'DefaultPolicy %1' in /etc/cups/cupsd.conf"),
+ current_operation_policy
+ ),
+ Printerlib::result["stderr"]:""
+ );
+ applied_policies = false;
+ }
+ }
+ if( current_error_policy != initial_error_policy )
+ { if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf ErrorPolicy " + current_error_policy ) )
+ { Popup::ErrorDetails( sformat( // Popup::ErrorDetails message
+ // where %1 will be replaced by the default error policy value.
+ // Do not change or translate "ErrorPolicy", it is a system settings name.
+ _("Failed to set 'ErrorPolicy %1' in /etc/cups/cupsd.conf"),
+ current_error_policy
+ ),
+ Printerlib::result["stderr"]:""
+ );
+ applied_policies = false;
+ }
+ }
+ // If a local cupsd is accessible, restart it,
+ // otherwise do nothing (i.e. do not start it now):
+ if( Printerlib::GetAndSetCupsdStatus( "" ) )
+ { if( ! Printerlib::GetAndSetCupsdStatus( "restart" ) )
+ { applied_policies = false;
+ }
+ }
+ if( ! applied_policies )
+ { Popup::Error( // Popup::Error message:
+ _("Failed to apply the settings to the system.")
+ );
+ }
+ y2milestone( "leaving storePolicies" );
+ return nil;
}
/* EOF */
Modified: trunk/printer/src/printingvianetwork.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printingvianetwork.ycp?rev=52092&r1=52091&r2=52092&view=diff
==============================================================================
--- trunk/printer/src/printingvianetwork.ycp (original)
+++ trunk/printer/src/printingvianetwork.ycp Mon Oct 13 10:25:47 2008
@@ -40,6 +40,25 @@
include "printer/helps.ycp";
+boolean printing_via_network_has_changed = false;
+any initial_radio_button = nil;
+any initial_browse_allow = nil;
+string initial_browse_allow_input_value = "";
+string initial_server_name_input_value = "";
+// An entry for a ComboBox from which the user can select
+// that printer information is accepted from
+// all remote CUPS servers:
+string browse_allow_all_string = _("all hosts");
+// An entry for a ComboBox from which the user can select
+// that printer information is accepted from
+// remote CUPS servers in the local network:
+string browse_allow_local_string = _("hosts in the local network");
+// An entry for a ComboBox from which the user can select
+// that printer information is accepted only from
+// remote CUPS servers with specific addresses
+// where the specific addresses are specified in a TextEntry below:
+string browse_allow_specific_string = _("only specific addresses");
+
term widgetNetworkPrinting = `VBox
( `VStretch(),
`Frame
@@ -83,9 +102,9 @@
// a usual general setting from which remote CUPS servers
// printer information is accepted:
_("Usual &General Setting"),
- [ `item( `id(`browse_allow_all), "all hosts" ),
- `item( `id(`browse_allow_local), "hosts in the local network" ),
- `item( `id(`browse_allow_specific), "only specific addresses" ),
+ [ `item( `id(`browse_allow_all), browse_allow_all_string ),
+ `item( `id(`browse_allow_local), browse_allow_local_string ),
+ `item( `id(`browse_allow_specific), browse_allow_specific_string ),
]
)
),
@@ -162,12 +181,6 @@
`VStretch()
);
-boolean printing_via_network_has_changed = false;
-any initial_radio_button = nil;
-any initial_browse_allow = nil;
-string initial_browse_allow_input_value = "";
-string initial_server_name_input_value = "";
-
boolean TestClientOnlyServer( string server_name )
{ string netcat_test_good_message = sformat( // Popup message
// where %1 will be replaced by the server name.
@@ -333,7 +346,7 @@
{ printing_via_network_has_changed = false;
// Get the actual settings and values from the dialog:
any current_radio_button = UI::QueryWidget( `id(`browsing_or_client_only_check_boxes), `CurrentButton );
- any current_browse_allow = UI::QueryWidget( `id(`browse_allow_combo_box), `Value );
+ any current_browse_allow = UI::QueryWidget( `id(`browse_allow_combo_box), `Value );
string current_browse_allow_input_value = (string)UI::QueryWidget( `id(`browse_allow_input), `Value );
string current_server_name_input_value = (string)UI::QueryWidget( `id(`client_conf_server_name_input), `Value );
y2milestone( "ApplyNetworkPrintingSettings with\ncurrent_radio_button = '%1'\ncurrent_browse_allow = '%2'\ncurrent_browse_allow_input_value = '%3'\ncurrent_server_name_input_value = '%4'", current_radio_button, current_browse_allow, current_browse_allow_input_value, current_server_name_input_value );
@@ -795,7 +808,7 @@
UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
}
if( `browse_allow_combo_box == event["ID"]:nil )
- { if( `browse_allow_all == UI::QueryWidget( `id(`browse_allow_combo_box), `Value ) )
+ { if( `browse_allow_all == UI::QueryWidget( `id(`browse_allow_combo_box), `Value ) )
{ // If browsing info is accepted from all hosts,
// it is useless to additionally accept it from specific IPs or networks:
UI::ChangeWidget( `id(`browse_allow_input), `Enabled, false );
Modified: trunk/printer/src/sharing.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/sharing.ycp?rev=52092&r1=52091&r2=52092&view=diff
==============================================================================
--- trunk/printer/src/sharing.ycp (original)
+++ trunk/printer/src/sharing.ycp Mon Oct 13 10:25:47 2008
@@ -264,11 +264,11 @@
boolean publish_to_local_network = (boolean)UI::QueryWidget( `publish_to_local_network_check_box, `Value );
y2milestone( "publish_to_local_network_check_box value: '%1'", publish_to_local_network );
interface_table_items = (list<term>)UI::QueryWidget( `interface_table, `Items );
- y2milestone( "interface_table_items: %1", interface_table_items );
+ y2milestone( "interface_table_items: '%1'", interface_table_items );
string current_allow_input_value = (string)UI::QueryWidget( `id(`allow_input), `Value );
- y2milestone( "current_allow_input_value: %1", current_allow_input_value );
+ y2milestone( "current_allow_input_value: '%1'", current_allow_input_value );
string current_browse_address_input_value = (string)UI::QueryWidget( `id(`browse_address_input), `Value );
- y2milestone( "current_browse_address_input_value: %1", current_browse_address_input_value );
+ y2milestone( "current_browse_address_input_value: '%1'", current_browse_address_input_value );
string allow_values = current_allow_input_value;
string browse_address_values = current_browse_address_input_value;
foreach( term interface_table_item,
@@ -417,7 +417,7 @@
// Do not change or translate "Allow", it is a system settings name.
_("Failed to set 'Allow' entries '%1' in /etc/cups/cupsd.conf"),
allow_values
- ),
+ ),
Printerlib::result["stderr"]:""
);
return false;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org