Closed Bug 235763 Opened 20 years ago Closed 20 years ago

Print dialog show list printer descriptions if available

Categories

(Core :: Printing: Output, enhancement)

x86
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: roland.mainz, Assigned: roland.mainz)

References

Details

Attachments

(3 files, 6 obsolete files)

RFE: Print dialog show list printer descriptions if available.

Some print APIs (such as Xprint :) allow that printers have descriptions
additional to their name. It would be nice if we could fetch that information
and display that in the print dialog.
Attached patch Prototype patch (obsolete) — Splinter Review
Assignee: core.printing → roland.mainz
Status: NEW → ASSIGNED
There is one problem:
The current selection is not being rendered in the <menupopup>. When I open the
popup everything is rendered OK, but the selection remains "white" (or "blue"
when selected).

Neil/bz:
Any ideas what I am doing wrong ?
Attached patch Patch for 2004-02-28-trunk (obsolete) — Splinter Review
Attachment #142433 - Attachment is obsolete: true
Attachment #142434 - Attachment is obsolete: true
Comment on attachment 142517 [details] [diff] [review]
Patch for 2004-02-28-trunk

Requesting r=/sr= ...
Attachment #142517 - Flags: superreview?(roc)
Attachment #142517 - Flags: review?(roc)
Comment on attachment 142517 [details] [diff] [review]
Patch for 2004-02-28-trunk

>+function buildPrinterDescription(printerName)
>+{
>+  var XHTMLNS = "http://www.w3.org/1999/xhtml";
>+
>+  var name_elem = document.createElementNS(XHTMLNS, "div");
>+  var name_text = document.createTextNode(printerName);
>+  name_elem.appendChild(name_text);
>+
>+  var desc_elem = document.createElementNS(XHTMLNS, "i");
>+  var desc_text = document.createTextNode(" / " + getPrinterDescription(printerName));
>+  desc_elem.style.color = "gray";
>+  desc_elem.appendChild(desc_text);
>+  
>+  name_elem.appendChild(desc_elem);
>+    
>+  return name_elem;
>+}
This is a good example of how not to style chrome.
neil@parkwaycc.co.uk wrote:
> (From update of attachment 142517 [details] [diff] [review])
> >+function buildPrinterDescription(printerName)
> >+{
> [snip]
> >+}
> This is a good example of how not to style chrome.

