Author: jsmeix Date: Thu Sep 11 16:09:26 2008 New Revision: 51058 URL: http://svn.opensuse.org/viewcvs/yast?rev=51058&view=rev Log: - Adapt the "Add Printer" dialog to the design on http://en.opensuse.org/YaST/Development/Printer_Enhancement - 2.17.12 Modified: trunk/printer/VERSION trunk/printer/package/yast2-printer.changes trunk/printer/src/Printer.ycp trunk/printer/src/basicadd.ycp Modified: trunk/printer/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=51058&r1=51057&r2=51058&view=diff ============================================================================== --- trunk/printer/VERSION (original) +++ trunk/printer/VERSION Thu Sep 11 16:09:26 2008 @@ -1 +1 @@ -2.17.11 +2.17.12 Modified: trunk/printer/package/yast2-printer.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=51058&r1=51057&r2=51058&view=diff ============================================================================== --- trunk/printer/package/yast2-printer.changes (original) +++ trunk/printer/package/yast2-printer.changes Thu Sep 11 16:09:26 2008 @@ -1,9 +1,16 @@ ------------------------------------------------------------------- +Thu Sep 11 15:17:42 CEST 2008 - jsmeix@suse.de + +- Adapt the "Add Printer" dialog to the design on + http://en.opensuse.org/YaST/Development/Printer_Enhancement +- 2.17.12 + +------------------------------------------------------------------- Fri Sep 5 16:05:30 CEST 2008 - jsmeix@suse.de - Fixed bugs regarding client-only setup via a mandatory and better test if a client-only server is accessible. -- 2.7.11 +- 2.17.11 ------------------------------------------------------------------- Thu Sep 4 18:20:06 CEST 2008 - jsmeix@suse.de @@ -11,7 +18,7 @@ - The 'Printing via Network' dialog should now work. - Added user confirmation before a cupsd start/restart/stop. - Implemented [Refresh] button for the 'Overview' dialog. -- 2.7.10 +- 2.17.10 ------------------------------------------------------------------- Wed Sep 3 17:05:45 CEST 2008 - jsmeix@suse.de Modified: trunk/printer/src/Printer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=51058&r1=51057&r2=51058&view=diff ============================================================================== --- trunk/printer/src/Printer.ycp (original) +++ trunk/printer/src/Printer.ycp Thu Sep 11 16:09:26 2008 @@ -666,11 +666,11 @@ // what is actually allowed in CUPS but such queue names are // safe to work in whatever mixed printing system environment: proposal = filterchars( proposal, alnum_chars + "_" ); - // Use a fallback queue name "queue_1" if the proposal is empty + // Use a fallback queue name "printer_1" if the proposal is empty // (or has become empty because of the above filterchars) // or if the proposal consists only of '_': if( "" == proposal || "" == deletechars( proposal, "_" ) ) - { proposal = "queue_1"; + { proposal = "printer_1"; } // Remove leading '_' characters from the proposal. // For example if the proposal was initially something like "_foo" @@ -680,9 +680,9 @@ proposal = substring( proposal, findfirstnotof( proposal, "_") ); } // Make sure that the queue name starts with a letter, - // otherwise add a "queue_" prefix: + // otherwise add a "printer_" prefix: if( "" != deletechars( substring( proposal, 0, 1), letter_chars ) ) - { proposal = "queue_" + proposal; + { proposal = "printer_" + proposal; } // Make sure that no queue with the name of the proposal already exists. // Otherwise add a sufficient high number at the end: @@ -698,7 +698,7 @@ if( issubstring( proposal, "_") ) { // Remove a trailing number or a plain trailing '_' from the proposal // to avoid that multiple trailing numbers or multiple '_' are added - // like "funprinter_1_1" or "queue__1": + // like "funprinter_1_1" or "printer__1": integer position = findlastof( proposal, "_" ); if( "" == deletechars( substring( proposal, position ), number_chars + "_" ) ) { // The value of position is the lenght of the substring Modified: trunk/printer/src/basicadd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicadd.ycp?rev=51058&r1=51057&r2=51058&view=diff ============================================================================== --- trunk/printer/src/basicadd.ycp (original) +++ trunk/printer/src/basicadd.ycp Thu Sep 11 16:09:26 2008 @@ -44,7 +44,8 @@ * @return dialog result */ any BasicAddDialog() -{ string caption = _("Configure a Printer Device (i.e. Set Up a Print Queue for it)"); +{ // Caption for the "Add Printer" dialog (BasicAddDialog): + string caption = _("Add New Printer Configuration"); string driver_filter_string = "BasicAddDialog"; string driver_filter_input_text = ""; string queue_name_proposal = ""; @@ -59,117 +60,124 @@ { driver_filter_input_text = model; } } - term contents = `VBox( `VBox( `Left( `Label( // Caption for a Table with a list of printer connections: - _("Select the Printer Device via its Connection") - ) - ), - `ReplacePoint( `id(`connection_selection_replace_point), - `Table( `id(`connection_selection), - // By default there is no UserInput() - // if only something was selected in the Table - // (without clicking additionally a button) - // but the notify and immediate options - // forces UserInput() in this case: - `opt(`notify, `immediate), - // Headers of a Table with a list of printer connections: - `header( // Header of a Table column with a list of printer connections. - // Printer model name: - _("Model"), - // Header of a Table column with a list of printer connections. - // Connection of the printer (e.g. via USB or via parallel port): - _("Connection"), - // Header of a Table column with a list of printer connections. - // Additional description of the printer or its particular connection: - _("Description") - ), - Printer::ConnectionItems( "BasicAddDialog" ) - ) - ), - `Right( `HBox( `Label( _("If the device is not shown, try") + " " ), - `PushButton( `id(`more_connections), - _("&More Connections") - ), - `Label( " " + _("or use the") + " " ), - `PushButton( `id(`connection_wizard), - _("&Connection Wizard") - ) - ) - ) - ), - `VStretch(), - `VBox( `Left( `Label( // Caption for a printer driver selection: - _("Find and Assign a Suitable Driver") - ) - ), - `HBox( `PushButton( `id(`apply_driver_filter), - // This button must be the default - // (it is activated when the user pressed the Enter key) - // because when the user has clicked into TextEntry to enter something - // it is normal to finish entering by pressing the Enter key - // but if the Enter key was linked to 'Next' or 'Back', - // the user would get the wrong action. - `opt(`default), - // Label of a PushButton to search a list for a search string: - _("&Show") - ), - `Label( " " + _("drivers which match to") + " " ), - `ReplacePoint( `id(`driver_filter_input_replace_point), - `TextEntry( `id(`driver_filter_input), - "", - driver_filter_input_text - ) - ), - `HStretch() - ), - `ReplacePoint( `id(`driver_selection_replace_point), - `SelectionBox( `id(`driver_selection), - // By default there is no UserInput() - // if only something was selected in the SelectionBox - // (without clicking additionally a button) - // but the notify option forces UserInput() in this case: - `opt(`notify), - "", - // Printer::DriverItems( driver_filter_string, true ) - [ `item( `id( -1 ), _("Select a driver.") ) ] - ) - ), - `Right( `HBox( `Label( _("If no suitable driver is shown, try") + " " ), - `PushButton( `id(`more_drivers), - _("More &Drivers") - ), - `Label( " " + _("or") + " " ), - `PushButton( `id(`all_drivers), - _("&All Drivers") - ), - `Label( " " + _("or use the") + " " ), - `PushButton( `id(`driver_wizard), - _("Driver &Wizard") - ) - ) - ) - ), - `VStretch(), - `HBox( `HWeight( 1, - `ReplacePoint( `id(`queue_name_input_replace_point), - `TextEntry( `id(`queue_name_input), - // Header of a TextEntry to enter the queue name: - _("Set a &Queue Name"), - queue_name_proposal - ) - ) - ), - `HWeight( 2, `HStretch() ), - `HWeight( 1, - `Right( `CheckBox( `id(`testpage_checkbox), - // Label of a ckeck box whether or not a testpage should be printed - // after a new queue was configured (by default set to 'yes'): - _("Print &test page"), - false - ) - ) - ) + term contents = `VBox + ( `VBox + ( `Left + ( `Label( // Caption for a Table with a list of printer connections: + _("Determine Connection") ) - ); + ), + `ReplacePoint + ( `id(`connection_selection_replace_point), + `Table + ( `id(`connection_selection), + // By default there is no UserInput() + // if only something was selected in the Table + // (without clicking additionally a button) + // but the notify and immediate options + // forces UserInput() in this case: + `opt(`notify, `immediate), + // Headers of a Table with a list of printer connections: + `header + ( // Header of a Table column with a list of printer connections. + // Printer model name: + _("Model"), + // Header of a Table column with a list of printer connections. + // Connection of the printer (e.g. via USB or via parallel port): + _("Connection"), + // Header of a Table column with a list of printer connections. + // Additional description of the printer or its particular connection: + _("Description") + ), + Printer::ConnectionItems( "BasicAddDialog" ) + ) + ), + `Right + ( `HBox + ( `PushButton + ( `id(`more_connections), + // Label of a PushButton to show more available printer connections + // in the Table with a list of printer connections: + _("&More Connections") + ), + `PushButton + ( `id(`connection_wizard), + // Label of a PushButton to go to the "Connection Wizard" + // to specify the printer connection individually: + _("Connection &Wizard") + ) + ) + ) + ), + `VStretch(), + `VBox + ( `Left + ( `Label + ( // Caption for a printer driver selection: + _("Assign Driver") + ) + ), + `HBox + ( `ReplacePoint + ( `id(`driver_filter_input_replace_point), + `TextEntry + ( `id(`driver_filter_input), + "", + driver_filter_input_text + ) + ), + `PushButton + ( `id(`apply_driver_filter), + // This button must be the default + // (it is activated when the user pressed the Enter key) + // because when the user has clicked into TextEntry to enter something + // it is normal to finish entering by pressing the Enter key + // but if the Enter key was linked to 'Next' or 'Back', + // the user would get the wrong action. + `opt(`default), + // Label of a PushButton to search a list for a search string + // and then show the search result: + _("&Show Matching Drivers") + ), + `HStretch() + ), + `ReplacePoint + ( `id(`driver_selection_replace_point), + `SelectionBox + ( `id(`driver_selection), + // By default there is no UserInput() + // if only something was selected in the SelectionBox + // (without clicking additionally a button) + // but the notify option forces UserInput() in this case: + `opt(`notify), + "", + // Printer::DriverItems( driver_filter_string, true ) + [ `item( `id( -1 ), _("Select a driver.") ) ] + ) + ), + `Right + ( `PushButton + ( `id(`add_driver), + // Label of a PushButton to go to the "Add Driver" dialog + // to install a new driver (and perhaps download it before): + _("&Add Driver") + ) + ) + ), + `VStretch(), + `HBox + ( `ReplacePoint + ( `id(`queue_name_input_replace_point), + `TextEntry + ( `id(`queue_name_input), + // Header of a TextEntry to enter the queue name: + _("Set &Name"), + queue_name_proposal + ) + ), + `HStretch() + ) + ); Wizard::SetContentsButtons( caption, contents, HELPS["basic_add_dialog"]:"", @@ -258,39 +266,11 @@ sformat( _("Failed to add queue %1."), queue_name ) ); } - else - { // Print a test page only if the queue was set up successfully - // and when the testpage checkbox was activated. - // To be safe test explicitely for 'true' because the checkbox value might be 'nil': - if( true == (boolean)UI::QueryWidget(`id(`testpage_checkbox), `Value) ) - { if( ! Printerlib::ExecuteBashCommand( "/usr/bin/lp -d '" - + queue_name - + "' -o page-label=\"Testprint:$(hostname)\" /usr/share/cups/data/testprint.ps" - ) - ) - { Popup::Error( // Message of a Popup::Error - // where %1 will be replaced by the queue name. - // 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). - sformat( _("Failed to print testpage for queue %1."), queue_name ) - ); - } - else - { Popup::TimedMessage( // Popup message - // where %1 will be replaced by the queue name. - sformat( _("Sent testpage to queue %1. Is should start to print soon."), queue_name ), - 60 - ); - } - } - } // After a local queue was added, enforce to show also local queues - // in particular when the queue_filter_string was "remote" before: -/* - if( "remote" == Printer::queue_filter_string ) - { Printer::queue_filter_string = "all"; + // in particular when no local queues were shown before: + if( ! Printer::queue_filter_show_local ) + { Printer::queue_filter_show_local = true; } -*/ Wizard::EnableBackButton(); Wizard::EnableAbortButton(); Wizard::EnableNextButton(); @@ -301,11 +281,11 @@ { // Exit this dialog and go to the ConnectionWizardDialog via the sequencer in wizards.ycp: break; } - if( ret == `driver_wizard ) - { Popup::AnyMessage( // Header of a Popup::AnyMessage when the "Driver Wizard" was selected: + if( ret == `add_driver ) + { Popup::AnyMessage( // Header of a Popup::AnyMessage when "Add Driver" was selected: _("Not yet implemented"), - // Body of a Popup::AnyMessage when the "Driver Wizard" was selected: - _("The 'Driver Wizard' is not yet implemented.") + // Body of a Popup::AnyMessage when the "Add Driver" was selected: + _("The 'Add Driver' dialog is not yet implemented.") ); continue; } @@ -335,153 +315,6 @@ UI::FakeUserInput( `connection_selection ); continue; } - if( ret == `all_drivers ) - { y2milestone( "All drivers" ); - UI::ReplaceWidget( `id(`driver_filter_input_replace_point), - `TextEntry( `id(`driver_filter_input), - "", - _("any model") - ) - ); - UI::ReplaceWidget( `id(`driver_selection_replace_point), - `SelectionBox( `id(`driver_selection), - // By default there is no UserInput() - // if only something was selected in the SelectionBox - // (without clicking additionally a button) - // but the notify option forces UserInput() in this case: - `opt(`notify), - "", - Printer::DriverItems( "", true ) - ) - ); - continue; - } - if( ret == `more_drivers ) - { driver_filter_string = ""; - list driver_items = []; - // Use the existing value of model because for each subsequent run of this more_drivers section - // the existing value of model is shortened at the end (the last word is removed) to get - // more and mor derivers for each subsequent run of this more_drivers section. - y2milestone( "More drivers for '%1'", model ); - if( "" != model - && "unknown" != tolower( model ) - ) - { // This should be no endless loop because sooner or later driver_filter_string becomes empty - // because the model string becomes shorter and shorter but to be safe there is a maximum count: - integer count = 0; - while( size( driver_items ) < 1 - && count < 5 - ) - { count = count + 1; - // If the model string does not contain a space, - // model_words is a singleton list which contains only model. - list <string> model_words = splitstring( model, " " ); - if( size( model_words ) < 2 ) - { // If there are less than two words (in particular if there is only one word left), - // the remove below would result an empty model_words list which results - // an empty driver_filter_string but the fall back to show all drivers is done below. - break; - } - // Remove the last word (i.e. the last element in model_words): - model_words = remove( model_words, size( model_words ) - 1 ); - // Build a new model and driver_filter_string with the remaining words: - model = ""; - foreach( string word, - model_words, - { if( "" == model ) - { model = word; - } - else - { model = model + " " + word; - } - } - ); - driver_filter_string = filterchars( tolower( model ), Printer::lower_alnum_chars ); - if( "" != driver_filter_string ) - { // If a real search is done, match only at the beginning of the NickName entry in the PPD. - // When driver_filter_string is empty is must stay empty (i.e. no "^" as driver_filter_string) - // because Printer::DriverItems() tries to preselect a PPD if driver_filter_string is not empty. - // When driver_filter_string is empty, the fall back to show all drivers is done below. - driver_items = Printer::DriverItems( "^" + driver_filter_string, true ); - } - if( size( driver_items ) < 1 - && size( model_words ) == 1 - ) - { // Nothing found with a driver_filter_string which was derived from only one word. - // This can happen for example when the autodetected model string does not contain - // the manufacturer, e.g. "Officejet 7200 series" (a leading "HP" is missing). - // To make such a one-word-search (e.g. for "Officejet") less strict, - // match anywhere in the NickName entry in the PPD (i.e. without leading '^'): - driver_items = Printer::DriverItems( driver_filter_string, true ); - } - } - if( "" != driver_filter_string ) - { driver_filter_input_text = model; - } - } - else - { // Fall back to the manufacturer when the existing value of model cannot be used: - string model = Printer::connections[Printer::selected_connections_index,"model"]:""; - if( "" != model - && "unknown" != tolower( model ) - ) - { // The first word in the driver_filter_string is usually the first word of the manufacturer name. - // This fuzzy match is intended so that e.g. "Kyocera" and "Kyocera Mita" are the same. - string manufacturer = splitstring( model, " " )[0]:""; - if( "" != manufacturer ) - { // Even more fuzzieness for very ambiguous manufacturer names: - if( "hewlett" == substring( tolower( driver_filter_string ), 0, 7 ) ) - { // Let "Hewlett-Packard", "Hewlett Packard", and "HP be the same: - manufacturer = "HP"; - } - if( "oki" == substring( tolower( driver_filter_string ), 0, 3 ) ) - { // Let "Oki", "Okidata", and "Okipage" be the same: - manufacturer = "Oki"; - } - driver_filter_string = filterchars( tolower( manufacturer ), Printer::lower_alnum_chars ); - driver_filter_input_text = manufacturer; - } - } - // The driver_filter_string might be empty (e.g. when manufacturer = "unknown"): - if( "" != driver_filter_string ) - { // Match only at the beginning of the NickName entry in the PPD: - driver_items = Printer::DriverItems( "^" + driver_filter_string, true ); - if( size( driver_items ) < 1 ) - { // Nothing found with the above driver_filter_string. - // To make the search less strict, - // match anywhere in the NickName entry in the PPD (i.e. without leading '^'): - driver_items = Printer::DriverItems( driver_filter_string, true ); - // Set an unspecific header (and not the specific manufacturer header): - driver_filter_input_text = driver_filter_string; - } - } - } - if( size( driver_items ) < 1 ) - { // Nothing was found above. - // Fall back to show all drivers: - driver_items = Printer::DriverItems( "", true ); - // Header of a SelectionBox with a list of drivers: - driver_filter_input_text = _("any model"); - } - UI::ReplaceWidget( `id(`driver_filter_input_replace_point), - `TextEntry( `id(`driver_filter_input), - "", - driver_filter_input_text - ) - ); - UI::ReplaceWidget( `id(`driver_selection_replace_point), - `SelectionBox( `id(`driver_selection), - // By default there is no UserInput() - // if only something was selected in the SelectionBox - // (without clicking additionally a button) - // but the notify option forces UserInput() in this case: - `opt(`notify), - "", - driver_items - ) - ); - continue; - } if( ret == `connection_selection ) { integer selected_connection_index = (integer)UI::QueryWidget( `id(`connection_selection), `CurrentItem ); if( nil == selected_connection_index ) @@ -535,7 +368,7 @@ UI::ReplaceWidget( `id(`queue_name_input_replace_point), `TextEntry( `id(`queue_name_input), // Header of a TextEntry to enter the queue name: - _("Set a &Queue Name"), + _("Set &Name"), queue_name_proposal ) ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org