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));
printer->setOutputFileName(QString::fromUtf8(reinterpret_cast<const char *>(localFile)));
} else {
// Keep output format.
QPrinter::OutputFormat format;
format = printer->outputFormat();
printer->setOutputFileName(QString());
printer->setOutputFormat(format);
PMPrinter macPrinter;
PMSessionGetCurrentPrinter(session, &macPrinter);
QString printerId = QString::fromCFString(PMPrinterGetID(macPrinter));
if (printer->printerName() != printerId)
printer->setPrinterName(printerId);
}
}