Author: jsmeix Date: Wed Sep 24 17:11:14 2008 New Revision: 51477 URL: http://svn.opensuse.org/viewcvs/yast?rev=51477&view=rev Log: Increase MAXIMUM_WAIT to 60 seconds in tools/create_printer_ppd_database (see Novell/Suse Bugzilla bnc#429397). Various cleanup and various bug fixes regarding client-only and "Share Printers". Modified: trunk/printer/src/Printer.ycp trunk/printer/src/Printerlib.ycp trunk/printer/src/overview.ycp trunk/printer/src/printingvianetwork.ycp trunk/printer/src/sharing.ycp trunk/printer/tools/create_printer_ppd_database Modified: trunk/printer/src/Printer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=51477&r1=51476&r2=51477&view=diff ============================================================================== --- trunk/printer/src/Printer.ycp (original) +++ trunk/printer/src/Printer.ycp Wed Sep 24 17:11:14 2008 @@ -747,7 +747,7 @@ // (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.") + _("Cannot show print queues (failed to detect print queues).") ); // Return an empty list: return []; Modified: trunk/printer/src/Printerlib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printerlib.ycp?rev=51477&r1=51476&r2=51477&view=diff ============================================================================== --- trunk/printer/src/Printerlib.ycp (original) +++ trunk/printer/src/Printerlib.ycp Wed Sep 24 17:11:14 2008 @@ -235,7 +235,8 @@ { client_conf_server_name = result["stdout"]:""; if( "" != client_conf_server_name && "localhost" != client_conf_server_name - && "127.0.0.1" != 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) @@ -244,17 +245,42 @@ // 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; + return true; } - else - { client_only = false; - } - } - else - { // Use fallback values when the command above failed: - client_conf_server_name = ""; client_only = false; + return true; + } + // The cups_client_only tool failed: + client_conf_server_name = result["stdout"]:""; + if( "" != client_conf_server_name + && "localhost" != client_conf_server_name + && "127.0.0.1" != client_conf_server_name + ) + { // When there is a non-empty client_conf_server_name, + // cups_client_only fails when the client-only server is not accessible: + Popup::ErrorDetails( // Popup::ErrorDetails message + // where %1 will be replaced by the server name. + sformat( _("The CUPS server '%1' is not accessible"), client_conf_server_name ), + result["stderr"]:"" + ); + client_only = true; return false; } + if( "localhost" == client_conf_server_name + || "127.0.0.1" == client_conf_server_name + ) + { client_only = false; + if( ! GetAndSetCupsdStatus( "" ) ) + { if( ! GetAndSetCupsdStatus( "start" ) ) + { return false; + } + } + return true; + } + // The cups_client_only tool failed for whatever reason. + // Use fallback values: + client_conf_server_name = ""; + client_only = false; return true; } Modified: trunk/printer/src/overview.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/overview.ycp?rev=51477&r1=51476&r2=51477&view=diff ============================================================================== --- trunk/printer/src/overview.ycp (original) +++ trunk/printer/src/overview.ycp Wed Sep 24 17:11:14 2008 @@ -46,9 +46,10 @@ term widgetOverview = `VBox ( `Left ( `HBox - ( `Label( // Label for CheckBoxes to select local and/or remote print queues to be listed: - _("Show") - ), + ( `Label + ( // Label for CheckBoxes to select local and/or remote print queues to be listed: + _("Show") + ), `HSpacing( 2 ), `CheckBox ( `id(`local_content_checkbox), @@ -62,6 +63,16 @@ `opt(`notify), // CheckBox to select remote print queues to be listed: _("&Remote") + ), + `HSpacing( 1 ), + `Label + ( `id(`client_only_server_name), + // This spaces string is a workaround for a bug in the UI + // to preallocate space on the screen when the spaces string + // is replaced by a real string if it is a client-only config. + // Otherwise the real string is cut to less than one character + // (at least with openSUSE 11.0 and Qt): + " " ) ) ), @@ -118,7 +129,7 @@ { boolean local_content_selected = Printer::queue_filter_show_local; boolean remote_content_selected = Printer::queue_filter_show_remote; boolean local_cupsd_required = true; - // Determine whether or not it is currently a real 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): Printerlib::DetermineClientOnly(); @@ -126,6 +137,16 @@ { local_cupsd_required = false; local_content_selected = false; remote_content_selected = true; + UI::ChangeWidget( `client_only_server_name, + `Value, + sformat( // Show the CUPS server name if it is a client-only config + // where %1 will be replaced by the CUPS server name. + _("CUPS Server %1"), + Printerlib::client_conf_server_name + ) + ); + // In case of a client-only config it does not work to show local queues: + UI::ChangeWidget( `local_content_checkbox, `Enabled, false ); } // Determine whether or not a local cupsd is accessible: if( local_cupsd_required && ! Printerlib::GetAndSetCupsdStatus( "" ) ) @@ -190,7 +211,7 @@ UI::ChangeWidget( `test, `Enabled, false ); } else - { if( "yes" == Printer::queues[selected_queue_index,"rejecting"]:"" + { if( "yes" == Printer::queues[selected_queue_index,"rejecting"]:"" || "yes" == Printer::queues[selected_queue_index,"disabled"]:"" ) { UI::ChangeWidget( `test, `Enabled, false ); @@ -209,8 +230,8 @@ // Disable the modify and delete buttons when a remote queue is selected and by fallback: } } - UI::ChangeWidget(`edit, `Enabled, Printer::selected_queues_index >= 0 ); - UI::ChangeWidget(`delete, `Enabled, Printer::selected_queues_index >= 0 ); + UI::ChangeWidget( `edit, `Enabled, Printer::selected_queues_index >= 0 ); + UI::ChangeWidget( `delete, `Enabled, Printer::selected_queues_index >= 0 ); if( `delete == event["ID"]:nil && "Activated" == event["EventReason"]:"" ) { string queue_name = Printer::queues[selected_queue_index,"name"]:""; Modified: trunk/printer/src/printingvianetwork.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printingvianetwork.ycp?rev=51477&r1=51476&r2=51477&view=diff ============================================================================== --- trunk/printer/src/printingvianetwork.ycp (original) +++ trunk/printer/src/printingvianetwork.ycp Wed Sep 24 17:11:14 2008 @@ -194,6 +194,20 @@ ); return false; } + // Test for "localhost" or "127.0.0.1" and make a local cupsd accessible + // because a local cupsd is needed if the server name is "localhost" or "127.0.0.1": + if( "localhost" == server_name + || "127.0" == substring( server_name, 0, 5 ) + ) + { // The user has entered "localhost" or "127.0.0.1" as server name + // which makes it effectively a config with a local running cupsd. + // If a local cupsd is already accessible, do nothing, otherwise start it: + if( ! Printerlib::GetAndSetCupsdStatus( "" ) ) + { if( ! Printerlib::GetAndSetCupsdStatus( "start" ) ) + { return false; + } + } + } if( Printerlib::ExecuteBashCommand( "netcat -v -w 1 -z " + server_name + " 631" ) ) { // Show positive feedback. // Show it as TimedMessage so that is disappears automatically @@ -524,6 +538,7 @@ // Client-only: if( `client_only_radio_button == current_radio_button ) { string server_name = deletechars( tolower( current_server_name_input_value ), " " ); + boolean enforce_client_only_server_setting = false; if( "" == server_name || "none" == server_name ) @@ -542,12 +557,34 @@ } return true; } - // A non-accessible client-only server leads to an endless sequence - // of weird further behaviour of the module so that such a server name - // is simply not accepted. Do not show additional error messages here - // because TestClientOnlyServer() shows sufficient popups to the user: + // A non-accessible client-only server leads to an endless sequence of weird further behaviour + // of the module so that a non-accessible server is not accepted. + // This means that it is not possible to set up a client-only config first + // and then make the client-only server accessible (e.g. boot the client-only server, + // open ports in firewall, set up the network connection, whatever else). + // This would be a problem when a workstation is set up by an admin in the IP department + // for a client-only config but the workstation is currently not connected to the network + // where the client-only server is (e.g. in the department for which the workstation is set up). + // Therefore the admin can force YaST to proceed here. + // Do not show additional error messages here because TestClientOnlyServer() + // shows sufficient popups to the user: if( ! TestClientOnlyServer( server_name ) ) - { return false; + { if( ! Popup::ContinueCancelHeadline( sformat( // Header of a Popup::ContinueCancelHeadline + // when a client-only server is not accessible + // where %1 will be replaced by the server name: + _("Continue regardless that '%1' is not accessible?"), + server_name + ), + // Body of a Popup::ContinueCancelHeadline + // when a client-only server is not accessible: + _("A non-accessible server leads to an endless sequence of further failures.") + ) + ) + { // The user has decided not to continue: + return false; + } + // The user has decided to continue regardless that the client-only server is not accessible: + enforce_client_only_server_setting = true; } if( `browsing_off_radio_button == initial_radio_button || `browsing_on_radio_button == initial_radio_button @@ -584,23 +621,21 @@ { // Nothing has changed: return true; } - // Test for "localhost/"127.0.0.1" first and make a local cupsd accessible - // because the "cups_client_only" tool which sets the ServerName in client.conf - // tests in any case if the cupsd on ServerName is accessible: - if( "localhost" == server_name - || "127.0" == substring( server_name, 0, 5 ) - ) - { // The user has entered "localhost" or "127.0.0.1" as server name - // which makes it effectively a config with a local running cupsd. - // If a local cupsd is already accessible, do nothing, otherwise start it: - if( ! Printerlib::GetAndSetCupsdStatus( "" ) ) - { if( ! Printerlib::GetAndSetCupsdStatus( "start" ) ) - { return false; - } - } - } if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "cups_client_only " + server_name ) ) - { Popup::ErrorDetails( // Popup::ErrorDetails message + { if( enforce_client_only_server_setting ) + { // The user has decided to continue regardless that the client-only server is not accessible. + // In this case the cups_client_only tool fails in any case because it also tests accessibility. + // But cups_client_only might have failed for whatever other reason. + // Therefore a Popup::MessageDetails is shown to inform about the actual result: + Popup::MessageDetails( // Popup::MessageDetails message + // where %1 will be replaced by the server name. + sformat( _("Tried to set 'ServerName %1' in /etc/cups/client.conf"), server_name ), + Printerlib::result["stderr"]:"" + ); + // Exit successfully in this special case regardless of whatever failures: + return true; + } + Popup::ErrorDetails( // Popup::ErrorDetails message // where %1 will be replaced by the server name. sformat( _("Failed to set 'ServerName %1' in /etc/cups/client.conf"), server_name ), Printerlib::result["stderr"]:"" @@ -649,16 +684,16 @@ // and it should also not contain "none" because this setting // is implicitely done via browsing_off_radio_button: string browse_allow_input_value = mergestring( filter( string value, - Printerlib::cupsd_conf_browse_allow, - { value = tolower( value ); - return( "all" != value - && "@local" != value - && "none" != value - ); - } - ), - " " - ); + Printerlib::cupsd_conf_browse_allow, + { value = tolower( value ); + return( "all" != value + && "@local" != value + && "none" != value + ); + } + ), + " " + ); initial_browse_allow_input_value = browse_allow_input_value; UI::ChangeWidget( `id(`browse_allow_input), `Value, browse_allow_input_value ); UI::ChangeWidget( `id(`browse_allow_input_label), `Enabled, false ); Modified: trunk/printer/src/sharing.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/sharing.ycp?rev=51477&r1=51476&r2=51477&view=diff ============================================================================== --- trunk/printer/src/sharing.ycp (original) +++ trunk/printer/src/sharing.ycp Wed Sep 24 17:11:14 2008 @@ -36,13 +36,13 @@ import "Printer"; import "Printerlib"; import "Popup"; -import "NetworkInterfaces"; include "printer/helps.ycp"; boolean share_printers_dialog_is_useless = false; list< term > interface_table_items = []; list< term > ip_table_items = []; +list< string > available_interfaces = []; boolean sharing_has_changed = false; term widgetSharing = `VBox @@ -194,36 +194,50 @@ `VSpacing( 1 ) ); -map showInterfacePopup(string device, boolean publish){ - map result = $[]; - list<string> devices = NetworkInterfaces::List(""); - UI::OpenDialog( `VBox( - `CheckBox(`id(`publish), _("&Publish printers by default via "), publish), - // translators: combo box label for list of configured IPs - `ComboBox( `id(`device), `opt( `editable ), _("Network &Devices:"), devices ), - `VSpacing(), - `HBox( - `PushButton( `id(`ok), Label::OKButton() ), - `PushButton( `id(`cancel), Label::CancelButton() ) - ) - )); - if(device!="") UI::ChangeWidget(`device, `Value, device); - while(true){ - any ret = UI::UserInput(); - if (ret==`cancel){ - result=nil; - break; - } - if (ret==`ok){ - publish = (boolean)UI::QueryWidget(`publish, `Value); - device = (string)UI::QueryWidget(`device, `Value); - result["device"]=device; - result["publish"]=publish ? "yes" : "no"; - break; +map< string, string > showInterfacePopup( string interface_name, boolean is_published ) +{ map< string, string > interface_map = $[]; + UI::OpenDialog + ( `VBox + ( `CheckBox + ( `id(`publish_check_box), + // A CheckBox label to publish local print queues by default + // via a partivular network interface which is shown below. + _("&Publish printers by default via the network interface below."), + is_published + ), + `ComboBox + ( `id(`interfaces_combo_box), + `opt( `editable ), + // A header for a ComboBox which lists network interfaces: + _("Available Network &Interfaces:"), + available_interfaces + ), + `VSpacing(), + `HBox + ( `PushButton( `id(`ok), Label::OKButton() ), + `PushButton( `id(`cancel), Label::CancelButton() ) + ) + ) + ); + if( "" != interface_name ) + { UI::ChangeWidget( `interfaces_combo_box, `Value, interface_name ); + } + while( true ) + { any ret = UI::UserInput(); + if( `cancel == ret ) + { interface_map = nil; + break; + } + if( `ok == ret ) + { interface_name = (string)UI::QueryWidget( `interfaces_combo_box, `Value ); + is_published = (boolean)UI::QueryWidget( `publish_check_box, `Value ); + interface_map["interface_name"] = interface_name; + interface_map["is_published"] = is_published ? "yes" : "no"; + break; + } } - } - UI::CloseDialog(); - return result; + UI::CloseDialog(); + return interface_map; } map showIPPopup(string device, boolean publish){ @@ -253,7 +267,7 @@ break; } } - UI::CloseDialog(); + UI::CloseDialog(); return result; } @@ -265,6 +279,8 @@ void initSharing( string key ) { y2milestone( "entering initSharing with key '%1'", key ); + share_printers_dialog_is_useless = false; + sharing_has_changed = false; // Show a user information because the current implementation provides // only the dialog but does not read from the system or write to the system: Popup::AnyMessage( // Header of a Popup::AnyMessage because of a work-in-progress dialog: @@ -285,6 +301,9 @@ ) ) { share_printers_dialog_is_useless = true; + y2milestone( "share_printers_dialog_is_useless because user decided not to disable client-only CUPS server '%1'", + Printerlib::client_conf_server_name + ); } else { // Remove the 'ServerName' entry in /etc/cups/client.conf: @@ -294,6 +313,9 @@ Printerlib::result["stderr"]:"" + "\n" + Printerlib::result["stdout"]:"" ); share_printers_dialog_is_useless = true; + y2milestone( "share_printers_dialog_is_useless because it failed to disable client-only CUPS server '%1'", + Printerlib::client_conf_server_name + ); } } } @@ -302,46 +324,33 @@ { // Printerlib::GetAndSetCupsdStatus already shows a confirmation popup: if( ! Printerlib::GetAndSetCupsdStatus( "start" ) ) { share_printers_dialog_is_useless = true; + y2milestone( "share_printers_dialog_is_useless because 'rccups start' failed." ); } } - // Determine whether or not there is at least one local queue. - // To be on the safe side, force to autodetect the queues anew - // because it might have been a client-only config before - // or the local cupsd might have been not accessible - // (both result no autodetected local queues). - // Ignore when queue autodetection fails becaue - // it results an empty list of queues as fallback: - Printer::AutodetectQueues(); - // When there are no local queues, the whole "Share Printers" dialog is useless - // because only local queues can be shared: - boolean share_printers_dialog_is_useless = true; - foreach( map< string, string > queue, - Printer::queues, - { if( "local" == queue["config"]:"remote" ) - { share_printers_dialog_is_useless = false; - break; - } - } - ); + // Note that the "Share Printers" dialog is not useless when there is no local queue. + // For example the user may like to configure "Share Printers" (e.g. allow remote access) + // before he set up the first local queue or he may like to delete all local queues + // and then change the "Share Printers" stuff accordingly (e.g. deny remote access). if( share_printers_dialog_is_useless ) - { // The whole "Share Printers" dialog is useless. - // Therefore disable all widgets. - // Only the basic buttons "Help", "Cancel", "OK" are enabled. - UI::ChangeWidget(`deny_or_allow_remote_access, `Enabled, false); - UI::ChangeWidget(`deny_remote_access_radio_button, `Enabled, false); - UI::ChangeWidget(`allow_remote_access_radio_button, `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); - UI::ChangeWidget(`interface_table, `Enabled, false); - UI::ChangeWidget(`add_interface, `Enabled, false); - UI::ChangeWidget(`edit_interface, `Enabled, false); - UI::ChangeWidget(`delete_interface, `Enabled, false); - UI::ChangeWidget(`ip_table_label, `Enabled, false); - UI::ChangeWidget(`ip_table, `Enabled, false); - UI::ChangeWidget(`add_ip, `Enabled, false); - UI::ChangeWidget(`edit_ip, `Enabled, false); - UI::ChangeWidget(`delete_ip, `Enabled, false); + { // The "Share Printers" dialog is (almost) useless. + // Therefore disable all widgets except the deny_remote_access_radio_button + // because the user may like to set deny remote access in /etc/cups/cupsd.conf + // to be on the safe side before he changes a client-only config into a config + // 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_local_network_access_check_box, `Enabled, false ); + UI::ChangeWidget( `publish_to_local_network_check_box, `Enabled, false ); + UI::ChangeWidget( `interface_table_label, `Enabled, false ); + UI::ChangeWidget( `interface_table, `Enabled, false ); + UI::ChangeWidget( `add_interface, `Enabled, false ); + UI::ChangeWidget( `edit_interface, `Enabled, false ); + UI::ChangeWidget( `delete_interface, `Enabled, false ); + UI::ChangeWidget( `ip_table_label, `Enabled, false ); + UI::ChangeWidget( `ip_table, `Enabled, false ); + UI::ChangeWidget( `add_ip, `Enabled, false ); + UI::ChangeWidget( `edit_ip, `Enabled, false ); + UI::ChangeWidget( `delete_ip, `Enabled, false ); } // Regardless whether or not the "Share Printers" dialog is useless, // fill in the values of the current settings in the system: @@ -360,6 +369,7 @@ { // Use fallback value when the command above failed: allow_values = [ "" ]; } + y2milestone( "Initial allow_values: %1", allow_values ); // Determine the 'BrowseAddress' values in /etc/cups/cupsd.conf: // By default there is no BrowseAddress value so that the empty sting is the right fallback: list< string > browse_address_values = [ "" ]; @@ -372,6 +382,7 @@ { // Use fallback value when the command above failed: browse_address_values = [ "" ]; } + y2milestone( "Initial browse_address_values: %1", browse_address_values ); // Split the allow_values list together with the browse_address_values list // into the different values for the different widgets in the dialog. // By default no remote access is allowed (see the defaults in widgetSharing) @@ -379,14 +390,14 @@ foreach( string allow_value, allow_values, { if( "" != allow_value ) - { UI::ChangeWidget(`deny_remote_access_radio_button, `Value, false); - UI::ChangeWidget(`allow_remote_access_radio_button, `Value, true); + { UI::ChangeWidget( `deny_remote_access_radio_button, `Value, false ); + UI::ChangeWidget( `allow_remote_access_radio_button, `Value, true ); } if( "@LOCAL" == allow_value ) - { UI::ChangeWidget(`allow_local_network_access_check_box, `Value, true); + { UI::ChangeWidget( `allow_local_network_access_check_box, `Value, true ); // Check if this value appears also in the browse_address_values: if( contains( browse_address_values, allow_value ) ) - { UI::ChangeWidget(`publish_to_local_network_check_box, `Value, true); + { UI::ChangeWidget( `publish_to_local_network_check_box, `Value, true ); } } if( issubstring( allow_value, "@IF" ) ) @@ -410,75 +421,126 @@ } } ); - UI::ChangeWidget(`interface_table, `Items, interface_table_items); - UI::ChangeWidget(`interface_table, `CurrentItem, -1); + y2milestone( "Initial interface_table_items: %1", interface_table_items ); + UI::ChangeWidget( `interface_table, `Items, interface_table_items ); + UI::ChangeWidget( `interface_table, `CurrentItem, -1 ); + // Determine the currently available network interfaces in the system. + // Omit the loopback interface. + available_interfaces = []; + if( Printerlib::ExecuteBashCommand( "ip -family inet -oneline link show | grep -v -i loopback | cut -s -d ':' -f 2 | tr -s '[:space:]' ' '" ) ) + { // The command outputs a line where multiple network interfaces are separated by space. + // Remove empty or effectively empty entries (otherwise it would be something like ["", "eth0", "eth1"]): + available_interfaces = filter( string interface_name, + toset( splitstring( Printerlib::result["stdout"]:"", " " ) ), + { return( "" != filterchars( interface_name, Printer::alnum_chars ) ); + } + ); + } + else + { // Use fallback value when the command above failed: + available_interfaces = []; + } + y2milestone( "available_interfaces: %1", available_interfaces ); y2milestone( "leaving initSharing" ); } -symbol handleSharing(string key, map event) -{ if (event["EventReason"]:""=="Activated"){ - y2milestone("button pressed %1", event); - switch(event["WidgetID"]:`nil){ - integer current=-1; - map ret = nil; - case `add_interface : - ret = showInterfacePopup("", false); - if (ret!=nil){ - list items = (list)UI::QueryWidget(`interface_table, `Items); - items=add(items, `item(`id(size(items)), ret["device"]:"", ret["publish"]:"")); - UI::ChangeWidget(`interface_table, `Items, items); - UI::ChangeWidget(`interface_table, `CurrentItem, current); +symbol handleSharing( string key, map event ) +{ if (event["EventReason"]:""=="Activated") + { y2milestone( "button pressed %1", event ); + switch( event["WidgetID"]:`nil ) + { integer current_item = -1; + map ret = nil; + map< string, string > interface_map = nil; + case `add_interface : + 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"]:"" + ) + ); + UI::ChangeWidget( `interface_table, `Items, interface_table_items ); + UI::ChangeWidget( `interface_table, `CurrentItem, size(interface_table_items) - 1 ); + } + break; + case `edit_interface : + current_item = (integer)UI::QueryWidget( `interface_table, `CurrentItem ); + term interface_item = (term)UI::QueryWidget( `interface_table, `Item( current_item ) ); + interface_map = showInterfacePopup( (string)interface_item[1]:"", + (interface_item[2]:"no"=="yes") + ); + if( interface_map != nil) + { interface_table_items = []; + foreach( term interface_table_item, + (list<term>)UI::QueryWidget( `interface_table, `Items), + { if( current_item != interface_table_item[0,0]:-1 ) + { interface_table_items = add( interface_table_items, + `item( `id(size(interface_table_items)), + interface_table_item[1]:"", + interface_table_item[2]:"" + ) + ); } - break; - case `edit_interface : - current = (integer)UI::QueryWidget(`interface_table, `CurrentItem); - term this = (term)UI::QueryWidget(`interface_table, `Item(current)); - ret = showInterfacePopup((string)this[1]:"", (this[2]:"no"=="yes")); - if (ret!=nil){ - list items = []; - foreach(term oneItem, (list<term>)UI::QueryWidget(`interface_table, `Items), { - if (current != oneItem[0, 0]:-1){ - items = add(items, `item(`id(size(items)), oneItem[1]:"", oneItem[2]:"")); - } else { - y2milestone("Changing item %1", oneItem); - items = add(items, `item(`id(size(items)), ret["device"]:"", ret["publish"]:"")); - } - }); - UI::ChangeWidget(`interface_table, `Items, items); - UI::ChangeWidget(`interface_table, `CurrentItem, current); + else + { y2milestone( "Changing interface_table_item %1", interface_table_item ); + interface_table_items = add( interface_table_items, + `item( `id(size(interface_table_items)), + interface_map["interface_name"]:"", + interface_map["is_published"]:"" + ) + ); } - break; - case `delete_interface : - current = (integer)UI::QueryWidget(`interface_table, `CurrentItem); - if (current!=nil && current>-1){ - list items = []; - foreach(term oneItem, (list<term>)UI::QueryWidget(`interface_table, `Items), { - if (current != oneItem[0, 0]:-1){ - items = add(items, `item(`id(size(items)), oneItem[1]:"", oneItem[2]:"")); - } else y2milestone("Deleting item %1", oneItem); - - }); - UI::ChangeWidget(`interface_table, `Items, items); - } else y2error("Unproper index for current item: %1", current); - break; + } + ); + UI::ChangeWidget( `interface_table, `Items, interface_table_items ); + UI::ChangeWidget( `interface_table, `CurrentItem, current_item ); + } + break; + case `delete_interface : + current_item = (integer)UI::QueryWidget( `interface_table, `CurrentItem ); + if( current_item != nil && current_item > -1 ) + { interface_table_items = []; + foreach( term interface_table_item, + (list<term>)UI::QueryWidget(`interface_table, `Items), + { if( current_item != interface_table_item[0,0]:-1 ) + { interface_table_items = add( interface_table_items, + `item( `id(size(interface_table_items)), + interface_table_item[1]:"", + interface_table_item[2]:"" + ) + ); + } + else + { y2milestone("Deleting interface_table_item %1", interface_table_item ); + } + } + ); + UI::ChangeWidget( `interface_table, `Items, interface_table_items); + } + else + { y2error("Unproper index for current interface table item: %1", current_item); + } + break; case `add_ip : ret = showIPPopup("", false); if (ret!=nil){ list items = (list)UI::QueryWidget(`ip_table, `Items); items=add(items, `item(`id(size(items)), ret["device"]:"", ret["publish"]:"")); UI::ChangeWidget(`ip_table, `Items, items); - UI::ChangeWidget(`ip_table, `CurrentItem, current); + UI::ChangeWidget(`ip_table, `CurrentItem, current_item); } break; case `edit_ip : - current = (integer)UI::QueryWidget(`ip_table, `CurrentItem); - term this2 = (term)UI::QueryWidget(`ip_table, `Item(current)); + current_item = (integer)UI::QueryWidget(`ip_table, `CurrentItem); + term this2 = (term)UI::QueryWidget(`ip_table, `Item(current_item)); ret = showIPPopup((string)this2[1]:"", (this2[2]:"no"=="yes")); if (ret!=nil){ list items = []; foreach(term oneItem, (list<term>)UI::QueryWidget(`ip_table, `Items), { - if (current != oneItem[0, 0]:-1){ + if (current_item != oneItem[0, 0]:-1){ items = add(items, `item(`id(size(items)), oneItem[1]:"", oneItem[2]:"")); } else { y2milestone("Changing item %1", oneItem); @@ -486,21 +548,21 @@ } }); UI::ChangeWidget(`ip_table, `Items, items); - UI::ChangeWidget(`ip_table, `CurrentItem, current); + UI::ChangeWidget(`ip_table, `CurrentItem, current_item); } break; case `delete_ip : - current = (integer)UI::QueryWidget(`ip_table, `CurrentItem); - if (current!=nil && current>-1){ + current_item = (integer)UI::QueryWidget(`ip_table, `CurrentItem); + if (current_item!=nil && current_item>-1){ list items = []; foreach(term oneItem, (list<term>)UI::QueryWidget(`ip_table, `Items), { - if (current != oneItem[0, 0]:-1){ + if (current_item != oneItem[0, 0]:-1){ items = add(items, `item(`id(size(items)), oneItem[1]:"", oneItem[2]:"")); } else y2milestone("Deleting item %1", oneItem); }); UI::ChangeWidget(`ip_table, `Items, items); - } else y2error("Unproper index for current item: %1", current); + } else y2error("Unproper index for current item: %1", current_item); break; } } Modified: trunk/printer/tools/create_printer_ppd_database URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/create_printer_ppd_database?rev=51477&r1=51476&r2=51477&view=diff ============================================================================== --- trunk/printer/tools/create_printer_ppd_database (original) +++ trunk/printer/tools/create_printer_ppd_database Wed Sep 24 17:11:14 2008 @@ -42,7 +42,7 @@ # Exit after timeout because then no empty YCP map is output # so that either an existing YCP map could be used or YaST could also exit # because without a PPD database printer setup makes not much sense. -MAXIMUM_WAIT="30" +MAXIMUM_WAIT="60" $LPINFO -h localhost -l -m >$TMP_DATA_RAW & lpinfoPID=$! for i in $( seq $MAXIMUM_WAIT ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org