Author: jsmeix Date: Fri Sep 26 12:58:38 2008 New Revision: 51576 URL: http://svn.opensuse.org/viewcvs/yast?rev=51576&view=rev Log: - In the "Share Printers" dialog it is now no longer possible to "Add" the same network interface several times (even with different settings for "publishing"). - Using Popup::ErrorDetails wherever possible to provide the actual system stderr message via [Details] (see Novell/Suse Bugzilla bnc#429397). - 2.17.17 Modified: trunk/printer/VERSION trunk/printer/package/yast2-printer.changes trunk/printer/src/Printer.ycp trunk/printer/src/Printerlib.ycp trunk/printer/src/basicadd.ycp trunk/printer/src/basicmodify.ycp trunk/printer/src/overview.ycp trunk/printer/src/sharing.ycp Modified: trunk/printer/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/VERSION (original) +++ trunk/printer/VERSION Fri Sep 26 12:58:38 2008 @@ -1 +1 @@ -2.17.16 +2.17.17 Modified: trunk/printer/package/yast2-printer.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/package/yast2-printer.changes (original) +++ trunk/printer/package/yast2-printer.changes Fri Sep 26 12:58:38 2008 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Fri Sep 26 12:34:22 CEST 2008 - jsmeix@suse.de + +- In the "Share Printers" dialog it is now no longer possible + to "Add" the same network interface several times + (even with different settings for "publishing"). +- Using Popup::ErrorDetails wherever possible to provide + the actual system stderr message via [Details] + (see Novell/Suse Bugzilla bnc#429397). + +------------------------------------------------------------------- Thu Sep 25 17:48:21 CEST 2008 - jsmeix@suse.de - First usable version of the "Share Printers" dialog. Modified: trunk/printer/src/Printer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/src/Printer.ycp (original) +++ trunk/printer/src/Printer.ycp Fri Sep 26 12:58:38 2008 @@ -36,7 +36,6 @@ textdomain "printer"; import "Progress"; -import "Report"; import "Summary"; import "Message"; import "Popup"; @@ -290,11 +289,12 @@ else { Popup::ClearFeedback(); } - 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 create PPD database.") - ); + Popup::ErrorDetails( // Popup::ErrorDetails message. + // 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 create PPD database."), + Printerlib::result["stderr"]:"" + ); return false; } if( -1 == SCR::Read( .target.size, database_filename ) ) @@ -305,12 +305,12 @@ { Popup::ClearFeedback(); } y2milestone( "Error: %1: file does not exist.", database_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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). - _("File %1 does not exist."), - database_filename - ) + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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). + _("File %1 does not exist."), + database_filename + ) ); return false; } @@ -323,12 +323,12 @@ { Popup::ClearFeedback(); } y2milestone( "Error: Failed to read %1", database_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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 read %1."), - database_filename - ) + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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 read %1."), + database_filename + ) ); ppds = []; return false; @@ -410,13 +410,14 @@ else { Popup::ClearFeedback(); } - 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). - // Do not confuse this error with the case when no printer was autodetected. - // The latter results no error. - _("Failed to detect printers automatically.") - ); + Popup::ErrorDetails( // Popup::ErrorDetails message. + // 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). + // Do not confuse this error with the case when no printer was autodetected. + // The latter results no error. + _("Failed to detect printers automatically."), + Printerlib::result["stderr"]:"" + ); return false; } if( -1 == SCR::Read( .target.size, autodetected_printers_filename ) ) @@ -427,12 +428,12 @@ { Popup::ClearFeedback(); } y2milestone( "Error: %1: file does not exist.", autodetected_printers_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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). - _("File %1 does not exist."), - autodetected_printers_filename - ) + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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). + _("File %1 does not exist."), + autodetected_printers_filename + ) ); return false; } @@ -445,13 +446,13 @@ { Popup::ClearFeedback(); } y2milestone( "Error: Failed to read %1", autodetected_printers_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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 read %1."), - autodetected_printers_filename - ) - ); + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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 read %1."), + autodetected_printers_filename + ) + ); connections = []; return false; } @@ -494,36 +495,37 @@ { // To be safe invalidate selected_queues_index in any case: selected_queues_index = -1; if( ! Printerlib::ExecuteBashCommand( autodetect_queues_commandline ) ) - { 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). - // Do not confuse this error with the case when no queue was detected - // (e.g. simply because there is no queue). This results no error. - _("Failed to detect print queues.") - ); + { Popup::ErrorDetails( // Popup::ErrorDetails message. + // 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). + // Do not confuse this error with the case when no queue was detected + // (e.g. simply because there is no queue). This results no error. + _("Failed to detect print queues."), + Printerlib::result["stderr"]:"" + ); return false; } if( -1 == SCR::Read( .target.size, autodetected_queues_filename ) ) { y2milestone( "Error: %1: file does not exist.", autodetected_queues_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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). - _("File %1 does not exist."), - autodetected_queues_filename - ) - ); + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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). + _("File %1 does not exist."), + autodetected_queues_filename + ) + ); return false; } queues = (list< map< string, string > >)SCR::Read( .target.ycp, autodetected_queues_filename ); if( nil == queues ) { y2milestone( "Error: Failed to read %1", autodetected_queues_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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 read %1."), - autodetected_queues_filename - ) - ); + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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 read %1."), + autodetected_queues_filename + ) + ); queues = []; return false; } @@ -551,38 +553,39 @@ } string commandline = determine_printer_driver_options_commandline + queue_name; if( ! Printerlib::ExecuteBashCommand( commandline ) ) - { Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the queue name. - // 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). - // Do not confuse this error with the case when no queue was detected - // (e.g. simply because there is no queue). This results no error. - _("Failed to determine driver options for queue %1."), - queue_name - ) - ); + { Popup::ErrorDetails( sformat( // Popup::ErrorDetails message where %1 will be replaced by the queue name. + // 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). + // Do not confuse this error with the case when no queue was detected + // (e.g. simply because there is no queue). This results no error. + _("Failed to determine driver options for queue %1."), + queue_name + ), + Printerlib::result["stderr"]:"" + ); return false; } if( -1 == SCR::Read( .target.size, driver_options_filename ) ) { y2milestone( "Error: %1: file does not exist.", driver_options_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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). - _("File %1 does not exist."), - driver_options_filename - ) - ); + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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). + _("File %1 does not exist."), + driver_options_filename + ) + ); return false; } driver_options = (list< map< string, any > >)SCR::Read( .target.ycp, driver_options_filename ); if( nil == driver_options ) { y2milestone( "Error: Failed to read %1", driver_options_filename ); - Report::Error( sformat( // Message of a Report::Error where %1 will be replaced by the file name. - // 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 read %1."), - driver_options_filename - ) - ); + Popup::Error( sformat( // Message of a Popup::Error where %1 will be replaced by the file name. + // 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 read %1."), + driver_options_filename + ) + ); driver_options = []; return false; } @@ -745,13 +748,13 @@ { // Invalidate selected_queues_index to be safe: selected_queues_index = -1; if( ! AutodetectQueues() ) - { 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). - // Do not confuse this error with the case when no queue was detected - // (e.g. simply because there is no queue). This results no error. - _("Cannot show print queues (failed to detect print queues).") - ); + { Popup::Error( // Message of a Popup::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). + // Do not confuse this error with the case when no queue was detected + // (e.g. simply because there is no queue). This results no error. + _("Cannot show print queues (failed to detect print queues).") + ); // Return an empty list: return []; } @@ -856,11 +859,11 @@ ); // AutodetectPrinters overwrites the existing connections list: if( ! AutodetectPrinters() ) - { Report::Error( // Message of a Report::Error. - // Only a simple message because before the function AutodetectPrinters - // was called and this function would have shown more specific messages. - _("Failed to autodetect printers.") - ); + { Popup::Error( // Message of a Popup::Error. + // Only a simple message because before the function AutodetectPrinters + // was called and this function would have shown more specific messages. + _("Failed to autodetect printers.") + ); // Return only the existing connection wizard connections which is usally an empty list: return connection_wizard_connections; } @@ -1091,11 +1094,11 @@ { // Create the driver database only if the ppds list is empty: if( size( ppds ) < 1 ) { if( ! CreateDatabase() ) - { Report::Error( // Message of a Report::Error. - // Only a simple message because before the function CreateDatabase - // was called and this function would have shown more specific messages. - _("Failed to create the printer driver database.") - ); + { Popup::Error( // Message of a Popup::Error. + // Only a simple message because before the function CreateDatabase + // was called and this function would have shown more specific messages. + _("Failed to create the printer driver database.") + ); // Return an empty list: return []; } @@ -1571,11 +1574,11 @@ { // Run DetermineDriverOptions if the driver_options list is empty: if( size( driver_options ) < 1 ) { if( ! DetermineDriverOptions( "" ) ) - { Report::Error( // Message of a Report::Error. - // Only a simple message because this is only a fallback case - // which should not happen at all: - _("Failed to determine the driver options.") - ); + { Popup::Error( // Message of a Popup::Error. + // Only a simple message because this is only a fallback case + // which should not happen at all: + _("Failed to determine the driver options.") + ); // Return at least a list with only a fallback string so that the user is informed: return [ _("No driver options available") ]; } Modified: trunk/printer/src/Printerlib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printerlib.ycp?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/src/Printerlib.ycp (original) +++ trunk/printer/src/Printerlib.ycp Fri Sep 26 12:58:38 2008 @@ -108,19 +108,30 @@ ); return false; } - // Wait one minute for a new started cupsd is necessary because + // Sleep one second in any case so that the new started cupsd can become ready to operate: + sleep( 1000 ); + // Wait half a minute for a new started cupsd is necessary because // when a client-only config is switched to a "get Browsing info" config // the BrowseInterval in cupsd.conf on remote CUPS servers is by default 30 seconds // so that the local cupsd should listen at least 31 seconds to get Browsing info // before e.g. the Overview dialog can be shown with the right current queues. - // Additionally during first start after system installation the cupsd parses - // all the (usually thousands) of installed PPDs to generate - // the list of available drivers (what "lpinfo -l -m" shows). - Popup::TimedMessage( _("Started the CUPS daemon.\nWaiting one minute so that it is ready to operate..."), - 60 + Popup::TimedMessage( _("Started the CUPS daemon.\nWaiting half a minute so that it is ready to operate..."), + 30 ); local_cupsd_accessible = ExecuteBashCommand( local_cupsd_accessible_commandline ); if( ! local_cupsd_accessible ) + { // It can take up to a few minutes when a cupsd is started + // for the very first time (e.g. on a new installed system) + // until the cupsd is actually ready to operate. + // E.g. because parsing of thousands of PPDs may need much time. + // Therefore enforce waiting one minute now. + // (Plain busy message without title.) + Popup::ShowFeedback( "", _("The CUPS daemon in not yet accessible.\nWaiting one minute so that it is ready to operate...") ); + sleep( 60000 ); + Popup::ClearFeedback(); + } + local_cupsd_accessible = ExecuteBashCommand( local_cupsd_accessible_commandline ); + if( ! local_cupsd_accessible ) { Popup::Error( // Popup::Error message: _("No local running CUPS daemon is accessible.") ); @@ -155,13 +166,17 @@ ); return false; } - // Wait 40 seconds for a restarted cupsd is necessary because + // Sleep two seconds in any case so that the re-started cupsd can become ready to operate. + // It may need one second for some cleanup before finishing + // and one second to become ready to operate after starting. + sleep( 2000 ); + // Wait half a minute for a restarted cupsd is necessary because // when a "no Browsing info" config is switched to a "get Browsing info" config // the BrowseInterval in cupsd.conf on remote CUPS servers is by default 30 seconds // so that the local cupsd should listen at least 31 seconds to get Browsing info // before e.g. the Overview dialog can be shown with the right current queues. - Popup::TimedMessage( _("Restarted the CUPS daemon.\nWaiting 40 seconds so that it is ready to operate..."), - 40 + Popup::TimedMessage( _("Restarted the CUPS daemon.\nWaiting half a minute so that it is ready to operate..."), + 30 ); local_cupsd_accessible = ExecuteBashCommand( local_cupsd_accessible_commandline ); if( ! local_cupsd_accessible ) Modified: trunk/printer/src/basicadd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicadd.ycp?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/src/basicadd.ycp (original) +++ trunk/printer/src/basicadd.ycp Fri Sep 26 12:58:38 2008 @@ -340,6 +340,13 @@ driver_filter_string = "^" + driver_filter_string; } } + if( "" == driver_filter_string ) + { // Set a fallback driver_filter_string to avoid that the full list + // of thousands of PPDs is shown automatically because + // it can take a very long time until the user can proceed: + driver_filter_input_text = "Generic"; + driver_filter_string = "^generic"; + } UI::ReplaceWidget( `id(`driver_filter_input_replace_point), `TextEntry( `id(`driver_filter_input), // Caption for a printer driver selection: Modified: trunk/printer/src/basicmodify.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicmodify.ycp?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/src/basicmodify.ycp (original) +++ trunk/printer/src/basicmodify.ycp Fri Sep 26 12:58:38 2008 @@ -663,6 +663,13 @@ driver_filter_string = filterchars( tolower( model ), Printer::lower_alnum_chars ); } } + if( "" == driver_filter_string ) + { // Set a fallback driver_filter_string to avoid that the full list + // of thousands of PPDs is shown automatically because + // it can take a very long time until the user can proceed: + driver_filter_input_text = "Generic"; + driver_filter_string = "^generic"; + } UI::ReplaceWidget( `id(`driver_filter_input_replace_point), `TextEntry( `id(`driver_filter_input), // Caption for a printer driver selection: Modified: trunk/printer/src/overview.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/overview.ycp?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/src/overview.ycp (original) +++ trunk/printer/src/overview.ycp Fri Sep 26 12:58:38 2008 @@ -33,7 +33,6 @@ import "Label"; import "Popup"; -import "Report"; import "Wizard"; import "Wizard_hw"; import "Confirm"; @@ -348,10 +347,11 @@ } // 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 remove the 'ServerName' entry in /etc/cups/client.conf") + { Popup::ErrorDetails( // Popup::ErrorDetails message. + // 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 remove the 'ServerName' entry in /etc/cups/client.conf"), + Printerlib::result["stderr"]:"" ); return nil; } Modified: trunk/printer/src/sharing.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/sharing.ycp?rev=51576&r1=51575&r2=51576&view=diff ============================================================================== --- trunk/printer/src/sharing.ycp (original) +++ trunk/printer/src/sharing.ycp Fri Sep 26 12:58:38 2008 @@ -301,22 +301,48 @@ 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 ); - // Keep deny_remote_access. - // Ignore if other settings may have been changed - // because whatever Allow and BrowseAddress stuff is meaningless - // if remote access is denied at all: - if( deny_remote_access && initial_deny_remote_access ) - { // Nothing has changed: - return true; + string allow_values = ""; + string browse_address_values = ""; + foreach( term interface_table_item, + interface_table_items, + { string interface_name = interface_table_item[1]:""; + string is_published = interface_table_item[2]:""; + if( "" != interface_name ) + { allow_values = "@IF(" + interface_name + ") " + allow_values; + // Add the inferface nameto browse_address_values + // only if remote access is allowed for this interface: + if( "yes" == is_published ) + { browse_address_values = "@IF(" + interface_name + ") " + browse_address_values ; + } + } + } + ); + if( allow_local_network_access ) + { allow_values = "@LOCAL " + allow_values; + // Add "@LOCAL" to browse_address_values + // only if remote access is allowed for "@LOCAL": + if( publish_to_local_network ) + { browse_address_values = "@LOCAL " + browse_address_values; + } } - // Switch to deny_remote_access: + y2milestone( "allow_values: %1", allow_values ); + y2milestone( "browse_address_values: %1", browse_address_values ); + // Any kind of deny_remote_access: // Ignore if other settings may have been changed too // because whatever Allow and BrowseAddress stuff is meaningless // if remote access is denied at all: - // When both the deny_remote_access_radio_button and the allow_remote_access_radio_button are un-checked, - // assume the user wants deny_remote_access (via '! allow_remote_access') because this is the safe setting: - if( deny_remote_access || ! allow_remote_access ) - { sharing_has_changed = true; + // When both the deny_remote_access_radio_button and the allow_remote_access_radio_button + // are un-checked, assume the user wants deny_remote_access (via '! allow_remote_access') + // because this is the safe setting (even when allow_values is not empty): + if( deny_remote_access + || ! allow_remote_access + || "" == allow_values + ) + { if( initial_deny_remote_access ) + { // Nothing has changed: + return true; + } + sharing_has_changed = true; // It leads to inconsistencies if only Only set 'Listen localhost' would be set // but Allow and BrowseAddress enties would be kept because when there are // BrowseAddress enties, it must listen on matching remote interfaces @@ -337,6 +363,11 @@ ); return false; } + // Do not change the global "Browsing On/Off" entry in cupsd.conf + // because "Browsing Off" disables also receiving + // of remote queue information from remote CUPS servers + // which might be needed by the "Print Via Network" dialog. + // Instead remove only the "BrowseAddress" entries in cupsd.conf: if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf BrowseAddress none" ) ) { Popup::ErrorDetails( // Popup::ErrorDetails message. // Do not change or translate "BrowseAddress", it is a system settings name. @@ -391,30 +422,8 @@ { // Nothing has changed: return true; } - string allow_values = ""; - string browse_address_values = ""; - foreach( term interface_table_item, - interface_table_items, - { string interface_name = interface_table_item[1]:""; - string is_published = interface_table_item[2]:""; - if( "" != interface_name ) - { allow_values = "@IF(" + interface_name + ") " + allow_values; - // Add the inferface nameto browse_address_values - // only if remote access is allowed for this interface: - if( "yes" == is_published ) - { browse_address_values = "@IF(" + interface_name + ") " + browse_address_values ; - } - } - } - ); - if( allow_local_network_access ) - { allow_values = "@LOCAL " + allow_values; - // Add "@LOCAL" to browse_address_values - // only if remote access is allowed for "@LOCAL": - if( publish_to_local_network ) - { browse_address_values = "@LOCAL " + browse_address_values; - } - } + // When allow_values is empty, it is a deny_remote_access case, see above. + // Therefore allow_values is non-empty here: if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf Allow '" + allow_values @@ -426,27 +435,39 @@ // 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; } - if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir - + "modify_cupsd_conf BrowseAddress '" - + browse_address_values - + "'" - ) - ) - { Popup::ErrorDetails( sformat( // Popup::ErrorDetails message - // where %1 will be replaced by one or more system settings values. - // // Do not change or translate "BrowseAddress", it is a system settings name. - _("Failed to set 'BrowseAddress' entries '%1' in /etc/cups/cupsd.conf"), - browse_address_values - ), - Printerlib::result["stderr"]:"" - ); - return false; + if( "" != browse_address_values ) + { if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + + "modify_cupsd_conf BrowseAddress '" + + browse_address_values + + "'" + ) + ) + { Popup::ErrorDetails( sformat( // Popup::ErrorDetails message + // where %1 will be replaced by one or more system settings values. + // Do not change or translate "BrowseAddress", it is a system settings name. + _("Failed to set 'BrowseAddress' entries '%1' in /etc/cups/cupsd.conf"), + browse_address_values + ), + Printerlib::result["stderr"]:"" + ); + return false; + } + // Having "BrowseAddress" entries requires "Browsing On", + // otherwise browsing information would not be sent at all: + if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf Browsing On" ) ) + { Popup::ErrorDetails( // Popup::ErrorDetails message: + _("Failed to set 'Browsing On' in /etc/cups/cupsd.conf"), + Printerlib::result["stderr"]:"" + ); + return false; + } } + // Only if all the above was successfully set, Listen is set too: // Currently 'Listen *:631' is simply set for any kind of remote access // because the Listen directive supports only network addresses as value. // Neither 'Listen @LOCAL' nor 'Listen @IF(name)' is supported. @@ -732,17 +753,45 @@ map ret = nil; map< string, string > interface_map = nil; case `add_interface : + current_item = (integer)UI::QueryWidget( `interface_table, `CurrentItem ); interface_map = showInterfacePopup( "", false ); - if( interface_map != nil ) - { interface_table_items = (list<term>)UI::QueryWidget( `interface_table, `Items ); - interface_table_items = add( interface_table_items, - `item( `id(size(interface_table_items)), - interface_map["interface_name"]:"", - interface_map["is_published"]:"" - ) - ); + boolean is_in_table = false; + if( interface_map != nil) + { interface_table_items = []; + foreach( term interface_table_item, + (list<term>)UI::QueryWidget( `interface_table, `Items), + { if( interface_map["interface_name"]:"new" != interface_table_item[1]:"old" ) + { interface_table_items = add( interface_table_items, + `item( `id(size(interface_table_items)), + interface_table_item[1]:"", + interface_table_item[2]:"" + ) + ); + } + else + { is_in_table = true; + y2milestone( "Changing interface_table_item %1 with interface_map %2", interface_table_item, interface_map ); + interface_table_items = add( interface_table_items, + `item( `id(size(interface_table_items)), + interface_map["interface_name"]:"", + interface_map["is_published"]:"" + ) + ); + } + } + ); + if( ! is_in_table ) + { y2milestone( "Adding interface_map %1", interface_map ); + interface_table_items = add( interface_table_items, + `item( `id(size(interface_table_items)), + interface_map["interface_name"]:"", + interface_map["is_published"]:"" + ) + ); + current_item = size(interface_table_items) - 1; + } UI::ChangeWidget( `interface_table, `Items, interface_table_items ); - UI::ChangeWidget( `interface_table, `CurrentItem, size(interface_table_items) - 1 ); + UI::ChangeWidget( `interface_table, `CurrentItem, current_item ); } break; case `edit_interface : @@ -764,7 +813,7 @@ ); } else - { y2milestone( "Changing interface_table_item %1", interface_table_item ); + { y2milestone( "Changing interface_table_item %1 with interface_map %2", interface_table_item, interface_map ); interface_table_items = add( interface_table_items, `item( `id(size(interface_table_items)), interface_map["interface_name"]:"", -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org