]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
First half of the changes for Issue #4960, Issue #4961, and Issue #4962 - add
authorMichael Sweet <michael.r.sweet@gmail.com>
Wed, 8 Mar 2017 21:07:09 +0000 (16:07 -0500)
committerMichael Sweet <michael.r.sweet@gmail.com>
Wed, 8 Mar 2017 21:07:09 +0000 (16:07 -0500)
a cupsIPPFinishings mapping for standard/common keywords when cupsIPPFinishings
is not specified in the PPD file (as it should be for CUPS drivers).

CHANGES.txt
cups/ppd-cache.c
doc/help/man-client.conf.html
doc/help/man-cups-files.conf.html
doc/help/man-cups-lpd.html
doc/help/man-cups-snmp.html
doc/help/man-cupsaddsmb.html
doc/help/man-cupsd.conf.html
doc/help/man-cupsd.html
doc/help/man-lpoptions.html
scheduler/printers.c

index b9cb71f407630cc7fe50afb9d3b7883dd30851c8..999dcf269f5c0ac32b8c1dfbb3db2308b0500369 100644 (file)
@@ -7,6 +7,8 @@ CHANGES IN CUPS V2.2.3
          causing a hung queue (<rdar://problem/28008717>)
        - The scheduler could pause responding to client requests in order to
          save state changes to disk (<rdar://problem/28690656>)
+       - Added support for PPD finishing keywords (Issue #4960, Issue #4961,
+         Issue #4962)
        - Fixed some localization issues on macOS (<rdar://problem/27245567>)
 
 
index e8b05e43a4f575d47cddccc274a51775631b3abd..163e18c9377cb5ca16862f2706479594ccddce0c 100644 (file)
@@ -32,6 +32,7 @@
  * Local functions...
  */
 
+static void    pwg_add_finishing(cups_array_t *finishings, ipp_finishings_t template, const char *name, const char *value);
 static int     pwg_compare_finishings(_pwg_finishings_t *a,
                                       _pwg_finishings_t *b);
 static void    pwg_free_finishings(_pwg_finishings_t *f);
@@ -1714,6 +1715,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)  /* I - PPD file */
 
   if ((ppd_attr = ppdFindAttr(ppd, "cupsIPPFinishings", NULL)) != NULL)
   {
+   /*
+    * Have proper vendor mapping of IPP finishings values to PPD options...
+    */
+
     pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings,
                                    NULL, NULL, 0, NULL,
                                    (cups_afree_func_t)pwg_free_finishings);
@@ -1733,6 +1738,114 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
     while ((ppd_attr = ppdFindNextAttr(ppd, "cupsIPPFinishings",
                                        NULL)) != NULL);
   }
+  else
+  {
+   /*
+    * No IPP mapping data, try to map common/standard PPD keywords...
+    */
+
+    ppd_option_t       *ppd_option;    /* PPD option */
+
+    pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings, NULL, NULL, 0, NULL, (cups_afree_func_t)pwg_free_finishings);
+
+    if ((ppd_option = ppdFindOption(ppd, "StapleLocation")) != NULL)
+    {
+     /*
+      * Add staple finishings...
+      */
+
+      if (ppdFindChoice(ppd_option, "SinglePortrait"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "SinglePortrait");
+      if (ppdFindChoice(ppd_option, "UpperLeft")) /* Ricoh extension */
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "UpperLeft");
+      if (ppdFindChoice(ppd_option, "UpperRight")) /* Ricoh extension */
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_RIGHT, "StapleLocation", "UpperRight");
+      if (ppdFindChoice(ppd_option, "SingleLandscape"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, "StapleLocation", "SingleLandscape");
+      if (ppdFindChoice(ppd_option, "DualLandscape"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_DUAL_LEFT, "StapleLocation", "DualLandscape");
+    }
+
+    if ((ppd_option = ppdFindOption(ppd, "RIPunch")) != NULL)
+    {
+     /*
+      * Add (Ricoh) punch finishings...
+      */
+
+      if (ppdFindChoice(ppd_option, "Left2"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_LEFT, "RIPunch", "Left2");
+      if (ppdFindChoice(ppd_option, "Left3"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_LEFT, "RIPunch", "Left3");
+      if (ppdFindChoice(ppd_option, "Left4"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_LEFT, "RIPunch", "Left4");
+      if (ppdFindChoice(ppd_option, "Right2"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_RIGHT, "RIPunch", "Right2");
+      if (ppdFindChoice(ppd_option, "Right3"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_RIGHT, "RIPunch", "Right3");
+      if (ppdFindChoice(ppd_option, "Right4"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_RIGHT, "RIPunch", "Right4");
+      if (ppdFindChoice(ppd_option, "Upper2"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_TOP, "RIPunch", "Upper2");
+      if (ppdFindChoice(ppd_option, "Upper3"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_TOP, "RIPunch", "Upper3");
+      if (ppdFindChoice(ppd_option, "Upper4"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_TOP, "RIPunch", "Upper4");
+    }
+
+    if ((ppd_option = ppdFindOption(ppd, "BindEdge")) != NULL)
+    {
+     /*
+      * Add bind finishings...
+      */
+
+      if (ppdFindChoice(ppd_option, "Left"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_LEFT, "BindEdge", "Left");
+      if (ppdFindChoice(ppd_option, "Right"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_RIGHT, "BindEdge", "Right");
+      if (ppdFindChoice(ppd_option, "Top"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_TOP, "BindEdge", "Top");
+      if (ppdFindChoice(ppd_option, "Bottom"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_BOTTOM, "BindEdge", "Bottom");
+    }
+
+    if ((ppd_option = ppdFindOption(ppd, "FoldType")) != NULL)
+    {
+     /*
+      * Add (Adobe) fold finishings...
+      */
+
+      if (ppdFindChoice(ppd_option, "ZFold"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_Z, "FoldType", "ZFold");
+      if (ppdFindChoice(ppd_option, "Saddle"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_HALF, "FoldType", "Saddle");
+      if (ppdFindChoice(ppd_option, "DoubleGate"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_DOUBLE_GATE, "FoldType", "DoubleGate");
+      if (ppdFindChoice(ppd_option, "LeftGate"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LEFT_GATE, "FoldType", "LeftGate");
+      if (ppdFindChoice(ppd_option, "RightGate"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_RIGHT_GATE, "FoldType", "RightGate");
+      if (ppdFindChoice(ppd_option, "Letter"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "FoldType", "Letter");
+      if (ppdFindChoice(ppd_option, "XFold"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_POSTER, "FoldType", "XFold");
+    }
+
+    if ((ppd_option = ppdFindOption(ppd, "RIFoldType")) != NULL)
+    {
+     /*
+      * Add (Ricoh) fold finishings...
+      */
+
+      if (ppdFindChoice(ppd_option, "OutsideTwoFold"))
+        pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "RIFoldType", "OutsideTwoFold");
+    }
+
+    if (cupsArrayCount(pc->finishings) == 0)
+    {
+      cupsArrayDelete(pc->finishings);
+      pc->finishings = NULL;
+    }
+  }
 
  /*
   * Max copies...
@@ -4094,11 +4207,35 @@ _pwgPageSizeForMedia(
 }
 
 
+/*
+ * 'pwg_add_finishing()' - Add a finishings value.
+ */
+
+static void
+pwg_add_finishing(
+    cups_array_t     *finishings,      /* I - Finishings array */
+    ipp_finishings_t template,         /* I - Finishing template */
+    const char       *name,            /* I - PPD option */
+    const char       *value)           /* I - PPD choice */
+{
+  _pwg_finishings_t    *f;             /* New finishings value */
+
+
+  if ((f = (_pwg_finishings_t *)calloc(1, sizeof(_pwg_finishings_t))) != NULL)
+  {
+    f->value       = template;
+    f->num_options = cupsAddOption(name, value, 0, &f->options);
+
+    cupsArrayAdd(finishings, f);
+  }
+}
+
+
 /*
  * 'pwg_compare_finishings()' - Compare two finishings values.
  */
 
-static int                             /* O- Result of comparison */
+static int                             /* O - Result of comparison */
 pwg_compare_finishings(
     _pwg_finishings_t *a,              /* I - First finishings value */
     _pwg_finishings_t *b)              /* I - Second finishings value */
index 0fef0d479228c6d0d1283899df9d1ded6d49a3d7..6febe5e32736506daccade08ef2784cedfd7c11d 100644 (file)
@@ -76,7 +76,7 @@ On Linux and other systems using GNU TLS, the <i>/etc/cups/ssl/site.crl</i> file
 <b>default</b>(1),
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index 046a642ea5cebd53e515932be5611f00721ebd48..7dfcd211db6be775a0ee0b20594483a69229b70a 100644 (file)
@@ -164,7 +164,7 @@ The default is "lp".
 <a href="man-subscriptions.conf.html?TOPIC=Man+Pages"><b>subscriptions.conf</b>(5),</a>
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index e7b4fb9cf43a0451a9299cc8de724d38c18702ba..7a6b6396dca1621d9024f3df40af9c2deae927bf 100644 (file)
@@ -108,7 +108,7 @@ service using the corresponding control program.
 CUPS Online Help (<a href="http://localhost:631/help)">http://localhost:631/help)</a>,
 RFC 2569
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index 54601472634f221e56b0420a7ab54192dd0723a5..9baf07065a0ce8c1ee8715486012e7410b2a3d0f 100644 (file)
@@ -48,7 +48,7 @@ The CUPS SNMP backend uses the information from the Host, Printer, and Port Moni
 <a href="man-lpinfo.html?TOPIC=Man+Pages"><b>lpinfo</b>(8),</a>
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index 14c0e0130e19f9d05d63a7010ff8d6cfbc831961..454174ee2a67d47c9a3c3506711be2e6d0578747 100644 (file)
@@ -115,7 +115,7 @@ This is useful for debugging SAMBA configuration problems.
 <b>smb.conf</b>(5),
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index 85e601edfdf0428d26d1fa62791c795e95e2e0a2..2fae0b7f9dce86f5bddc39c610d8cbe8c03e47d9 100644 (file)
@@ -596,7 +596,7 @@ Require authentication for accesses from outside the 10. network:
 <a href="man-subscriptions.conf.html?TOPIC=Man+Pages"><b>subscriptions.conf</b>(5),</a>
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index e10961b01173256b14c3303b77517d2f22212fb4..0094851287896289032557fcfc7279d2cc4ecf8a 100644 (file)
@@ -117,7 +117,7 @@ in the foreground with a test configuration file called
 <b>systemd</b>(8),
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index e4eaf714e857e74c87c86f70bc8cac49dbc47c83..20c5782856012c6ac7c8f94472368f088c38b404 100644 (file)
@@ -119,7 +119,7 @@ The <b>lpoptions</b> command is unique to CUPS.
 <a href="man-lprm.html?TOPIC=Man+Pages"><b>lprm</b>(1),</a>
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
 
 </body>
 </html>
index 63ca80d6769a20640b249f0878915a3d3695f419..985f86622759945801f3550cb79e86d4c193a3cd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Printer routines for the CUPS scheduler.
  *
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -4584,6 +4584,7 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
     if (ppdFindOption(ppd, "Collate") != NULL)
       p->type |= CUPS_PRINTER_COLLATE;
 
+    /* TODO: look at finishings array for values */
     if (ppdFindOption(ppd, "StapleLocation") != NULL)
     {
       p->type |= CUPS_PRINTER_STAPLE;