Validate printer duplex mode

Disable unavailable duplex options
Remove redundant option on advanced tab

Change-Id: Ie09c9ffd637b521210e3d7d4f15300792f910996
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
This commit is contained in:
Renato Araujo Oliveira Filho 2017-12-20 16:51:37 -03:00 committed by Albert Astals Cid
parent ca4a76350a
commit f6fd3f18d3

View File

@ -520,6 +520,11 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma
QPrinter *p = q->printer();
printerOutputFormat = outputFormat;
// printer supports duplex mode?
const auto supportedDuplexMode = top->d->m_currentPrintDevice.supportedDuplexModes();
options.duplexLong->setEnabled(supportedDuplexMode.contains(QPrint::DuplexLongSide));
options.duplexShort->setEnabled(supportedDuplexMode.contains(QPrint::DuplexShortSide));
if (p->colorMode() == QPrinter::Color)
options.color->setChecked(true);
else
@ -1319,7 +1324,8 @@ static bool isBlacklistedOption(const char *keyword) Q_DECL_NOTHROW
"Copies",
"OutputOrder",
"PageRegion",
"PageSize"
"PageSize",
"Duplex" // handled by the main dialog
};
auto equals = [](const char *keyword) {
return [keyword](const char *candidate) {