From: Michael Sweet Date: Thu, 9 Mar 2017 20:04:39 +0000 (-0500) Subject: Update MediaType code to list all media-type-supported values, regardless of X-Git-Tag: v2.2.3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ae6282d0e898df47efa334d2c97b3f7db181a3d;p=thirdparty%2Fcups.git Update MediaType code to list all media-type-supported values, regardless of whether they are standard names (Issue #4953) Also add HP mis-spelling of 'photographic' ('photo'). --- diff --git a/CHANGES.txt b/CHANGES.txt index db5f39574f..19500ba446 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,6 +13,8 @@ CHANGES IN CUPS V2.2.3 or type (Issue #4963) - IPP Everywhere print queues did not always support all print qualities supported by the printer (Issue #4953) + - IPP Everywhere print queues did not always support all media types + supported by the printer (Issue #4953) - Fixed some localization issues on macOS () diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c index d14bc25ca8..0ec877451c 100644 --- a/cups/ppd-cache.c +++ b/cups/ppd-cache.c @@ -3595,6 +3595,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ { "multi-part-form", _("Multi Part Form") }, { "other", _("Other") }, { "paper", _("Paper") }, + { "photo", _("Photo Paper") }, /* HP mis-spelling */ { "photographic", _("Photo Paper") }, { "photographic-archival", _("Photographic Archival") }, { "photographic-film", _("Photo Film") }, @@ -3646,14 +3647,20 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ cupsFilePrintf(fp, "*OpenUI *MediaType: PickOne\n" "*OrderDependency: 10 AnySetup *MediaType\n" "*DefaultMediaType: %s\n", ppdname); - for (i = 0; i < (int)(sizeof(media_types) / sizeof(media_types[0])); i ++) + for (i = 0; i < count; i ++) { - if (!ippContainsString(attr, media_types[i][0])) - continue; + const char *keyword = ippGetString(attr, i, NULL); - pwg_ppdize_name(media_types[i][0], ppdname, sizeof(ppdname)); + pwg_ppdize_name(keyword, ppdname, sizeof(ppdname)); - cupsFilePrintf(fp, "*MediaType %s/%s: \"<>setpagedevice\"\n", ppdname, _cupsLangString(lang, media_types[i][1]), ppdname); + for (j = 0; j < (int)(sizeof(media_types) / sizeof(media_types[0])); j ++) + if (!strcmp(keyword, media_types[i][0])) + break; + + if (j < (int)(sizeof(media_types) / sizeof(media_types[0]))) + cupsFilePrintf(fp, "*MediaType %s/%s: \"<>setpagedevice\"\n", ppdname, _cupsLangString(lang, media_types[j][1]), ppdname); + else + cupsFilePrintf(fp, "*MediaType %s/%s: \"<>setpagedevice\"\n", ppdname, keyword, ppdname); } cupsFilePuts(fp, "*CloseUI: *MediaType\n"); }