Mailinglist Archive: yast-commit (553 mails)

< Previous Next >
[yast-commit] r60030 - in /trunk/printer: package/yast2-printer.changes src/Printer.ycp src/connectionwizard.ycp
  • From: jsmeix@xxxxxxxxxxxxxxxx
  • Date: Wed, 09 Dec 2009 16:27:59 -0000
  • Message-id: <E1NIPOR-0008I7-TY@xxxxxxxxxxxxxxxx>
Author: jsmeix
Date: Wed Dec 9 17:27:59 2009
New Revision: 60030

URL: http://svn.opensuse.org/viewcvs/yast?rev=60030&view=rev
Log:

Next version 2.19.1 with yast2-printer.changes entry:

- An existing connection can be modified by the "Connection Wizard"
which launches with a matching sub-dialog where the values
of the existing connection are preset or it falls back to the
"Specify Arbitrary Device URI" sub-dialog if the existing
URI scheme does not match to a more specific sub-dialog
(see Novell/Suse Bugzilla bnc#553871).
- Added support for current_queue_name and current_device_uri in
Printer.ycp, overview.ycp, basicadd.ycp, and basicmodify.ycp
which means that the currently used queue and/or connection
is preselected in the Overview and/or Add/Modify dialogs
(i.e. there no longer only the default Table widget
prelelection which preselects the topmost item).
- Replaced several duplicated code blocks in basicmodify.ycp,
basicadd.ycp, and connectionwizard.ycp by calling the new
added DeriveModelName and DeriveDriverFilterString functions
in Printer.ycp.
- Added "bugfix-support" for username and password
in ipp/http URIs and for username in lpd URIs.
"Bugfix-support" means that there is no support
to set up URIs with those stuff because the CUPS
main author Michael Sweet really does not want to
encourage its use but when it is already there
in an existing URI, it is at least shown correctly.
Usually username and password components for
ipp/http and lpd URIs are shown in the matching
"Connection Wizard" sub-dialog in the hostname field
in the form username:password@hostname for ipp/http
and username@hostname for lpd URIs
(see Novell/Suse Bugzilla bnc#512549).
- Connection Wizard: test connection does no longer
require printer manufacturer
(see Novell/Suse Bugzilla bnc#536461).
- Enhanced error messages in the test_remote_* tools
to indicate possible reasons for the error
(see Novell/Suse Bugzilla bnc#553872).
- In Printer.ycp replaced "Detected printers"
by "Printer detection finished"
(see Novell/Suse Bugzilla bnc#533584).
- Added BrowsePoll support for "Print via Network"
(see Novell/Suse Bugzilla bnc#433047).
- Added bugfixes and minor support for local classes:
Local classes are shown as "class" (not as "remote")
and one can delete a local class but there is no support
to add or edit classes.
- 2.19.1


Modified:
trunk/printer/package/yast2-printer.changes
trunk/printer/src/Printer.ycp
trunk/printer/src/connectionwizard.ycp

Modified: trunk/printer/package/yast2-printer.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=60030&r1=60029&r2=60030&view=diff
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Wed Dec 9 17:27:59 2009
@@ -1,4 +1,53 @@
-------------------------------------------------------------------
+Wed Dec 9 12:51:58 CET 2009 - jsmeix@xxxxxxx
+
+- An existing connection can be modified by the "Connection Wizard"
+ which launches with a matching sub-dialog where the values
+ of the existing connection are preset or it falls back to the
+ "Specify Arbitrary Device URI" sub-dialog if the existing
+ URI scheme does not match to a more specific sub-dialog
+ (see Novell/Suse Bugzilla bnc#553871).
+- Added support for current_queue_name and current_device_uri in
+ Printer.ycp, overview.ycp, basicadd.ycp, and basicmodify.ycp
+ which means that the currently used queue and/or connection
+ is preselected in the Overview and/or Add/Modify dialogs
+ (i.e. there no longer only the default Table widget
+ prelelection which preselects the topmost item).
+- Replaced several duplicated code blocks in basicmodify.ycp,
+ basicadd.ycp, and connectionwizard.ycp by calling the new
+ added DeriveModelName and DeriveDriverFilterString functions
+ in Printer.ycp.
+- Added "bugfix-support" for username and password
+ in ipp/http URIs and for username in lpd URIs.
+ "Bugfix-support" means that there is no support
+ to set up URIs with those stuff because the CUPS
+ main author Michael Sweet really does not want to
+ encourage its use but when it is already there
+ in an existing URI, it is at least shown correctly.
+ Usually username and password components for
+ ipp/http and lpd URIs are shown in the matching
+ "Connection Wizard" sub-dialog in the hostname field
+ in the form username:password@hostname for ipp/http
+ and username@hostname for lpd URIs
+ (see Novell/Suse Bugzilla bnc#512549).
+- Connection Wizard: test connection does no longer
+ require printer manufacturer
+ (see Novell/Suse Bugzilla bnc#536461).
+- Enhanced error messages in the test_remote_* tools
+ to indicate possible reasons for the error
+ (see Novell/Suse Bugzilla bnc#553872).
+- In Printer.ycp replaced "Detected printers"
+ by "Printer detection finished"
+ (see Novell/Suse Bugzilla bnc#533584).
+- Added BrowsePoll support for "Print via Network"
+ (see Novell/Suse Bugzilla bnc#433047).
+- Added bugfixes and minor support for local classes:
+ Local classes are shown as "class" (not as "remote")
+ and one can delete a local class but there is no support
+ to add or edit classes.
+- 2.19.1
+
+-------------------------------------------------------------------
Fri Oct 30 11:53:06 CET 2009 - jsmeix@xxxxxxx

- Added a generic test if a firewall is used to Printerlib.ycp

Modified: trunk/printer/src/Printer.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=60030&r1=60029&r2=60030&view=diff
==============================================================================
--- trunk/printer/src/Printer.ycp (original)
+++ trunk/printer/src/Printer.ycp Wed Dec 9 17:27:59 2009
@@ -1123,6 +1123,7 @@
// and take the connection_filter_string into account (if it is not the
empty string).
list< term > connection_items = [];
list< term > sorted_connection_items = [];
+ list< string > already_added_uris = [];
boolean an_item_was_added = false;
integer connections_index = -1;
string uri = "";
@@ -1139,106 +1140,93 @@
model = connection_entry["model"]:"";
info = connection_entry["info"]:"";
class = connection_entry["class"]:"";
- if( uri != "" )
- { // Take the filter_string into account:
- if( "" == connection_filter_string )
- { // Add trailing spaces because the current YaST UI
- // has almost no additional space between table columns
- // in partitcular not where the widest entry in a column is:
- connection_items = add( connection_items, `item( `id(
connections_index ),
- model + " ",
- uri + " ",
- info
- )
- );
- an_item_was_added = true;
- }
- else
- { // If the connection_filter_string is the special string
"BasicAddDialog",
- // do a special filtering for those connections which are
suitable
- // for the BasicAddDialog (i.e. only parallel, usb, and hp
connections):
- if( "BasicAddDialog" == connection_filter_string )
- { if( "parallel:/" == substring( uri, 0, 10 )
- || "usb:/" == substring( uri, 0, 5 )
- || "hp:/" == substring( uri, 0, 4 )
- || "ConnectionWizardDialog" == class
+ // Skip effectively empty (i.e. useless) entries:
+ if( "" == uri )
+ { continue;
+ }
+ // Skip duplicate URIs because it does not make sense
+ // to show more than one entry with the same URI because
+ // for CUPS only different URIs distinguish different devices.
+ // For example two same USB printer models without different
serial numbers
+ // are indistinguishable for CUPS so that any printout would be
sent only
+ // to one of both devices (probably the first one in the USB
device list):
+ if( contains( already_added_uris, uri ) )
+ { y2milestone( "skipped connection_entry with duplicate
DeviceURI: '%1'", connection_entry );
+ continue;
+ }
+ // Take the filter_string into account:
+ if( "" == connection_filter_string )
+ { // Add trailing spaces because the current YaST UI
+ // has almost no additional space between table columns
+ // in partitcular not where the widest entry in a column is:
+ connection_items = add( connection_items, `item( `id(
connections_index ),
+ model + " ",
+ uri + " ",
+ info
+ )
+ );
+ an_item_was_added = true;
+ }
+ else
+ { // If the connection_filter_string is the special string
"BasicAddDialog",
+ // do a special filtering for those connections which are
suitable
+ // for the BasicAddDialog (i.e. only parallel, usb, and hp
connections):
+ if( "BasicAddDialog" == connection_filter_string )
+ { if( "parallel:/" == substring( uri, 0, 10 )
+ || "usb:/" == substring( uri, 0, 5 )
+ || "hp:/" == substring( uri, 0, 4 )
+ || "ConnectionWizardDialog" == class
+ )
+ { // Skip "usb://HP/" DeviceURIs if it was not created by the
Connection Wizard
+ // and if there is at least one "hp:/usb/" DeviceURI
+ // so that the "hp:/usb/" DeviceURI is used with preference.
+ // The "usb://HP/" DeviceURI is still available via
"MoreConnections".
+ // It can happen that a "usb://HP/" DeviceURI is skipped
+ // without a matching "hp:/usb/" DeviceURI because
+ // the "hp" backend lists only devices which are known as
supported by HPLIP.
+ // If there are two HP printers connected but only one is
supported by HPLIP,
+ // there exists one "hp:/usb/" DeviceURI and therefore all
"usb://HP/" DeviceURIs
+ // are skipped even the one for the HP printer which is
unknown to HPLIP.
+ // But this is no real problem because all "usb://HP/"
DeviceURIs are still
+ // available via "MoreConnections".
+ // Actually it is even good that HP printers which are
unknown to HPLIP
+ // are skipped by default because usually we do not provide
a driver
+ // for such printers so that the extra-cklick on
"MoreConnections" may
+ // make the user aware that something is fishy with this
particular model
+ // so that the user hopefully pays more attention which
driver he selects.
+ // If a HP printer is unknown to HPLIP it does not mean
that it is unsupported
+ // (it does also not mean that it is unsupported by HPLIP)
because
+ // it could be simply a new model which is not yet known to
HPLIP
+ // but compatible to a known model. In this case the user
must pay attention
+ // which exact driver he selects manually for his
particular model.
+ if( "usb://hp/" == tolower( substring( uri, 0, 9 ) )
+ && hp_usb_uri_exists
+ && class != "ConnectionWizardDialog"
)
- { // Skip "usb://HP/" DeviceURIs if it was not created by
the Connection Wizard
- // and if there is at least one "hp:/usb/" DeviceURI
- // so that the "hp:/usb/" DeviceURI is used with
preference.
- // The "usb://HP/" DeviceURI is still available via
"MoreConnections".
- // It can happen that a "usb://HP/" DeviceURI is skipped
- // without a matching "hp:/usb/" DeviceURI because
- // the "hp" backend lists only devices which are known as
supported by HPLIP.
- // If there are two HP printers connected but only one is
supported by HPLIP,
- // there exists one "hp:/usb/" DeviceURI and therefore
all "usb://HP/" DeviceURIs
- // are skipped even the one for the HP printer which is
unknown to HPLIP.
- // But this is no real problem because all "usb://HP/"
DeviceURIs are still
- // available via "MoreConnections".
- // Actually it is even good that HP printers which are
unknown to HPLIP
- // are skipped by default because usually we do not
provide a driver
- // for such printers so that the extra-cklick on
"MoreConnections" may
- // make the user aware that something is fishy with this
particular model
- // so that the user hopefully pays more attention which
driver he selects.
- // If a HP printer is unknown to HPLIP it does not mean
that it is unsupported
- // (it does also not mean that it is unsupported by
HPLIP) because
- // it could be simply a new model which is not yet known
to HPLIP
- // but compatible to a known model. In this case the user
must pay attention
- // which exact driver he selects manually for his
particular model.
- if( "usb://hp/" == tolower( substring( uri, 0, 9 ) )
- && hp_usb_uri_exists
+ { y2milestone( "skipped 'usb://HP/' DeviceURI '%1'", uri );
+ }
+ else
+ { // Skip "hp:/par/" DeviceURIs if it was not created by
the Connection Wizard
+ // and if there is at least one "parallel:/" DeviceURI
+ // so that the "parallel:/" DeviceURI is used with
preference.
+ // The reason for this preference is that for my LaserJet
1220
+ // which is accessible via "parallel:/dev/lp0" and
+ // via "hp:/par/HP_LaserJet_1220?device=/dev/parport0"
+ // it does not work for the "hp:/par/" DeviceURI and in
/var/log/messages there is
+ // ... parport0: io/hpmud/pp.c 517: compat_write_data
transfer stalled
+ // ... parport0: io/hpmud/musb.c 1339: unable to write
data
+ // hp:/par/HP_LaserJet_1220?device=/dev/parport0:
Resource temporarily unavailable
+ // so that the generic "parallel:/" DeviceURI seems to be
the better fail-safe default.
+ // It should not happen that a "hp:/par/" DeviceURI is
skipped without
+ // having a matching generic "parallel:/" DeviceURI
available.
+ // The "hp:/par/" DeviceURI is still available via
"MoreConnections".
+ if( "hp:/par/" == tolower( substring( uri, 0, 8 ) )
+ && parallel_uri_exists
&& class != "ConnectionWizardDialog"
)
- { y2milestone( "skipped 'usb://HP/' DeviceURI '%1'", uri
);
+ { y2milestone( "skipped 'hp:/par/' DeviceURI '%1'", uri );
}
else
- { // Skip "hp:/par/" DeviceURIs if it was not created by
the Connection Wizard
- // and if there is at least one "parallel:/" DeviceURI
- // so that the "parallel:/" DeviceURI is used with
preference.
- // The reason for this preference is that for my
LaserJet 1220
- // which is accessible via "parallel:/dev/lp0" and
- // via "hp:/par/HP_LaserJet_1220?device=/dev/parport0"
- // it does not work for the "hp:/par/" DeviceURI and in
/var/log/messages there is
- // ... parport0: io/hpmud/pp.c 517: compat_write_data
transfer stalled
- // ... parport0: io/hpmud/musb.c 1339: unable to write
data
- // hp:/par/HP_LaserJet_1220?device=/dev/parport0:
Resource temporarily unavailable
- // so that the generic "parallel:/" DeviceURI seems to
be the better fail-safe default.
- // It should not happen that a "hp:/par/" DeviceURI is
skipped without
- // having a matching generic "parallel:/" DeviceURI
available.
- // The "hp:/par/" DeviceURI is still available via
"MoreConnections".
- if( "hp:/par/" == tolower( substring( uri, 0, 8 ) )
- && parallel_uri_exists
- && class != "ConnectionWizardDialog"
- )
- { y2milestone( "skipped 'hp:/par/' DeviceURI '%1'", uri
);
- }
- else
- { // Add trailing spaces because the current YaST UI
- // has almost no additional space between table
columns
- // in partitcular not where the widest entry in a
column is:
- connection_items = add( connection_items, `item( `id(
connections_index ),
-
model + " ",
- uri
+ " ",
- info
- )
- );
- an_item_was_added = true;
- }
- }
- }
- }
- else
- { // If the connection_filter_string is the special string
"MoreConnections",
- // do a special filtering for those connections which are
supposed to work
- // i.e. where the uri seems to be a complete DeviceURI e.g.
"socket://192.168.1.2:9100"
- // and not just an URI scheme like a plain "socket".
- // It doesn't matter if backends (i.e. schemes) with non
alphanumeric characters
- // are skipped here because for unusual backends there is
the "Connection Wizard":
- if( "MoreConnections" == connection_filter_string )
- { // if( issubstring ( uri , ":/" ) )
- if( regexpmatch( uri, "^[" + alnum_chars + "]+:/" )
- || "ConnectionWizardDialog" == class
- )
{ // Add trailing spaces because the current YaST UI
// has almost no additional space between table columns
// in partitcular not where the widest entry in a
column is:
@@ -1251,33 +1239,57 @@
an_item_was_added = true;
}
}
- else
- { // If the connection_filter_string is a usual non-empty
string,
- // test whether the model matches to the
connection_filter_string:
- if( regexpmatch( tolower( model ), tolower(
connection_filter_string ) ) )
- { // Add trailing spaces because the current YaST UI
- // has almost no additional space between table columns
- // in partitcular not where the widest entry in a
column is:
- connection_items = add( connection_items, `item( `id(
connections_index ),
- model
+ " ",
- uri +
" ",
- info
- )
- );
- an_item_was_added = true;
- }
+ }
+ }
+ else
+ { // If the connection_filter_string is the special string
"MoreConnections",
+ // do a special filtering for those connections which are
supposed to work
+ // i.e. where the uri seems to be a complete DeviceURI e.g.
"socket://192.168.1.2:9100"
+ // and not just an URI scheme like a plain "socket".
+ // It doesn't matter if backends (i.e. schemes) with non
alphanumeric characters
+ // are skipped here because for unusual backends there is the
"Connection Wizard":
+ if( "MoreConnections" == connection_filter_string )
+ { // if( issubstring ( uri , ":/" ) )
+ if( regexpmatch( uri, "^[" + alnum_chars + "]+:/" )
+ || "ConnectionWizardDialog" == class
+ )
+ { // Add trailing spaces because the current YaST UI
+ // has almost no additional space between table columns
+ // in partitcular not where the widest entry in a column
is:
+ connection_items = add( connection_items, `item( `id(
connections_index ),
+ model +
" ",
+ uri + "
",
+ info
+ )
+ );
+ an_item_was_added = true;
+ }
+ }
+ else
+ { // If the connection_filter_string is a usual non-empty
string,
+ // test whether the model matches to the
connection_filter_string:
+ if( regexpmatch( tolower( model ), tolower(
connection_filter_string ) ) )
+ { // Add trailing spaces because the current YaST UI
+ // has almost no additional space between table columns
+ // in partitcular not where the widest entry in a column
is:
+ connection_items = add( connection_items, `item( `id(
connections_index ),
+ model +
" ",
+ uri + "
",
+ info
+ )
+ );
+ an_item_was_added = true;
}
}
}
- if( an_item_was_added
- && "" != current_device_uri
- )
+ }
+ if( an_item_was_added )
+ { already_added_uris = add( already_added_uris, uri );
+ if( current_device_uri == uri )
{ // Set selected_connections_index when the current_device_uri
is in the list so that
// BasicAddDialog and BasicModifyDialog can preselect the
currently used connection
// via its id in the list which is the
selected_connections_index.
- if( current_device_uri == uri )
- { selected_connections_index = connections_index;
- }
+ selected_connections_index = connections_index;
}
}
}
@@ -1414,29 +1426,31 @@
string nickname = ppd_entry["nickname"]:"";
string deviceID = ppd_entry["deviceID"]:"";
string language = ppd_entry["language"]:"";
+ // Skip effectively empty (i.e. useless) entries:
+ if( "" == ppd || "" == nickname )
+ { continue;
+ }
// Build the entry:
- if( ppd != "" && nickname != "" )
- { driver_string = nickname + " [" + ppd + "]";
- // Take the filter_string into account:
- if( "" == driver_filter_string )
+ driver_string = nickname + " [" + ppd + "]";
+ // Take the filter_string into account:
+ if( "" == driver_filter_string )
+ { driver_items = add( driver_items, `item( `id( ppds_index ),
driver_string ) );
+ }
+ else
+ { // If the driver_filter_string is a non-empty string,
+ // test whether nickname or deviceID matches to the
driver_filter_string.
+ // Only the special character '+' is also taken into account
because
+ // this is sometimes also a meaningful character in the model
name
+ // for example the '+' at the end of a Kyocera model name
+ // indicates that this model has a built-in PostScript
interpreter
+ // while the model without the '+' understands only PCL.
+ string unified_nickname = filterchars( tolower( nickname ),
lower_alnum_chars + "+" );
+ string unified_deviceID = filterchars( tolower( deviceID ),
lower_alnum_chars + "+" );
+ if( regexpmatch( unified_nickname, driver_filter_string )
+ || regexpmatch( unified_deviceID, driver_filter_string )
+ )
{ driver_items = add( driver_items, `item( `id( ppds_index ),
driver_string ) );
}
- else
- { // If the driver_filter_string is a non-empty string,
- // test whether nickname or deviceID matches to the
driver_filter_string.
- // Only the special character '+' is also taken into account
because
- // this is sometimes also a meaningful character in the model
name
- // for example the '+' at the end of a Kyocera model name
- // indicates that this model has a built-in PostScript
interpreter
- // while the model without the '+' understands only PCL.
- string unified_nickname = filterchars( tolower( nickname ),
lower_alnum_chars + "+" );
- string unified_deviceID = filterchars( tolower( deviceID ),
lower_alnum_chars + "+" );
- if( regexpmatch( unified_nickname, driver_filter_string )
- || regexpmatch( unified_deviceID, driver_filter_string )
- )
- { driver_items = add( driver_items, `item( `id( ppds_index ),
driver_string ) );
- }
- }
}
}
);

Modified: trunk/printer/src/connectionwizard.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/connectionwizard.ycp?rev=60030&r1=60029&r2=60030&view=diff
==============================================================================
--- trunk/printer/src/connectionwizard.ycp (original)
+++ trunk/printer/src/connectionwizard.ycp Wed Dec 9 17:27:59 2009
@@ -247,15 +247,54 @@
}

term getContentFromBackend( string backend )
-{ list items = [];
+{ list connection_items = [];
backend = backend + ":/";
- foreach( term row,
+ string current_device_uri = getCurrentDeviceURI();
+ boolean current_device_uri_found = false;
+ term current_connection_item = nil;
+ foreach( term connection_item,
(list<term>)Printer::ConnectionItems( "" ),
- { if( backend == substring( row[2]:"", 0, size(backend) ) )
- { items = add( items, row );
+ { // A connection_item is `item( `id(connections_index), model,
uri, info )
+ // but Printer::ConnectionItems adds a trailing space character
to model and uri
+ // (because the current YaST UI has almost no additional space
between table columns)
+ // so that the last character must be removed to get the correct
device URI value:
+ string uri = connection_item[2]:"";
+ uri = substring( uri, 0, size(uri) - 1 );
+ if( backend == substring( uri, 0, size(backend) ) )
+ { if( current_device_uri == uri )
+ { current_device_uri_found = true;
+ current_connection_item = connection_item;
+ }
+ else
+ { connection_items = add( connection_items, connection_item );
+ }
}
}
);
+ if( backend == substring( current_device_uri, 0, size(backend) ) )
+ { if( ! current_device_uri_found )
+ { // The current connection is no longer vaild.
+ // Nevertheless the current connection must be topmost to be preselected
because
+ // anything else which might be topmost and preselected (even an empty
value)
+ // would silently change the current connection to the preselected one
+ // when the user clicks [OK]:
+ connection_items = prepend( connection_items,
+ // Add trailing spaces because the current
YaST UI
+ // has almost no additional space between
table columns
+ // in partitcular not where the widest entry
in a column is:
+ `item( `id( -1 ),
+ "Unknown" + " ",
+ current_device_uri + " ",
+ "No longer valid (printer not
connected?)"
+ )
+ );
+ }
+ else
+ { // Add the current connection topmost to be preselected
+ // via the default Table widget preselection:
+ connection_items = prepend( connection_items, current_connection_item );
+ }
+ }
term content = `VBox
( `Table
( `id(`connection_selection),
@@ -277,7 +316,7 @@
// Additional description of the printer or its
particular connection:
_("Description")
),
- items
+ connection_items
)
);
return content;
@@ -1941,7 +1980,16 @@
_("Select a connection"),
// Body of a Popup::AnyMessage when no
connection was selected
// because there is no connection available to
be selected:
- _("If no connection is shown here, it is not
possible\nto access the device via this type of connection. ")
+ _("If no connection is shown here, it is not
possible\nto access the device via this type of connection.\nWas the printer
connected and switched on all the time?")
+ );
+ break;
+ }
+ if( selected_connection_index < 0 )
+ { Popup::AnyMessage( // Header of a Popup::AnyMessage when an
invalid connection was selected:
+ _("Select a valid connection"),
+ // Body of a Popup::AnyMessage when an invalid
connection was selected
+ // because the current connection is no longer
valid:
+ _("When the current connection is no longer
valid,\nit does no longer work to access the device via this connection.\nIs
the printer still connected and switched on?")
);
break;
}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages