bug 235763 Print dialog show list printer descriptions if available

patch by Roland Mainz <roland.mainz@nrubsig.org> r+sr=roc
This commit is contained in:
cbiesinger%web.de 2006-02-07 01:14:54 +00:00
Родитель 67c419f59c
Коммит a3393d8b9b
1 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -1034,6 +1034,11 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
if (!mGlobalPrinterList)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv;
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
#ifdef USE_XPRINT
XPPrinterList plist = XpuGetPrinterList(nsnull, &mGlobalNumPrinters);
@ -1042,7 +1047,11 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
int i;
for( i = 0 ; i < mGlobalNumPrinters ; i++ )
{
mGlobalPrinterList->AppendString(nsString(NS_ConvertASCIItoUCS2(plist[i].name)));
/* Add name to our list of printers... */
mGlobalPrinterList->AppendString(nsString(NS_ConvertUTF8toUCS2(plist[i].name)));
/* ... and store the description text for this printer */
pPrefs->SetCharPref(nsPrintfCString(256, "print.printer_%s.printer_description", plist[i].name).get(), plist[i].desc);
}
XpuFreePrinterList(plist);
@ -1050,7 +1059,6 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
#endif /* USE_XPRINT */
#ifdef USE_POSTSCRIPT
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID);
PRBool psPrintModuleEnabled = PR_TRUE;
const char *val = PR_GetEnv("MOZILLA_POSTSCRIPT_ENABLED");
@ -1060,12 +1068,10 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
}
else
{
if (pPrefs) {
if (NS_FAILED(pPrefs->GetBoolPref("print.postscript.enabled", &psPrintModuleEnabled))) {
psPrintModuleEnabled = PR_TRUE;
}
}
}
if (psPrintModuleEnabled) {
/* Get the list of PostScript-module printers */
@ -1076,10 +1082,8 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
printerList = PR_GetEnv("MOZILLA_POSTSCRIPT_PRINTER_LIST");
if (!printerList) {
if (pPrefs) {
(void) pPrefs->CopyCharPref("print.printer_list", &printerList);
}
}
if (printerList) {
char *tok_lasts;