summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qprintengine_mac.mm
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2012-05-14 20:27:21 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-23 23:55:43 +0200
commitf3ad57e90ecc33f3d4de7bf8d612abc0ccb2fb6e (patch)
tree5fe5fae79d664224376938c4c9405a5652495d82 /src/plugins/platforms/cocoa/qprintengine_mac.mm
parente9d20b1951657ace845f730df3c924ddadcf15af (diff)
QtPrintSupport - Fix Mac printerName() use
Mac in Qt4 and 5 has been using the PMPrinter Name for the QPrinter and QPrinterInfo printerName() value, but this is incorrect. This is in fact the CUPS Description field, is in human readable form and is not guaranteed to be unique. The CUPS Name field is the PMPrinter ID value and should be used as the unique identifier when accessing printers. This has worked up to now due to an undocumented feature in the OSX api that accepted the Name when the ID should be used. Changing all uses of PMPrinterGetName to PMPrinterGetID fixes this and allows the QPrinterInfo test of names to pass without munging the names. Change-Id: I25322aa1a924bed9f67f4ad5e208274c8b700e17 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: John Layt <jlayt@kde.org>
Diffstat (limited to 'src/plugins/platforms/cocoa/qprintengine_mac.mm')
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index 921dd2f78f..7921832555 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -626,7 +626,7 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
CFIndex count = CFArrayGetCount(printerList);
for (CFIndex i=0; i<count; ++i) {
PMPrinter printer = static_cast<PMPrinter>(const_cast<void *>(CFArrayGetValueAtIndex(printerList, i)));
- QString name = QCFString::toQString(PMPrinterGetName(printer));
+ QString name = QCFString::toQString(PMPrinterGetID(printer));
if (name == value.toString()) {
status = PMSessionSetCurrentPMPrinter(d->session(), printer);
printerNameSet = true;
@@ -777,7 +777,7 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
if (status != noErr)
qWarning("QMacPrintEngine::printerName: Failed getting current PMPrinter: %ld", long(status));
if (printer)
- ret = QCFString::toQString(PMPrinterGetName(printer));
+ ret = QCFString::toQString(PMPrinterGetID(printer));
break; }
case PPK_Resolution: {
ret = d->resolution.hRes;