If the default CUPS printer has no ppd file, just use the first

printer that has one as Windows default printer.
Support PRINTER_ENUM_CONNECTIONS in the default way.
This commit is contained in:
Marcus Meissner 2002-09-09 19:19:18 +00:00 committed by Alexandre Julliard
parent 921eef3bde
commit 75e4e943e6
1 changed files with 19 additions and 0 deletions

View File

@ -131,6 +131,11 @@ CUPS_LoadPrinters(void) {
if (!ppd) {
WARN("No ppd file for %s.\n",printers[i]);
/* If this was going to be the default printer,
* forget it and use another one.
*/
if (def && !strcmp(def,printers[i]))
def = NULL;
continue;
}
unlink(ppd);
@ -139,6 +144,14 @@ CUPS_LoadPrinters(void) {
if (def && !strcmp(def,printers[i]))
WINSPOOL_SetDefaultPrinter(printers[i],printers[i],FALSE);
/* The default printer has no PPD file, just use the first one
* which has one.
*/
if (!def) {
WINSPOOL_SetDefaultPrinter(printers[i],printers[i],FALSE);
def = printers[i];
}
memset(&pinfo2a,0,sizeof(pinfo2a));
pinfo2a.pPrinterName = printers[i];
pinfo2a.pDatatype = "RAW";
@ -1866,6 +1879,12 @@ static BOOL WINSPOOL_EnumPrinters(DWORD dwType, LPWSTR lpszName,
if(dwType == PRINTER_ENUM_DEFAULT)
return TRUE;
if (dwType & PRINTER_ENUM_CONNECTIONS) {
FIXME("We dont handle PRINTER_ENUM_CONNECTIONS\n");
dwType &= ~PRINTER_ENUM_CONNECTIONS; /* we dont handle that */
dwType |= PRINTER_ENUM_LOCAL;
}
if (!((dwType & PRINTER_ENUM_LOCAL) || (dwType & PRINTER_ENUM_NAME))) {
FIXME("dwType = %08lx\n", dwType);
SetLastError(ERROR_INVALID_FLAGS);