diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2018-02-14 10:48:01 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2018-03-27 12:02:37 +0000 |
commit | 09f3b19f989d83e01bd53f512b928550ee81ec2c (patch) | |
tree | 323334ff1e6d643d87b038268634830c24a4bde6 /src/plugins | |
parent | 0fb3d2177867524310eb744dd97fc5e370b0fd11 (diff) |
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 <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/printsupport/cups/qppdprintdevice.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
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 |