Author: jsmeix
Date: Fri Feb 4 14:57:22 2011
New Revision: 63347
URL: http://svn.opensuse.org/viewcvs/yast?rev=63347&view=rev
Log:
- Fixed the automatic configuration in printer_proposal.ycp
so that it waits until config files have been actually updated.
- Enhanced the "Automatic Configuration" dialog so that
the user can trigger that the automatic configuration
via printer_proposal.ycp is run.
- 2.20.7
Modified:
trunk/printer/VERSION
trunk/printer/package/yast2-printer.changes
trunk/printer/src/autoconfig.ycp
trunk/printer/src/dialogs.ycp
trunk/printer/src/helps.ycp
trunk/printer/src/printer_auto.ycp
trunk/printer/src/printer_proposal.ycp
trunk/printer/src/sharing.ycp
Modified: trunk/printer/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/VERSION (original)
+++ trunk/printer/VERSION Fri Feb 4 14:57:22 2011
@@ -1 +1 @@
-2.20.6
+2.20.7
Modified: trunk/printer/package/yast2-printer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Fri Feb 4 14:57:22 2011
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Fri Feb 4 14:51:44 CET 2011 - jsmeix@suse.de
+
+- Fixed the automatic configuration in printer_proposal.ycp
+ so that it waits until config files have been actually updated.
+- Enhanced the "Automatic Configuration" dialog so that
+ the user can trigger that the automatic configuration
+ via printer_proposal.ycp is run.
+- 2.20.7
+
+-------------------------------------------------------------------
Tue Jan 25 14:10:21 CET 2011 - jsmeix@suse.de
- Adapted the "Driver Packages" dialog because the package
Modified: trunk/printer/src/autoconfig.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/autoconfig.ycp?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/src/autoconfig.ycp (original)
+++ trunk/printer/src/autoconfig.ycp Fri Feb 4 14:57:22 2011
@@ -21,7 +21,7 @@
/**
* File: include/printer/dialogs.ycp
* Package: Configuration of printer
- * Summary: Autoconfig settings dialog definition
+ * Summary: Automatic Configuration dialog definition
* Authors: Johannes Meixner
*
* $Id: autoconfig.ycp 27914 2006-02-13 14:32:08Z locilka $
@@ -41,11 +41,25 @@
( // Have space between the top of the dialog and the content:
`VStretch(),
`Left
+ ( `CheckBox
+ ( // CheckBox to let YaST configure local connected printers automatically:
+ `id("printer_proposal_check_box"),
+ `opt(`notify),
+ // CheckBox to trigger an automatic configuration of local connected printers
+ // by calling the YaST printer module autoconfig functionality right now.
+ _("&Do an automatic configuration of local connected printers now"),
+ // This trigger CheckBox is initially off in any case:
+ false
+ )
+ ),
+ // Have space between the two parts of of the dialog:
+ `VStretch(),
+ `Left
( `Label
( `id("autoconfig_label"),
// Header for a dialog section where the user can
// specify if USB printers are configured automatically:
- _("Specify if USB printers are configured automatically")
+ _("Specify if automatic USB printer configuration should happen when plug in")
)
),
`Left
@@ -58,7 +72,7 @@
// CheckBox for automatic configuration of USB printers
// by installing or removing the RPM package udev-configure-printer.
// Do not change or translate "udev-configure-printer", it is a RPM package name.
- _("&Use the package udev-configure-printer for automated USB printer configuration")
+ _("&Use the package udev-configure-printer for automatic USB printer configuration")
)
),
// Have space between the content and the bottom of the dialog:
@@ -67,8 +81,8 @@
void initAutoconfig( string key )
{ y2milestone( "entering initAutoconfig with key '%1'", key );
- boolean autoconfig_settings_dialog_is_useless = false;
- // The whole Autoconfig Settings dialog is useless if it is a "client-only" config.
+ boolean autoconfig_dialog_is_useless = false;
+ // The whole Automatic Configuration dialog is useless if it is a "client-only" config.
// Determine whether or not it is currently a real client-only config
// (i.e. a ServerName != "localhost/127.0.0.1" in /etc/cups/client.conf)
// and ignore when it fails (i.e. use the fallback value silently):
@@ -83,8 +97,8 @@
_("A remote CUPS server setting conflicts with automatic configuration of printers for the local system.")
)
)
- { autoconfig_settings_dialog_is_useless = true;
- y2milestone( "autoconfig_settings_dialog_is_useless because user decided not to disable client-only CUPS server '%1'",
+ { autoconfig_dialog_is_useless = true;
+ y2milestone( "autoconfig_dialog_is_useless because user decided not to disable client-only CUPS server '%1'",
Printerlib::client_conf_server_name
);
}
@@ -95,8 +109,8 @@
_("Failed to remove the 'ServerName' entry in /etc/cups/client.conf"),
Printerlib::result["stderr"]:"" + "\n" + Printerlib::result["stdout"]:""
);
- autoconfig_settings_dialog_is_useless = true;
- y2milestone( "autoconfig_settings_dialog_is_useless because it failed to disable client-only CUPS server '%1'",
+ autoconfig_dialog_is_useless = true;
+ y2milestone( "autoconfig_dialog_is_useless because it failed to disable client-only CUPS server '%1'",
Printerlib::client_conf_server_name
);
}
@@ -104,15 +118,18 @@
}
// When it is no "client-only" config,
// determine whether or not a local cupsd is accessible:
- if( ! autoconfig_settings_dialog_is_useless )
+ if( ! autoconfig_dialog_is_useless )
{ if( ! Printerlib::GetAndSetCupsdStatus( "" ) )
{ // Printerlib::GetAndSetCupsdStatus already shows a confirmation popup:
if( ! Printerlib::GetAndSetCupsdStatus( "start" ) )
- { autoconfig_settings_dialog_is_useless = true;
- y2milestone( "autoconfig_settings_dialog_is_useless because 'rccups start' failed." );
+ { autoconfig_dialog_is_useless = true;
+ y2milestone( "autoconfig_dialog_is_useless because 'rccups start' failed." );
}
}
}
+ // The CheckBox to trigger an automatic configuration of local connected printers
+ // is initially off in any case:
+ UI::ChangeWidget( `id("printer_proposal_check_box"), `Value, false );
// Determine if udev-configure-printer is installed.
boolean udev_configure_printer_installed = Printerlib::TestAndInstallPackage( "udev-configure-printer", "installed" );
// Avoid a flickering change of the udev_configure_printer_check_box value
@@ -124,9 +141,10 @@
else
{ UI::ChangeWidget( `id("udev_configure_printer_check_box"), `Value, false );
}
- // Disable all widgets in the whole dialog if autoconfig_settings_dialog_is_useless:
- if( autoconfig_settings_dialog_is_useless )
- { UI::ChangeWidget( `id("autoconfig_label"), `Enabled, false );
+ // Disable all widgets in the whole dialog if autoconfig_dialog_is_useless:
+ if( autoconfig_dialog_is_useless )
+ { UI::ChangeWidget( `id("printer_proposal_check_box"), `Enabled, false );
+ UI::ChangeWidget( `id("autoconfig_label"), `Enabled, false );
UI::ChangeWidget( `id("udev_configure_printer_check_box"), `Enabled, false );
}
y2milestone( "leaving initAutoconfig with udev_configure_printer_installed = '%1'", udev_configure_printer_installed );
@@ -176,7 +194,33 @@
symbol handleAutoconfig( string key, map event )
{ y2milestone( "entering handleAutoconfig with key '%1'\nand event '%2'", key, event );
if( "ValueChanged" == event["EventReason"]:"" )
- { if( "udev_configure_printer_check_box" == event["WidgetID"]:"" )
+ { if( "printer_proposal_check_box" == event["WidgetID"]:"" )
+ { string queues_and_descriptions = "";
+ // Call the YaST printer module autoconfig functionality:
+ map printer_proposal_result = (map)WFM::CallFunction( "printer_proposal", ["MakeProposal"] );
+ y2milestone( "handleAutoconfig printer_proposal_result = '%1'", printer_proposal_result );
+ if( printer_proposal_result != nil )
+ { list<string> queues_and_descriptions_list = printer_proposal_result["raw_proposal"]:[""];
+ foreach( string queue_and_description,
+ queues_and_descriptions_list,
+ { if( "" != queue_and_description )
+ { queues_and_descriptions = queues_and_descriptions + "\n" + queue_and_description;
+ }
+ }
+ );
+ }
+ if( "" == queues_and_descriptions )
+ { queues_and_descriptions = _("The automated printer configuration was in vain.");
+ }
+ Popup::AnyMessage( // Popup::AnyMessage header:
+ _("Automated printer configuration results"),
+ // Popup::AnyMessage message:
+ queues_and_descriptions
+ );
+ // Re-set the CheckBox to trigger automatic configuration back to its initial state 'off':
+ UI::ChangeWidget( `id("printer_proposal_check_box"), `Value, false );
+ }
+ if( "udev_configure_printer_check_box" == event["WidgetID"]:"" )
{ // Ignore its return code because it shows already Popup::Error messages:
ApplyAutoconfigSettings();
}
Modified: trunk/printer/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/dialogs.ycp?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/src/dialogs.ycp (original)
+++ trunk/printer/src/dialogs.ycp Fri Feb 4 14:57:22 2011
@@ -109,9 +109,9 @@
"widget_names" : ["POLICIES"]
],
"autoconfig" :
- $[ "header" : _("Autoconfig Settings"),
- "tree_item_label" : _("Autoconfig Settings"),
- "caption" : _("Autoconfig Settings"),
+ $[ "header" : _("Automatic Configuration"),
+ "tree_item_label" : _("Automatic Configuration"),
+ "caption" : _("Automatic Configuration"),
"contents" : `VBox( "AUTOCONFIG" ),
"widget_names" : ["AUTOCONFIG"]
]
Modified: trunk/printer/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/helps.ycp?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/src/helps.ycp (original)
+++ trunk/printer/src/helps.ycp Fri Feb 4 14:57:22 2011
@@ -772,7 +772,7 @@
</p>"),
"sharing_dialog" :
-// SharingDialog help 1/3:
+// SharingDialog help 1/4:
_("<p>
<b><big>Sharing Print Queues and Publish Them Via Network</big></b><br>
Usually CUPS (Common Unix Printing System) should be set up to use
@@ -782,16 +782,35 @@
which is listening for incomming information about published printers.<br>
CUPS Browsing information is recieved via UDP port 631.
</p>") +
-// SharingDialog help 2/3:
+// SharingDialog help 2/4:
_("<p>
First of all CUPS client systems must be allowed to access the CUPS server.
-Then specify whether or not printers should be published to the clients.
-It is not required to publish printers in any case.
+Then specify whether or not printers should be published to the clients.<br>
+In a local network the usual way to set up CUPS Browsing is
+to allow remote access for all hosts in the local network
+and to publish printers to all those hosts.<br>
+It is not required to publish printers in any case.<br>
If you have only one single CUPS server, there is no need to use CUPS Browsing.
Instead it is simpler to specify the CUPS server on the client systems
(via 'Printing Via Network') so that the clients access the server directly.
</p>") +
-// SharingDialog help 3/3:
+// SharingDialog help 3/4:
+_("<p>
+There are various ways which can coexist how to specify
+which remote hosts are allowed to access the CUPS server.<br>
+Allow remote access for computers within the local network
+will allow access from all hosts in the local network.
+A remote host is in the local network when it has an IP address
+that belongs to the same network as the CUPS server
+and when the network connection of the host
+uses a non-PPP interface on the CUPS server
+(an interface whose IFF_POINTOPOINT flag is not set).<br>
+Alternatively or additionally an explicite list of network interfaces
+from which remote access is allowed can be specified.<br>
+Alternatively or additionally an explicite list of
+allowed IP addresses and/or networks can be specified.
+</p>") +
+// SharingDialog help 4/4:
_("<p>
Regarding firewall:<br>
A firewall is used to protect running server processes
@@ -859,18 +878,30 @@
"autoconfig" :
// Autoconfig help 1/2:
_("<p>
-<b><big>CUPS Autoconfiguration for USB Printers</big></b><br>
-USB Printer autoconfiguration is provided
-by the RPM package 'udev-configure-printer'.<br>
-When its check box is initially not checked, it is not installed
-and then you can select it so that it will be installed.<br>
-When its check box is initially checked, it is already installed
-and then you can un-select it so that it will be removed.
+<b><big>Automatic Configuration for Local Connected Printers</big></b><br>
+Check the check box to run YaST's automatic configuration
+for printers which are connected to the local host.<br>
+For each autodetected local connected printer,
+YaST tests if there exists already a configuration.
+If there is not yet a configuration,
+YaST tries to find a matching driver for the printer
+and if one is found, the printer is configured.<br>
+The resulting configuration is basically the same
+as if one would have selected an autodetected printer
+in the 'Add New Printer Configuration' dialog
+and accepted whatever preselected values there.
</p>") +
// Autoconfig help 2/2:
_("<p>
+<b><big>Automatic Configuration for USB Printers</big></b><br>
+The RPM package 'udev-configure-printer' provides
+automatic configuration when USB printers are plugged in.<br>
+When its check box is initially not checked, it is not installed
+and then you can select it so that it will be installed.<br>
+When its check box is initially checked, it is already installed
+and then you can un-select it so that it will be removed.<br>
When udev-configure-printer is installed,
-automatic USB printer setup happens via the entries
+automatic USB printer configuration happens via the entries
in its udev config file /lib/udev/rules.d/70-printers.rules
which triggers to run 'udev-configure-printer add'
when a USB printer is plugged in
Modified: trunk/printer/src/printer_auto.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printer_auto.ycp?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/src/printer_auto.ycp (original)
+++ trunk/printer/src/printer_auto.ycp Fri Feb 4 14:57:22 2011
@@ -71,11 +71,16 @@
string func = "";
map param = $[];
-/* Check arguments */
-if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
- func = (string)WFM::Args(0);
- if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
- param = (map) WFM::Args(1);
+// Check arguments:
+if( size( WFM::Args() ) > 0
+ && is( WFM::Args(0), string )
+ )
+{ func = (string)WFM::Args(0);
+ if( size( WFM::Args() ) > 1
+ && is( WFM::Args(1), map )
+ )
+ { param = (map)WFM::Args(1);
+ }
}
y2milestone("Printer auto func='%1'", func);
y2milestone("Printer auto param='%1'", param);
@@ -352,7 +357,7 @@
}
return true;
}
-/* Unknown function */
+// Unknown function:
else {
y2error("Unknown function: %1", func);
ret = false;
Modified: trunk/printer/src/printer_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printer_proposal.ycp?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/src/printer_proposal.ycp (original)
+++ trunk/printer/src/printer_proposal.ycp Fri Feb 4 14:57:22 2011
@@ -43,15 +43,29 @@
import "Service";
import "Popup";
-/* The main () */
y2milestone("----------------------------------------");
y2milestone("Printer proposal started");
-string func = (string) WFM::Args(0);
-map param = (map) WFM::Args(1);
-map ret = $[];
+any ret = nil;
+string func = "";
+map param = $[];
-/* create a textual proposal and write it instantly to the system */
+// Check arguments:
+if( size( WFM::Args() ) > 0
+ && is( WFM::Args(0), string )
+ )
+{ func = (string)WFM::Args(0);
+ if( size( WFM::Args() ) > 1
+ && is( WFM::Args(1), map )
+ )
+ { param = (map)WFM::Args(1);
+ }
+}
+y2milestone("Printer proposal func='%1'", func);
+y2milestone("Printer proposal param='%1'", param);
+
+
+// Create a textual proposal and write it instantly to the system:
if( func == "MakeProposal" )
{ list<string> proposal = [];
string warning = nil;
@@ -69,7 +83,7 @@
// and skip the automated queue setup if one of them is missing, see
// https://bugzilla.novell.com/show_bug.cgi?id=445719#c13
// If cups-client is missing, it would run into an endless sequence of errors.
- // If cups is missing, theer can be no local running cupsd which is
+ // If cups is missing, there can be no local running cupsd which is
// mandatory to set up local print queues.
if( ! Printerlib::TestAndInstallPackage( "cups-client", "installed" ) )
{ y2milestone("Skipped automated queue setup because the package cups-client is not installed.");
@@ -181,12 +195,16 @@
}
else
{ y2milestone("Local printers detected, will set up queues for them:");
+ list<string> initially_existing_queues = [];
list<string> already_set_up_uris = [];
// An empty list of autodetected queues is the fallback which is correct:
Printer::AutodetectQueues();
foreach( map< string, string > queue,
Printer::queues,
- { if( "" != queue["uri"]:"" )
+ { if( "" != queue["name"]:"" )
+ { initially_existing_queues = add( initially_existing_queues, queue["name"]:"" );
+ }
+ if( "" != queue["uri"]:"" )
{ already_set_up_uris = add( already_set_up_uris, queue["uri"]:"" );
}
}
@@ -241,6 +259,16 @@
string default_paper_size = "";
if( Printer::AddQueue( queue_name, is_default_queue, default_paper_size ) )
{ already_set_up_uris = add( already_set_up_uris, uri );
+ // Since CUPS 1.4 the new DirtyCleanInterval directive controls
+ // the delay when cupsd updates config files (see basicadd.ycp).
+ if( ! Printerlib::WaitForUpdatedConfigFiles( _("Creating New Printer Setup") ) )
+ { // It returns false if the user had interrupted the waiting for updated config files:
+ Popup::ErrorDetails( // Message of a Popup::ErrorDetails:
+ _("New Printer Configuration not yet Stored in the System"),
+ // Explanation details of a Popup::ErrorDetails.
+ _("This may result broken printer configurations.")
+ );
+ }
// Autodetect queues again so that Printer::NewQueueName
// can compare with existing queue names but ignore whatever failures
// (an empty list of autodetected queues is the fallback result):
@@ -261,7 +289,18 @@
// has almost no additional space between table columns:
string name = String::CutBlanks(queue[2]:"");
string description = String::CutBlanks(queue[3]:"");
- proposal = add( proposal, name + ": " + description );
+ string configuration = name;
+ if( description != "" )
+ { configuration = configuration + " : " + description;
+ }
+ if( contains( initially_existing_queues, name ) )
+ { // The automated printer setup found an already existing configuration:
+ proposal = add( proposal, _("Found existing configuration") + " : " + configuration );
+ }
+ else
+ { // The automated printer setup created a new configuration:
+ proposal = add( proposal, _("Created configuration") + " : " + configuration );
+ }
}
);
}
@@ -278,7 +317,7 @@
"warning" : warning,
];
}
-/* run the full printer module dialogs */
+// Run the full printer module dialogs:
else if(func == "AskUser")
{ // Call Printer::Read() here (compare "MakeProposal" above)
// to make sure that when the full printer module dialogs are launched
@@ -296,7 +335,7 @@
y2debug("seq=%1",seq);
ret = $[ "workflow_sequence" : seq ];
}
-/* create titles */
+// Create titles:
else if(func == "Description")
{ ret = $[ /* Rich text title for Printer in proposals */
"rich_text_title" : _("Printer"),
@@ -305,7 +344,7 @@
"id" : "printer",
];
}
-/* write the proposal */
+// Dummy function to write the proposal (it is already written in the "MakeProposal" function):
else if(func == "Write")
{ // There is no need to call Printer::Write() here because
// it does actually nothing except to exit verbosely, see
@@ -313,12 +352,11 @@
// for background information.
y2milestone("No need to call Printer::Write() because it does nothing.");
}
-/* unknown function */
+// Unknown function:
else
-{ y2error("unknown function: %1", func);
+{ y2error("Unknown function: %1", func);
}
-/* Finish */
y2debug("ret=%1",ret);
y2milestone("Printer proposal finished");
y2milestone("----------------------------------------");
Modified: trunk/printer/src/sharing.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/sharing.ycp?rev=63347&r1=63346&r2=63347&view=diff
==============================================================================
--- trunk/printer/src/sharing.ycp (original)
+++ trunk/printer/src/sharing.ycp Fri Feb 4 14:57:22 2011
@@ -72,6 +72,16 @@
_("&Allow remote access"),
initial_allow_remote_access
)
+ ),
+ `Left
+ ( `HBox
+ ( `HSpacing( 2 ),
+ `Label
+ ( `id(`allow_remote_access_label),
+ // A label which explains how the subsequent choices can be used:
+ _("There are various ways how to specify which remote hosts are allowed:")
+ )
+ )
)
)
),
@@ -95,7 +105,7 @@
( `id(`publish_to_local_network_check_box),
`opt(`notify),
// A CheckBox label to publish local print queues by default within the local network:
- _("&Publish printers by default within the local network"),
+ _("&Publish printers within the local network"),
initial_publish_to_local_network
)
)
@@ -105,7 +115,7 @@
( `id(`interface_table_label),
// A caption for a table to allow remote access to local print queues
// via network interfaces specified in the table below:
- _("Via network interfaces specified below")
+ _("Via network interfaces")
)
),
`HBox
@@ -122,7 +132,7 @@
// A table column header where the column shows whether or not
// local print queues are published by default
// via the network interface in the other table column:
- _("Publish printers by default via this interface")
+ _("Publish printers via this interface")
),
initial_interface_table_items
)
@@ -154,7 +164,7 @@
( `id(`specific_addresses_label),
// A caption to allow remote access to local print queues
// for hosts and/or networks specified in two TextEntries below:
- _("For Experts: Optional Specific IP Addresses or Networks")
+ _("For Specific IP Addresses or Networks")
)
),
`HBox
@@ -165,7 +175,7 @@
( `id(`allow_input),
// TextEntry to allow remote access to local print queues
// for hosts and/or networks:
- _("Allow remote access from those IP addresses or &network/netmask (separated by space)")
+ _("Allow access from those IP addresses or &network/netmask (separated by space)")
)
),
`Left
@@ -572,6 +582,7 @@
// with a local running cupsd (e.g. before he set up the first local queue:
// Also the basic buttons "Help", "Cancel", "OK" are enabled.
UI::ChangeWidget( `allow_remote_access_radio_button, `Enabled, false );
+ UI::ChangeWidget( `allow_remote_access_label, `Enabled, false );
UI::ChangeWidget( `allow_local_network_access_check_box, `Enabled, false );
UI::ChangeWidget( `publish_to_local_network_check_box, `Enabled, false );
UI::ChangeWidget( `interface_table_label, `Enabled, false );
@@ -984,6 +995,7 @@
// does not trigger any event even not with "`opt(`notify, `immediate)"
// so that this special action is unnoticed.
boolean remote_access = (boolean)UI::QueryWidget( `allow_remote_access_radio_button, `Value );
+ UI::ChangeWidget( `allow_remote_access_label, `Enabled, remote_access );
UI::ChangeWidget( `allow_local_network_access_check_box, `Enabled, remote_access );
UI::ChangeWidget( `publish_to_local_network_check_box, `Enabled, remote_access );
UI::ChangeWidget( `interface_table_label, `Enabled, remote_access );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org