Author: jsmeix
Date: Wed Feb 25 16:44:30 2009
New Revision: 55749
URL: http://svn.opensuse.org/viewcvs/yast?rev=55749&view=rev
Log:
Created tag stable-2_18_6 for printer
Added:
tags/stable-2_18_6/printer/
- copied from r55748, trunk/printer/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
Author: jsmeix
Date: Wed Feb 25 16:44:22 2009
New Revision: 55748
URL: http://svn.opensuse.org/viewcvs/yast?rev=55748&view=rev
Log:
- 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
Modified:
trunk/printer/VERSION
trunk/printer/package/yast2-printer.changes
trunk/printer/src/Printer.ycp
trunk/printer/src/basicadd.ycp
trunk/printer/src/basicmodify.ycp
trunk/printer/src/connectionwizard.ycp
trunk/printer/src/helps.ycp
trunk/printer/src/printer_proposal.ycp
Modified: trunk/printer/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=55748&r1=557…
==============================================================================
--- trunk/printer/VERSION (original)
+++ trunk/printer/VERSION Wed Feb 25 16:44:22 2009
@@ -1 +1 @@
-2.18.5
+2.18.6
Modified: trunk/printer/package/yast2-printer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.ch…
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Wed Feb 25 16:44:22 2009
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Wed Feb 25 16:19:45 CET 2009 - jsmeix(a)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 12:34:16 CET 2009 - jsmeix(a)suse.de
- Removed Firewall Settings which were added in version 2.17.29
Modified: trunk/printer/src/Printer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=5574…
==============================================================================
--- trunk/printer/src/Printer.ycp (original)
+++ trunk/printer/src/Printer.ycp Wed Feb 25 16:44:22 2009
@@ -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;
}
Modified: trunk/printer/src/basicadd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicadd.ycp?rev=557…
==============================================================================
--- trunk/printer/src/basicadd.ycp (original)
+++ trunk/printer/src/basicadd.ycp Wed Feb 25 16:44:22 2009
@@ -110,39 +110,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 +165,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.2FE…
@@ -259,10 +286,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 +368,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 +393,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 +410,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 +446,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 +464,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;
}
Modified: trunk/printer/src/basicmodify.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicmodify.ycp?rev=…
==============================================================================
--- trunk/printer/src/basicmodify.ycp (original)
+++ trunk/printer/src/basicmodify.ycp Wed Feb 25 16:44:22 2009
@@ -293,39 +293,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:
+ _("Driver")
)
),
`ReplacePoint
@@ -335,6 +306,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 +682,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 +814,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 +837,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 BasicModifyDialog: %1", ret );
continue;
}
Modified: trunk/printer/src/connectionwizard.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/connectionwizard.ycp…
==============================================================================
--- trunk/printer/src/connectionwizard.ycp (original)
+++ trunk/printer/src/connectionwizard.ycp Wed Feb 25 16:44:22 2009
@@ -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 )
)
);
}
Modified: trunk/printer/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/helps.ycp?rev=55748&…
==============================================================================
--- trunk/printer/src/helps.ycp (original)
+++ trunk/printer/src/helps.ycp Wed Feb 25 16:44:22 2009
@@ -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>
Modified: trunk/printer/src/printer_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printer_proposal.ycp…
==============================================================================
--- trunk/printer/src/printer_proposal.ycp (original)
+++ trunk/printer/src/printer_proposal.ycp Wed Feb 25 16:44:22 2009
@@ -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
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
Author: jsrain
Date: Wed Feb 25 14:56:15 2009
New Revision: 55746
URL: http://svn.opensuse.org/viewcvs/yast?rev=55746&view=rev
Log:
Created tag branch-Code-11-2_17_73 for network
Added:
tags/branch-Code-11-2_17_73/network/
- copied from r55745, branches/SuSE-Code-11-Branch/network/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org