The other "solutions" offered all have their catch, either being non-functional
or an overkill (such as XBL... and then we need CSS... and then it turns out
that the whole mess still needs more adjustments which are beyond my power. And
if someone hacks a solution for that noone except the author him-/herself is
able to maintain that... please: NO.). 
(In reply to comment #7)
>and then we need CSS...
Just how did you think themes work? To take an example, in the Sky Pilot theme
menuitems have a gray background, so your description would be unreadable...
bug 235872 has the solution to that part of the problem.
Depends on: 235872
Comment on attachment 142517 [details] [diff] [review]
Patch for 2004-02-28-trunk

chrome is really beyond my expertise
Attachment #142517 - Flags: review?(roc)
Comment on attachment 142517 [details] [diff] [review]
Patch for 2004-02-28-trunk

db48x:
Can you review the patch and/or adjust it to use the new functionality
introduced with bug 235872, please ?
Attachment #142517 - Flags: review?(db48x)
Attachment #142517 - Flags: superreview?(roc)
Attachment #142517 - Flags: review?(db48x)
Attachment #142878 - Flags: superreview?(roc)
Attachment #142878 - Flags: review?(db48x)
Comment on attachment 142878 [details] [diff] [review]
New patch per db48x's comments (note that this patch depends on the patch in bug 235872)

>+  if ( s != "" )
>+    return s;
>+    
>+  return "-";


Just make this a 'return s'. the - looks funny all by itself.

With that minor change, and provided the sr accepts it, r=db48x
Attachment #142878 - Flags: review?(db48x) → review+
Attached patch New patch per db48x's comments (obsolete) — Splinter Review
Attachment #142878 - Attachment is obsolete: true
Attachment #142878 - Flags: superreview?(roc)
Attachment #142931 - Flags: superreview?(roc)
Comment on attachment 142931 [details] [diff] [review]
New patch per db48x's comments

will this actually work with I18N printer names? Seems like you're stuffing the
UTF8 bytes into the pref name, and then reading the pref via Javascript call to
IDL 'string', which will not translate chars >= 256 to UTF8. Right?
Attachment #142931 - Flags: superreview?(roc) → superreview+
Comment on attachment 142931 [details] [diff] [review]
New patch per db48x's comments

>-      mGlobalPrinterList->AppendString(nsString(NS_ConvertASCIItoUCS2(plist[i].name)));
>+      /* Add name to our list of printers... */
>+      mGlobalPrinterList->AppendString(nsString(NS_ConvertUTF8toUCS2(plist[i].name)));
Doesn't NS_ConvertUTF8toUCS already return an nsString?

>+    s = gPrefs.getCharPref("print.printer_" + printerName + ".printer_description")
roc's right, you'll need to use getComplexValue(prefName,
Components.interfaces.nsISupportsString).data; here.
Comment on attachment 142931 [details] [diff] [review]
New patch per db48x's comments

>+          <menulist id="printerList" flex="1" oncommand="setPrinterDefaultsForSelectedPrinter();"/>

this needs type="description", other than that it's good
Attachment #142931 - Flags: review+
Robert O'Callahan wrote:
> (From update of attachment 142931 [details] [diff] [review])
> will this actually work with I18N printer names? Seems like you're stuffing 
> the UTF8 bytes into the pref name, and then reading the pref via Javascript 
> call to IDL 'string', which will not translate chars >= 256 to UTF8. Right?

Right now the print dialog doesn't really work with non-ascii names (the
PostScript printing backend does not support then and for Xprint we have to wait
until I am done with the native charset fixes (one of my other bugs I am working
on)... if that's done I am going to fix everything which needs to be done to
make the backend and frontend "i18n-enabled" (this is beyond the scope of this
bug)).
Attached patch New patch per db48x's comments (obsolete) — Splinter Review
Attachment #142931 - Attachment is obsolete: true
Comment on attachment 149428 [details] [diff] [review]
New patch per db48x's comments

Requesting r=/sr= and checkin= from roc+moz...
Attachment #149428 - Flags: superreview?(roc)
Attachment #149428 - Flags: review?(roc)
neil@parkwaycc.co.uk wrote:
> >+    s = gPrefs.getCharPref("print.printer_" + printerName +
> ".printer_description")
> roc's right, you'll need to use getComplexValue(prefName,
> Components.interfaces.nsISupportsString).data; here.

jshin:
Is that right ?
Attachment #149428 - Attachment is obsolete: true
Attachment #149428 - Flags: superreview?(roc)
Attachment #149428 - Flags: review?(roc)
Attachment #149430 - Flags: superreview?(roc)
Attachment #149430 - Flags: review?(roc)
Attachment #149431 - Attachment is patch: false
Attachment #149431 - Attachment mime type: text/plain → image/jpeg
Attachment #149430 - Flags: superreview?(roc)
Attachment #149430 - Flags: superreview+
Attachment #149430 - Flags: review?(roc)
Attachment #149430 - Flags: review+
checked in, please mark fixed if it is
Summary: RFE: Print dialog show list printer descriptions if available → Print dialog show list printer descriptions if available
bryner:
Do you want this patch for FireFox, too ?
> bryner:
> Do you want this patch for FireFox, too ?

The dependicy bug 235872 was marked approval1.7- (since it is a feature, no real
bugfix) so we can forget the idea to include this into firefox/thunderbird...
;-((

... anyway... marking bug as FIXED.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
For the log:
Followup is bug 171809 ("Create |NS_ConvertUnicodeToNative| and
|NS_ConvertNativeToUnicode|") to add the neccesary code to make the print dialog
useable for non-ASCII text.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: