summaryrefslogtreecommitdiffstats
path: root/src/plugins/printsupport/cups
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2014-03-17 17:59:55 +0100
committerAndy Shaw <andy.shaw@digia.com>2014-10-24 21:34:21 +0200
commit74a51d590f4acd189f8d0594a5a706cbf97c805b (patch)
tree7be62ff9cdf58e36851576f0a79493f2943abc0b /src/plugins/printsupport/cups
parentddf3fc0deb906ee591fc01ecc2a74768a49950f8 (diff)
QPrinter - Fix DuplexMode on all platforms
Add support to get/set the DuplexMode on Windows and Mac, improve the CUPS duplex handling, ensure support is the same on all platforms. [ChangeLog][QtPrintSupport][QPrinter] Added duplex support for Windows and OS X. Task-number: QTBUG-11332 Change-Id: I9d61d63233d828c3b1fd6df54072c6049f3c6298 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/plugins/printsupport/cups')
-rw-r--r--src/plugins/printsupport/cups/qcupsprintengine.cpp6
-rw-r--r--src/plugins/printsupport/cups/qppdprintdevice.cpp3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp
index 724ff5b98b..d7cd18f1d1 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp
@@ -85,6 +85,12 @@ void QCupsPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &v
// Get the named page size from the printer if supported
d->setPageSize(d->m_printDevice.supportedPageSize(value.toString()));
break;
+ case PPK_Duplex: {
+ QPrint::DuplexMode mode = QPrint::DuplexMode(value.toInt());
+ if (mode != d->duplex && d->m_printDevice.supportedDuplexModes().contains(mode))
+ d->duplex = mode;
+ break;
+ }
case PPK_PrinterName:
d->changePrinter(value.toString());
break;
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp
index 75e8a8bf26..7a6acf8b78 100644
--- a/src/plugins/printsupport/cups/qppdprintdevice.cpp
+++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp
@@ -387,6 +387,9 @@ void QPpdPrintDevice::loadDuplexModes() const
// If still no result, or not added in PPD, then add None
if (m_duplexModes.size() == 0 || !m_duplexModes.contains(QPrint::DuplexNone))
m_duplexModes.append(QPrint::DuplexNone);
+ // If have both modes, then can support DuplexAuto
+ if (m_duplexModes.contains(QPrint::DuplexLongSide) && m_duplexModes.contains(QPrint::DuplexShortSide))
+ m_duplexModes.append(QPrint::DuplexAuto);
m_haveDuplexModes = true;
}