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>
bb10
Albert Astals Cid 2018-02-14 10:48:01 +01:00
parent 0fb3d21778
commit 09f3b19f98
1 changed files with 7 additions and 3 deletions

View File

@ -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