]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add media-col-ready and media-ready.
authorMichael R Sweet <msweet@msweet.org>
Mon, 8 Mar 2021 00:58:57 +0000 (19:58 -0500)
committerMichael R Sweet <msweet@msweet.org>
Mon, 8 Mar 2021 00:58:57 +0000 (19:58 -0500)
scheduler/printers.c

index 4f5b60e2999af76025612ba98f77c55e339ec0c3..e88574177e873fddb96bebe8e041d34aa6f47a85 100644 (file)
@@ -3882,6 +3882,9 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
                margins[16];            /* media-*-margin-supported values */
   const char   *filter,                /* Current filter */
                *mandatory;             /* Current mandatory attribute */
+  const char   *ready_size;            /* Current ReadyPaperSizes value */
+  ipp_attribute_t *media_col_ready,    /* media-col-ready attribute */
+               *media_ready;           /* media-ready attribute */
   int          num_urf;                /* Number of urf-supported values */
   const char   *urf[16];               /* urf-supported values */
   char         urf_rs[32];             /* RS (resolution) value */
@@ -4352,6 +4355,36 @@ load_ppd(cupsd_printer_t *p)             /* I - Printer */
          ippDelete(col);
        }
       }
+
+     /*
+      * media[-col]-ready
+      */
+
+      for (media_col_ready = NULL, media_ready = NULL, ready_size = (char *)cupsArrayFirst(ReadyPaperSizes); ready_size; ready_size = (char *)cupsArrayNext(ReadyPaperSizes))
+      {
+        for (i = p->pc->num_sizes, pwgsize = p->pc->sizes; i > 0; i --, pwgsize --)
+        {
+          if (!strcasecmp(ready_size, pwgsize->map.ppd))
+            break;
+        }
+
+        if (i)
+        {
+          ipp_t *col = new_media_col(pwgsize);
+
+         if (media_ready)
+           ippSetString(p->ppd_attrs, &media_ready, ippGetCount(media_ready), pwgsize->map.pwg);
+         else
+           media_ready = ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "media-ready", NULL, pwgsize->map.pwg);
+
+         if (media_col_ready)
+           ippSetCollection(p->ppd_attrs, &media_col_ready, ippGetCount(media_col_ready), col);
+         else
+           media_col_ready = ippAddCollection(p->ppd_attrs, IPP_TAG_PRINTER, "media-col-ready", col);
+
+         ippDelete(col);
+        }
+      }
     }
 
     ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_TEXT), "mopria-certified", NULL, "1.3");