QPrintDialog - Fix mac change of printer name

If the user changes the printer name in the Mac print dialog then
update the print device in QPrint to reflect this.

Task-number: QTBUG-37808
Change-Id: I3aaf27e2db7277ab083dc8f8d59f0f80ecd424f1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
John Layt 2014-04-16 15:47:14 +01:00 committed by The Qt Project
parent 6e26bd5fa2
commit 4e4b2d6701

View File

@ -143,11 +143,11 @@ QT_USE_NAMESPACE
CFURLGetFileSystemRepresentation(file, true, localFile, sizeof(localFile)); CFURLGetFileSystemRepresentation(file, true, localFile, sizeof(localFile));
printer->setOutputFileName(QString::fromUtf8(reinterpret_cast<const char *>(localFile))); printer->setOutputFileName(QString::fromUtf8(reinterpret_cast<const char *>(localFile)));
} else { } else {
// Keep output format. PMPrinter macPrinter;
QPrinter::OutputFormat format; PMSessionGetCurrentPrinter(session, &macPrinter);
format = printer->outputFormat(); QString printerId = QString::fromCFString(PMPrinterGetID(macPrinter));
printer->setOutputFileName(QString()); if (printer->printerName() != printerId)
printer->setOutputFormat(format); printer->setPrinterName(printerId);
} }
} }