From 09f3b19f989d83e01bd53f512b928550ee81ec2c Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 14 Feb 2018 10:48:01 +0100 Subject: cups: Honor installable options for Duplex i.e. don't show the duplex options if you don't have the duplexer hardware installed, otherwise you just get a conflict warning selecting any duplex option which doesn't make any sense since it's not something you can fix by other means than going out and buying the missing hardware Change-Id: Ief3fea5b86ab65b18765887b1c5d6d279ee337fa Reviewed-by: Andy Shaw --- src/plugins/printsupport/cups/qppdprintdevice.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp index b91dbbe64c..94d73288a4 100644 --- a/src/plugins/printsupport/cups/qppdprintdevice.cpp +++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp @@ -352,14 +352,18 @@ void QPpdPrintDevice::loadDuplexModes() const ppd_option_t *duplexModes = ppdFindOption(m_ppd, "Duplex"); if (duplexModes) { m_duplexModes.reserve(duplexModes->num_choices); - for (int i = 0; i < duplexModes->num_choices; ++i) - m_duplexModes.append(QPrintUtils::ppdChoiceToDuplexMode(duplexModes->choices[i].choice)); + for (int i = 0; i < duplexModes->num_choices; ++i) { + if (ppdInstallableConflict(m_ppd, duplexModes->keyword, duplexModes->choices[i].choice) == 0) { + m_duplexModes.append(QPrintUtils::ppdChoiceToDuplexMode(duplexModes->choices[i].choice)); + } + } } // If no result, try just the default if (m_duplexModes.size() == 0) { duplexModes = ppdFindOption(m_ppd, "DefaultDuplex"); - if (duplexModes) + if (duplexModes && (ppdInstallableConflict(m_ppd, duplexModes->keyword, duplexModes->choices[0].choice) == 0)) { m_duplexModes.append(QPrintUtils::ppdChoiceToDuplexMode(duplexModes->choices[0].choice)); + } } } // If still no result, or not added in PPD, then add None -- cgit v1.2.3