commit yast2-printer for openSUSE:Factory
Hello community, here is the log from the commit of package yast2-printer for openSUSE:Factory checked in at Fri Feb 27 00:56:39 CET 2009. -------- --- yast2-printer/yast2-printer.changes 2009-02-17 14:07:17.000000000 +0100 +++ yast2-printer/yast2-printer.changes 2009-02-26 15:28:38.337136000 +0100 @@ -1,0 +2,21 @@ +Thu Feb 26 14:49:04 CET 2009 - jsmeix@suse.de + +- Fixed the "More Drivers" functionality in basicmodify.ycp + to show the current driver topmost in any case. +- Enhanced help texts for basicadd.ycp and basicmodify.ycp + to describe driver related issues in much more detail. +- Call Wizard::SetContents with empty content in basicadd.ycp + and basicmodify.ycp to avoid that initially the previous + dialog is shown until the real content is generated. +- 2.18.7 + +------------------------------------------------------------------- +Wed Feb 25 16:19:45 CET 2009 - jsmeix@suse.de + +- Added a "More Drivers" functionality to basicadd.ycp and + basicmodify.ycp (see Novell/Suse Bugzilla bnc#468046). +- Fixed the test whether there is a valid driver and a valid + connection before a queue is set up in printer_proposal.ycp. +- 2.18.6 + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- yast2-printer-2.18.5.tar.bz2 New: ---- yast2-printer-2.18.7.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-printer.spec ++++++ --- /var/tmp/diff_new_pack.j10814/_old 2009-02-27 00:54:37.000000000 +0100 +++ /var/tmp/diff_new_pack.j10814/_new 2009-02-27 00:54:37.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package yast2-printer (Version 2.18.5) +# spec file for package yast2-printer (Version 2.18.7) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -20,12 +20,12 @@ Url: http://en.opensuse.org/YaST/Modules/Printer Name: yast2-printer -Version: 2.18.5 +Version: 2.18.7 Release: 1 License: GPL v2 or later Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-printer-2.18.5.tar.bz2 +Source0: yast2-printer-2.18.7.tar.bz2 Prefix: /usr BuildRequires: cups-devel update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-testsuite Recommends: netcat @@ -65,7 +65,7 @@ Michal Zugec <mzugec@suse.cz> %prep -%setup -n yast2-printer-2.18.5 +%setup -n yast2-printer-2.18.7 %build %{prefix}/bin/y2tool y2autoconf @@ -127,6 +127,21 @@ %exclude %{prefix}/share/doc/packages/yast2-printer/COPYING %exclude %{prefix}/share/doc/packages/yast2-printer/README %changelog +* Thu Feb 26 2009 jsmeix@suse.de +- Fixed the "More Drivers" functionality in basicmodify.ycp + to show the current driver topmost in any case. +- Enhanced help texts for basicadd.ycp and basicmodify.ycp + to describe driver related issues in much more detail. +- Call Wizard::SetContents with empty content in basicadd.ycp + and basicmodify.ycp to avoid that initially the previous + dialog is shown until the real content is generated. +- 2.18.7 +* Wed Feb 25 2009 jsmeix@suse.de +- Added a "More Drivers" functionality to basicadd.ycp and + basicmodify.ycp (see Novell/Suse Bugzilla bnc#468046). +- Fixed the test whether there is a valid driver and a valid + connection before a queue is set up in printer_proposal.ycp. +- 2.18.6 * Tue Feb 17 2009 jsmeix@suse.de - Removed Firewall Settings which were added in version 2.17.29 because it is not possible to implement it so that it works ++++++ yast2-printer-2.18.5.tar.bz2 -> yast2-printer-2.18.7.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/configure new/yast2-printer-2.18.7/configure --- old/yast2-printer-2.18.5/configure 2009-02-17 13:53:52.000000000 +0100 +++ new/yast2-printer-2.18.7/configure 2009-02-26 15:22:24.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for yast2-printer 2.18.5. +# Generated by GNU Autoconf 2.63 for yast2-printer 2.18.7. # # Report bugs to <http://bugs.opensuse.org/>. # @@ -596,8 +596,8 @@ # Identity of this package. PACKAGE_NAME='yast2-printer' PACKAGE_TARNAME='yast2-printer' -PACKAGE_VERSION='2.18.5' -PACKAGE_STRING='yast2-printer 2.18.5' +PACKAGE_VERSION='2.18.7' +PACKAGE_STRING='yast2-printer 2.18.7' PACKAGE_BUGREPORT='http://bugs.opensuse.org/' ac_unique_file="RPMNAME" @@ -1274,7 +1274,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures yast2-printer 2.18.5 to adapt to many kinds of systems. +\`configure' configures yast2-printer 2.18.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1345,7 +1345,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of yast2-printer 2.18.5:";; + short | recursive ) echo "Configuration of yast2-printer 2.18.7:";; esac cat <<\_ACEOF @@ -1425,7 +1425,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -yast2-printer configure 2.18.5 +yast2-printer configure 2.18.7 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1439,7 +1439,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by yast2-printer $as_me 2.18.5, which was +It was created by yast2-printer $as_me 2.18.7, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -2286,7 +2286,7 @@ # Define the identity of the package. PACKAGE='yast2-printer' - VERSION='2.18.5' + VERSION='2.18.7' cat >>confdefs.h <<_ACEOF @@ -2510,7 +2510,7 @@ -VERSION="2.18.5" +VERSION="2.18.7" RPMNAME="yast2-printer" MAINTAINER="Michal Zugec <mzugec@novell.com>" @@ -3451,7 +3451,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by yast2-printer $as_me 2.18.5, which was +This file was extended by yast2-printer $as_me 2.18.7, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3501,7 +3501,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -yast2-printer config.status 2.18.5 +yast2-printer config.status 2.18.7 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/configure.in new/yast2-printer-2.18.7/configure.in --- old/yast2-printer-2.18.5/configure.in 2009-02-17 13:53:48.000000000 +0100 +++ new/yast2-printer-2.18.7/configure.in 2009-02-26 15:22:19.000000000 +0100 @@ -3,7 +3,7 @@ dnl -- This file is generated by y2autoconf 2.17.6 - DO NOT EDIT! -- dnl (edit configure.in.in instead) -AC_INIT(yast2-printer, 2.18.5, http://bugs.opensuse.org/, yast2-printer) +AC_INIT(yast2-printer, 2.18.7, http://bugs.opensuse.org/, yast2-printer) dnl Check for presence of file 'RPMNAME' AC_CONFIG_SRCDIR([RPMNAME]) @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE(tar-ustar -Wno-portability) dnl Important YaST2 variables -VERSION="2.18.5" +VERSION="2.18.7" RPMNAME="yast2-printer" MAINTAINER="Michal Zugec <mzugec@novell.com>" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/src/basicadd.ycp new/yast2-printer-2.18.7/src/basicadd.ycp --- old/yast2-printer-2.18.5/src/basicadd.ycp 2009-02-17 11:15:31.000000000 +0100 +++ new/yast2-printer-2.18.7/src/basicadd.ycp 2009-02-26 14:07:12.000000000 +0100 @@ -47,6 +47,16 @@ { y2milestone( "entering BasicAddDialog" ); // Caption for the "Add Printer" dialog (BasicAddDialog): string caption = _("Add New Printer Configuration"); + // Clear whatever content of a previous dialog which would show up here for several seconds + // until all the following stuff is done before Wizard::SetContentsButtons is called + // which finally shows the right content for this dialog. + Wizard::SetContents( caption, + `Empty(), + HELPS["basic_add_dialog"]:"", + false, + false + ); + Wizard::HideAbortButton(); string driver_filter_string = "BasicAddDialog"; string driver_filter_input_text = ""; string queue_name_proposal = ""; @@ -110,39 +120,47 @@ ), `VStretch(), `VBox - ( `HBox - ( `ReplacePoint + ( `Left + ( `Label + ( // Caption for a printer driver selection: + _("Assign 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 + // and then show the search result: + _("&Search") + ), + `ReplacePoint ( `id(`driver_filter_input_replace_point), `InputField - ( `id(`driver_filter_input), `opt(`hstretch), - // Caption for a printer driver selection: - _("Search for &Drivers"), + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", driver_filter_input_text ) ), - `VBox - ( `Label(""), - `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 - // and then show the search result: - _("&Show Matching Drivers") - ), - `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") - ) - ) + `HStretch(), + `PushButton + ( `id(`more_drivers), + // Label of a PushButton to show more available printer drivers: + _("More &Drivers") + ), + `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") ) ), `ReplacePoint @@ -157,20 +175,39 @@ "", [ `item( `id( -1 ), _("Select a driver.") ) ] ) + ), + `RadioButtonGroup + ( `id(`paper_size_radio_buttons), + `HBox + ( `Label + ( // Label of a RadioButtonGroup to specify the default paper size: + _("Default paper size (if printer and driver supports it)") + ), + // Have none of the RadioButtons preselected which means that + // by default the CUPS default is used for the default paper size. + // For the CUPS 1.3 default see http://www.cups.org/str.php?L2846 + // For CUPS 1.4 the default depends on the "DefaultPaperSize" setting in cupsd.conf + // see https://bugzilla.novell.com/show_bug.cgi?id=395760 + // and http://www.cups.org/str.php?L2848 + `HSpacing( 2 ), + `RadioButton( `id(`a4), "A&4" ), + `HSpacing( 1 ), + `RadioButton( `id(`letter), "Le&tter" ), + `HStretch() + ) ) ), `VStretch(), - `HBox + `Left ( `ReplacePoint ( `id(`queue_name_input_replace_point), - `TextEntry + `InputField ( `id(`queue_name_input), // Header of a TextEntry to enter the queue name: _("Set &Name"), queue_name_proposal ) - ), - `HStretch() + ) ) ); // According to http://en.opensuse.org/YaST/Style_Guide#Single_Configuration.2FOverview.2FEd... @@ -259,10 +296,18 @@ } queue_name = validated_queue_name; } + string default_paper_size = ""; + any paper_size = UI::QueryWidget( `id(`paper_size_radio_buttons), `CurrentButton ); + if( `a4 == paper_size ) + { default_paper_size = "A4"; + } + if( `letter == paper_size ) + { default_paper_size = "Letter"; + } Wizard::DisableBackButton(); Wizard::DisableNextButton(); // No error messages here because Printer::AddQueue already shows them: - Printer::AddQueue( queue_name ); + Printer::AddQueue( queue_name, default_paper_size ); // After a local queue was added, enforce to show also local queues // in particular when no local queues were shown before: Printer::queue_filter_show_local = true; @@ -333,10 +378,20 @@ { queue_name_proposal = Printer::NewQueueName( tolower( model ) ); driver_filter_input_text = model; driver_filter_string = filterchars( tolower( model ), Printer::lower_alnum_chars ); - // Match at the beginning also if the connection is from the connection wizard - // because here the model is only the manufacturer name (or "Generic" or "Raw Queue") - // so that match at the beginning is exactly right for connections from the connection wizard: - driver_filter_string = "^" + driver_filter_string; + // 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" result the same. + string manufacturer = splitstring( driver_filter_string, " " )[0]:""; + // Match at the beginning only if the first word in the driver_filter_string + // is actually a known manufacturer name + // (there is only "Kyocera" but not "Kyocera Mita" in the known_manufacturers list). + foreach( string known_manufacturer, + Printer::known_manufacturers, + { if( manufacturer == tolower( known_manufacturer ) ) + { driver_filter_string = "^" + driver_filter_string; + break; + } + } + ); } if( "" == driver_filter_string ) { // Set a fallback driver_filter_string which does not match to anything @@ -348,8 +403,8 @@ UI::ReplaceWidget( `id(`driver_filter_input_replace_point), `InputField ( `id(`driver_filter_input), `opt(`hstretch), - // Caption for a printer driver selection: - _("Search for &Drivers"), + // No InputField header because there is the "Caption for a printer driver selection": + "", driver_filter_input_text ) ); @@ -365,11 +420,12 @@ ) ); UI::ReplaceWidget( `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 - ) + `InputField + ( `id(`queue_name_input), + // Header of a TextEntry to enter the queue name: + _("Set &Name"), + queue_name_proposal + ) ); continue; } @@ -400,8 +456,8 @@ UI::ReplaceWidget( `id(`driver_filter_input_replace_point), `InputField ( `id(`driver_filter_input), `opt(`hstretch), - // Caption for a printer driver selection: - _("Search for &Drivers"), + // No InputField header because there is the "Caption for a printer driver selection": + "", driver_filter_input_text ) ); @@ -418,6 +474,153 @@ ); continue; } + if( ret == `more_drivers ) + { driver_filter_string = ""; + boolean valid_driver_found = false; + 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 ) + ) + { // 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 the following does not make sense. + // Try to find the word which contains a model number. + // This is usually the first word which contains a number. + string model_number_word = ""; + foreach( string word, + model_words, + { if( "" != filterchars( word, Printer::number_chars ) ) + { model_number_word = word; + break; + } + } + ); + // Provide visible feeback what is going on: + UI::ReplaceWidget( `id(`driver_filter_input_replace_point), + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + model_number_word + ) + ); + driver_filter_string = filterchars( tolower( model_number_word ), Printer::lower_alnum_chars ); + if( "" != driver_filter_string ) + { driver_items = Printer::DriverItems( driver_filter_string, true ); + // Printer::DriverItems may result a driver_items list with one single element + // [ `item( `id( -1 ), _("No matching driver found.") ) ] + // to show at least a meaningful text as fallback entry to the user + // or Printer::DriverItems may result a driver_items list with the first item + // [ `item( `id( -1 ), _("Select a driver.") ), ... ] + // when Printer::DriverItems could not preselect a driver item. + // If a valid driver was found (but perhaps none was preselected), + // there would be a non-negative id value of the first or second element + // which is driver_items[0,0,0] or driver_items[1,0,0] + // (id[0] is the value of the id, see the comment in Printer::DriverItems). + if( driver_items[0,0,0]:-1 >= 0 + || driver_items[1,0,0]:-1 >= 0 + ) + { valid_driver_found = true; + } + } + } + } + // Use the manufacturer when the existing value of model cannot be used + // or when nothing was found above: + if( ! valid_driver_found ) + { driver_filter_string = ""; + 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 fuzziness 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 = tolower( manufacturer ); + // Match at the beginning only if the driver_filter_string is actually a known manufacturer: + foreach( string known_manufacturer, + Printer::known_manufacturers, + { if( driver_filter_string == tolower( known_manufacturer ) ) + { driver_filter_string = "^" + driver_filter_string; + break; + } + } + ); + // Provide visible feeback what is going on: + UI::ReplaceWidget( `id(`driver_filter_input_replace_point), + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + manufacturer + ) + ); + driver_items = Printer::DriverItems( driver_filter_string, true ); + // Printer::DriverItems may result a driver_items list with one single element + // [ `item( `id( -1 ), _("No matching driver found.") ) ] + // to show at least a meaningful text as fallback entry to the user + // or Printer::DriverItems may result a driver_items list with the first item + // [ `item( `id( -1 ), _("Select a driver.") ), ... ] + // when Printer::DriverItems could not preselect a driver item. + // If a valid driver was found (but perhaps none was preselected), + // there would be a non-negative id value of the first or second element + // which is driver_items[0,0,0] or driver_items[1,0,0] + // (id[0] is the value of the id, see the comment in Printer::DriverItems). + if( driver_items[0,0,0]:-1 >= 0 + || driver_items[1,0,0]:-1 >= 0 + ) + { valid_driver_found = true; + } + } + } + } + // Nothing was found above. + // Fall back to show all drivers: + if( ! valid_driver_found ) + { // Provide visible feeback what is going on: + UI::ReplaceWidget( `id(`driver_filter_input_replace_point), + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + _("any model") + ) + ); + driver_items = Printer::DriverItems( "", true ); + } + 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; + } y2milestone( "Ignoring unexpected returncode in BasicAddDialog: %1", ret ); continue; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/src/basicmodify.ycp new/yast2-printer-2.18.7/src/basicmodify.ycp --- old/yast2-printer-2.18.5/src/basicmodify.ycp 2009-02-17 11:15:31.000000000 +0100 +++ new/yast2-printer-2.18.7/src/basicmodify.ycp 2009-02-26 14:11:07.000000000 +0100 @@ -66,6 +66,16 @@ // Title of the Basic Modify Dialog where %1 will be replaced by the queue name. // The actual queue name is a system value which cannot be translated: string caption = sformat( _("Modify %1") , name ); + // Clear whatever content of a previous dialog which would show up here for several seconds + // until all the following stuff is done before Wizard::SetContentsButtons is called + // which finally shows the right content for this dialog. + Wizard::SetContents( caption, + `Empty(), + HELPS["basic_modify_dialog"]:"", + false, + false + ); + Wizard::HideAbortButton(); string model = ""; list <string> description_words = splitstring( description, " " ); if( size( description_words ) > 2 ) @@ -293,39 +303,10 @@ ), `VStretch(), `VBox - ( `HBox - ( `ReplacePoint - ( `id(`driver_filter_input_replace_point), - `InputField - ( `id(`driver_filter_input), `opt(`hstretch), - // Caption for a printer driver selection: - _("Search for &Drivers"), - driver_filter_input_text - ) - ), - `VBox - ( `Label(""), - `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 - // and then show the search result: - _("&Show Matching Drivers") - ), - `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") - ) - ) + ( `Left + ( `Label + ( // Caption for a printer driver selection: + _("Adjust Options of the Current Driver or Assign a Different Driver") ) ), `ReplacePoint @@ -335,6 +316,43 @@ `Left( driver_options_content ) ) ), + `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 + // and then show the search result: + _("&Search") + ), + `ReplacePoint + ( `id(`driver_filter_input_replace_point), + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + driver_filter_input_text + ) + ), + `HStretch(), + `PushButton + ( `id(`more_drivers), + // Label of a PushButton to show more available printer drivers: + _("More &Drivers") + ), + `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") + ) + ), `ReplacePoint ( `id(`driver_selection_replace_point), `SelectionBox @@ -674,12 +692,13 @@ driver_filter_string = "qqqqqqqqqq"; } UI::ReplaceWidget( `id(`driver_filter_input_replace_point), - `InputField - ( `id(`driver_filter_input), `opt(`hstretch), - // Caption for a printer driver selection: - _("Search for &Drivers"), - driver_filter_input_text - ) + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + driver_filter_input_text + ) ); UI::ReplaceWidget( `id(`driver_selection_replace_point), `SelectionBox( `id(`driver_selection), @@ -805,12 +824,13 @@ { driver_filter_input_text = _("any model"); } UI::ReplaceWidget( `id(`driver_filter_input_replace_point), - `InputField - ( `id(`driver_filter_input), `opt(`hstretch), - // Caption for a printer driver selection: - _("Search for &Drivers"), - driver_filter_input_text - ) + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + driver_filter_input_text + ) ); UI::ReplaceWidget( `id(`driver_selection_replace_point), `SelectionBox( `id(`driver_selection), @@ -827,6 +847,154 @@ ); continue; } + if( ret == `more_drivers ) + { driver_filter_string = ""; + boolean valid_driver_found = false; + 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 ) + ) + { // 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 the following does not make sense. + // Try to find the word which contains a model number. + // This is usually the first word which contains a number. + string model_number_word = ""; + foreach( string word, + model_words, + { if( "" != filterchars( word, Printer::number_chars ) ) + { model_number_word = word; + break; + } + } + ); + // Provide visible feeback what is going on: + UI::ReplaceWidget( `id(`driver_filter_input_replace_point), + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + model_number_word + ) + ); + driver_filter_string = filterchars( tolower( model_number_word ), Printer::lower_alnum_chars ); + if( "" != driver_filter_string ) + { driver_items = Printer::DriverItems( driver_filter_string, true ); + // Printer::DriverItems may result a driver_items list with one single element + // [ `item( `id( -1 ), _("No matching driver found.") ) ] + // to show at least a meaningful text as fallback entry to the user + // or Printer::DriverItems may result a driver_items list with the first item + // [ `item( `id( -1 ), _("Select a driver.") ), ... ] + // when Printer::DriverItems could not preselect a driver item. + // If a valid driver was found (but perhaps none was preselected), + // there would be a non-negative id value of the first or second element + // which is driver_items[0,0,0] or driver_items[1,0,0] + // (id[0] is the value of the id, see the comment in Printer::DriverItems). + if( driver_items[0,0,0]:-1 >= 0 + || driver_items[1,0,0]:-1 >= 0 + ) + { valid_driver_found = true; + } + } + } + } + // Use the manufacturer when the existing value of model cannot be used + // or when nothing was found above: + if( ! valid_driver_found ) + { driver_filter_string = ""; + 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 fuzziness 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 = tolower( manufacturer ); + // Match at the beginning only if the driver_filter_string is actually a known manufacturer: + foreach( string known_manufacturer, + Printer::known_manufacturers, + { if( driver_filter_string == tolower( known_manufacturer ) ) + { driver_filter_string = "^" + driver_filter_string; + break; + } + } + ); + // Provide visible feeback what is going on: + UI::ReplaceWidget( `id(`driver_filter_input_replace_point), + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + manufacturer + ) + ); + driver_items = Printer::DriverItems( driver_filter_string, true ); + // Printer::DriverItems may result a driver_items list with one single element + // [ `item( `id( -1 ), _("No matching driver found.") ) ] + // to show at least a meaningful text as fallback entry to the user + // or Printer::DriverItems may result a driver_items list with the first item + // [ `item( `id( -1 ), _("Select a driver.") ), ... ] + // when Printer::DriverItems could not preselect a driver item. + // If a valid driver was found (but perhaps none was preselected), + // there would be a non-negative id value of the first or second element + // which is driver_items[0,0,0] or driver_items[1,0,0] + // (id[0] is the value of the id, see the comment in Printer::DriverItems). + if( driver_items[0,0,0]:-1 >= 0 + || driver_items[1,0,0]:-1 >= 0 + ) + { valid_driver_found = true; + } + } + } + } + // Nothing was found above. + // Fall back to show all drivers: + if( ! valid_driver_found ) + { // Provide visible feeback what is going on: + UI::ReplaceWidget( `id(`driver_filter_input_replace_point), + `InputField + ( `id(`driver_filter_input), + `opt(`hstretch), + // No InputField header because there is the "Caption for a printer driver selection": + "", + _("any model") + ) + ); + driver_items = Printer::DriverItems( "", true ); + } + 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), + "", + prepend( driver_items, + current_driver + ) + ) + ); + continue; + } y2milestone( "Ignoring unexpected returncode in BasicModifyDialog: %1", ret ); continue; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/src/connectionwizard.ycp new/yast2-printer-2.18.7/src/connectionwizard.ycp --- old/yast2-printer-2.18.5/src/connectionwizard.ycp 2009-02-17 11:15:31.000000000 +0100 +++ new/yast2-printer-2.18.7/src/connectionwizard.ycp 2009-02-26 10:57:06.000000000 +0100 @@ -42,61 +42,8 @@ string connection_uri=""; string connection_model=""; -list< string > known_manufacturers = [ "Generic", - "Alps", - "Anitech", - "Apollo", - "Apple", - "Brother", - "Canon", - "Citizen", - "CItoh", - "Compaq", - "DEC", - "Dell", - "Dymo", - "Epson", - "Fujifilm", - "Fujitsu", - "Gestetner", - "Heidelberg", - "Hitachi", - "HP", - "IBM", - "Infotec", - "Kodak", - "KS", - "Kyocera", - "Lanier", - "Lexmark", - "Minolta", - "Mitsubishi", - "NEC", - "NRG", - "Oce", - "Oki", - "Olivetti", - "Olympus", - "Panasonic", - "PCPI", - "QMS", - "Raven", - "Ricoh", - "Samsung", - "Savin", - "Seiko", - "Sharp", - "Shinko", - "Sony", - "Star", - "Tally", - "Tektronix", - "Toshiba", - "Xerox", - "Zebra" - ]; -list< string > manufacturers_for_using_driver = prepend( add( known_manufacturers, "Raw Queue" ), "" ); -list< string > manufacturers_for_raw_queue = prepend( known_manufacturers, "Raw Queue" ); +list< string > manufacturers_for_using_driver = prepend( add( Printer::known_manufacturers, "Raw Queue" ), "" ); +list< string > manufacturers_for_raw_queue = prepend( Printer::known_manufacturers, "Raw Queue" ); string getCurrentDeviceURI() { if( "" != Printer::connections[Printer::selected_connections_index,"uri"]:"") @@ -139,7 +86,7 @@ `opt(`editable), // Header for a ComboBox to keep the printer model or select another manufacturer: _("Keep the printer model or select another &manufacturer"), - prepend( add( known_manufacturers, "Raw Queue" ), current_model_info ) + prepend( add( Printer::known_manufacturers, "Raw Queue" ), current_model_info ) ) ); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/src/helps.ycp new/yast2-printer-2.18.7/src/helps.ycp --- old/yast2-printer-2.18.5/src/helps.ycp 2009-02-17 13:44:41.000000000 +0100 +++ new/yast2-printer-2.18.7/src/helps.ycp 2009-02-26 15:22:17.000000000 +0100 @@ -62,9 +62,7 @@ It is possible to have several different print queues for the same printer device. For example a second queue with a monochrome-only driver for a color device -or a PostScript queue and a queue with a PCL driver for a PostScript+PCL -printer or a queue to print on one side only of a sheet of paper and one for two sided -printing. +or a PostScript queue and a queue with a PCL driver for a PostScript+PCL printer. </p>") + // Overview dialog help 2/7: _("<p> @@ -149,7 +147,48 @@ The <b>driver</b> determines that the right data is produced for the specific printer model.<br> If a wrong driver is assigned, wrong data is sent to the printer -which results bad looking printout, chaotic printout, or no printout at all. +which results bad looking printout, chaotic printout, or no printout at all.<br> +Initially the input field for the driver search string is preset +with the autodetected model name of the currently selected connection +and those drivers where the driver description matches to the model name +are shown by default.<br> +If driver descriptions match to the autodetected model name +and if all matching driver descriptions seem to belong to the same model, +the driver descriptions are sorted so that the most reasonable driver +should be listed topmost and this one is automatically preselected. +If no driver is automatically preselected, you must manually +find and select an appropriate driver.<br> +On the other hand if a driver was automatically preselected, +it does not necessarily mean that this driver is +a reasonable driver for your particular needs. +Strictly speaking an automatically preselected driver +may not work at all for your particular printer model. +The reason is that the automated driver selection +can only work based upon comparison of strings +(the autodetected model name and the driver descriptions) +so that the result can be only a best-guess proposal +how to set up your particular printer model.<br> +Therefore check if the currently preselected values make sense +and feel free to play around and modify the settings +to what you know what works best for your printer.<br> +If no driver description matches to the autodetected model name, +it does not necessarily mean that there is no driver available for the model. +Often only the model name in the driver descriptions +is different from the autodetected model name. +Therefore you can enter whatever you like as driver search string +and search through all available driver descriptions.<br> +Usually the default driver option settings should be reasonable +so that the driver works for your particular printer model. +Some driver option settings must match to your particular printer. +In particular the default paper size setting of the driver +must match to the paper which is actually loaded in your printer. +You can either explicitely select A4 or Letter as default paper size +or select nothing to use the built-in default paper size of the driver +which is also the fallback if the driver neither supports A4 nor Letter +(for example a driver for a small-format photo printer). +If you like to adjust other driver options except A4 or Letter, +you must first set up the queue and then in a second step +you can adjust all driver options in the 'Edit/Modify' dialog. </p>") + // BasicAddDialog help 5/5: _("<p> @@ -177,7 +216,34 @@ The latter is provided by the HP driver package 'hplip'. For plain printing both kind of connections should work but for anything else (e.g. device status via 'hp-toolbox', or scanning with a HP all-in-one device) -the 'hp:/...' connection must be used. +the 'hp:/...' connection must be used.<br> +When you exchange the currently used connection by another one, +the input field for the driver search string is preset +with the autodetected model name of the new selected connection +and those drivers where the driver description matches to the model name +are shown by default.<br> +If driver descriptions match to the autodetected model name +and if all matching driver descriptions seem to belong to the same model, +the driver descriptions are sorted so that the most reasonable driver +should be listed topmost (but still below the currently used driver). +On the other hand, it does not necessarily mean that this driver is +a reasonable driver for your particular needs. +Strictly speaking the topmost listed driver +may not work at all for your particular printer model. +The reason is that the automated driver selection +can only work based upon comparison of strings +(the autodetected model name and the driver descriptions) +so that the result can be only a best-guess proposal +how to set up your particular printer model.<br> +Therefore check if the currently preselected values make sense +and feel free to play around and modify the settings +to what you know what works best for your printer.<br> +If no driver description matches to the autodetected model name, +it does not necessarily mean that there is no driver available for the model. +Often only the model name in the driver descriptions +is different from the autodetected model name. +Therefore you can enter whatever you like as driver search string +and search through all available driver descriptions. </p>") + // BasicModifyDialog help 3/4: _("<p> @@ -195,7 +261,21 @@ should work for the particular driver. Nevertheless it may happen that your particular printer fails to print with high resolution. For example when you have a laser printer -which has insufficient built-in memory to process high resolution pages. +which has insufficient built-in memory to process high resolution pages.<br> +When you exchange the currently used driver by another one, +you must first apply this change to the print queue +so that the new driver is used for the queue +(i.e. you must finish this dialog as a first step) +and then in a second step you can adjust all driver options +by using this dialog again.<br> +Initially the input field for the driver search string is preset +with the description of the currently used driver when the connection was not changed. +This results usually only one single driver which matches +so that you would have to enter a less specific driver search string +to get also other drivers or you use the 'More Drivers' button. +If no driver matches, it does not mean that there is no driver available. +Therefore you can enter whatever you like as driver search string +and search through all available driver descriptions. </p>") + // BasicModifyDialog help 4/4: _("<p> @@ -301,9 +381,9 @@ (separated by slash '/' characters) which specify the details for this kind of data-transfer.<br> Finally there could be optional parameters (separated by a question mark '?') -of the form option1=value1&option2=value2&option3=value3 so that +of the form option1=value1&option2=value2&option3=value3 so that a full device URI could be for example:<br> -ipp://server.domain:631/printers/queuename?waitjob=false&waitprinter=false<br> +ipp://server.domain:631/printers/queuename?waitjob=false&waitprinter=false<br> Special characters must be percent-encoded (also known as URL encoding). For example a space character ' ' must be written as '%20' and a plus sign '+' must be written as '%2B'.<br> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/src/printer_proposal.ycp new/yast2-printer-2.18.7/src/printer_proposal.ycp --- old/yast2-printer-2.18.5/src/printer_proposal.ycp 2009-02-17 11:15:31.000000000 +0100 +++ new/yast2-printer-2.18.7/src/printer_proposal.ycp 2009-02-26 10:57:06.000000000 +0100 @@ -214,12 +214,25 @@ string driver_filter_string = "^" + filterchars( tolower( model ), Printer::lower_alnum_chars ); if( "^" != driver_filter_string ) { list drivers = Printer::DriverItems( driver_filter_string, true ); - if( size(drivers) > 0 ) - { y2internal("Available drivers: %1", drivers); - y2internal("Selected driver: %1", drivers[0]:nil); - Printer::selected_ppds_index = drivers[0,0,0]:-1; - Printer::selected_connections_index = printer[0,0]:-1; - if( Printer::AddQueue( queue_name ) ) + // Printer::DriverItems may result a drivers list with one single element + // [ `item( `id( -1 ), _("No matching driver found.") ) ] + // to show at least a meaningful text as fallback entry to the user + // or Printer::DriverItems may result a drivers list with the first item + // [ `item( `id( -1 ), _("Select a driver.") ), ... ] + // when Printer::DriverItems could not preselect a driver item. + // In contrast if a valid driver was found and preselected, there would be + // a non-negative id value of the first element which is drivers[0,0,0] + // (id[0] is the value of the id, see the comment in Printer::DriverItems). + // Only a test if both selected_ppds_index and selected_connections_index + // are non-negative makes sure that there is a valid driver and a valid connection. + y2internal("Available drivers: %1", drivers); + Printer::selected_ppds_index = drivers[0,0,0]:-1; + Printer::selected_connections_index = printer[0,0]:-1; + if( Printer::selected_ppds_index >= 0 + && Printer::selected_connections_index >= 0 + ) + { y2internal("Selected driver: %1", drivers[0]:nil); + if( Printer::AddQueue( queue_name, "" ) ) { already_set_up_uris = add( already_set_up_uris, uri ); // Autodetect queues again so that Printer::NewQueueName // can compare with existing queue names but ignore whatever failures diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/src/Printer.ycp new/yast2-printer-2.18.7/src/Printer.ycp --- old/yast2-printer-2.18.5/src/Printer.ycp 2009-02-17 11:22:22.000000000 +0100 +++ new/yast2-printer-2.18.7/src/Printer.ycp 2009-02-26 10:57:06.000000000 +0100 @@ -108,6 +108,67 @@ global string lower_alnum_chars = number_chars + lower_chars; /** + * Explicite listing of all known manufacturers in a standard installation + * which one gets as output from the command + * lpinfo -l -m | grep make-and-model | cut -s -d '=' -f 2 | cut -s -d ' ' -f 2 | sort -f -u + * and then a bit changing it (in particular removing duplicates and nonsense entries). + * The current list was made on openSUSE 11.0. + */ +global list< string > known_manufacturers = [ "Generic", + "Alps", + "Anitech", + "Apollo", + "Apple", + "Brother", + "Canon", + "Citizen", + "CItoh", + "Compaq", + "DEC", + "Dell", + "Dymo", + "Epson", + "Fujifilm", + "Fujitsu", + "Gestetner", + "Heidelberg", + "Hitachi", + "HP", + "IBM", + "Infotec", + "Kodak", + "KS", + "Kyocera", + "Lanier", + "Lexmark", + "Minolta", + "Mitsubishi", + "NEC", + "NRG", + "Oce", + "Oki", + "Olivetti", + "Olympus", + "Panasonic", + "PCPI", + "QMS", + "Raven", + "Ricoh", + "Samsung", + "Savin", + "Seiko", + "Sharp", + "Shinko", + "Sony", + "Star", + "Tally", + "Tektronix", + "Toshiba", + "Xerox", + "Zebra" + ]; + +/** * PPD database: * the database is created anew in Printer::CreateDatabase() which calls * the bash script "/usr/lib/YaST2/bin/create_ppd_database" @@ -1233,8 +1294,8 @@ ); if( size( driver_items ) == 0 ) { // If the driver_items list is empty (e.g. because of a too restrictive driver_filter_string), - // show a meaningful text as fallback entry. - driver_string = _("No matching driver found."); + // show a meaningful text as fallback entry ('More Drivers' is a button label). + driver_string = _("No matching driver found. Change the search string or try 'More Drivers'."); driver_items = [ `item( `id( -1 ), driver_string ) ]; // Invalidate selected_ppds_index to be on the safe side. // Otherwise it is possible to set up a queue with a previously selected driver @@ -1616,7 +1677,7 @@ * Add new queue or overwrite existing queue * @return true on success */ -global boolean AddQueue( string queue_name ) +global boolean AddQueue( string queue_name, string default_paper_size ) { // Delete ' characters because they are used for quoting in the bash commandline below: queue_name = deletechars( queue_name, "'" ); string uri = deletechars( connections[selected_connections_index,"uri"]:"", "'" ); @@ -1659,6 +1720,25 @@ Printerlib::ExecuteBashCommand( "/usr/sbin/lpadmin -h localhost -x '" + queue_name + "'" ); return false; } + // Try to set the requested default_paper_size if it is an available choice for this queue. + // If no default_paper_size is requested, the CUPS default is used. + // For the CUPS 1.3 default see http://www.cups.org/str.php?L2846 + // For CUPS 1.4 the default depends on the "DefaultPaperSize" setting in cupsd.conf + // see https://bugzilla.novell.com/show_bug.cgi?id=395760 + // and http://www.cups.org/str.php?L2848 + if( "" != default_paper_size ) + { // The following command fails intentionally if the queue has no PPD file - i.e. when it is a "raw" queue + // (a queue with a "System V style interface script" cannot be set up with YaST). + // '\>' is used to find an available choice also when it is the last value on the line. + // Note the YCP quoting: \\< becomes \< and \\> becomes \> in the commandline. + commandline = "lpoptions -h localhost -p '" + queue_name + "' -l | grep '^PageSize.*\\<" + default_paper_size + "\\>'"; + if( Printerlib::ExecuteBashCommand( commandline ) ) + { commandline = "/usr/sbin/lpadmin -h localhost -p '" + queue_name + "' -o 'PageSize=" + default_paper_size + "'"; + // Do not care if it fails to set the default_paper_size (i.e. show no error message to the user) + // because the default_paper_size setting is nice to have but not mandatoty for a working queue: + Printerlib::ExecuteBashCommand( commandline ); + } + } return true; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-printer-2.18.5/VERSION new/yast2-printer-2.18.7/VERSION --- old/yast2-printer-2.18.5/VERSION 2009-02-17 12:29:24.000000000 +0100 +++ new/yast2-printer-2.18.7/VERSION 2009-02-26 14:49:01.000000000 +0100 @@ -1 +1 @@ -2.18.5 +2.18.7 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de