summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-11-29 15:54:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 19:33:50 +0100
commit27473f19bb26b5b4434689c663d483e48b43fdef (patch)
tree7bc04d3d93a779759cc47d25d03f30021543b43e /src
parent053bee8b80f4f987718c6633b831a58eb231b599 (diff)
QPrintEngine - Fix PPK_DocumentName
Add support to the Mac print engine for set/get the Document Name using the Job Name setting. Our documentation states this is one use that the document name will be put to so is appropriate to be used. Change the Windows print engine to default to a blank Docuemnt Name consistent with the other print engines. If still blank when printing then use a default value. Task-number: QTBUG-27724 Task-number: QTBUG-22144 Change-Id: If590811b5720e6f759eabc290b578b94e221f9f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm17
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp6
2 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index dd2bd718f6..170eccdd1b 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -615,9 +615,6 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
break;
case PPK_CustomBase:
break;
- case PPK_DocumentName:
- // TODO Add support using PMPrintSettingsSetJobName / PMPrintSettingsGetJobName
- break;
case PPK_Duplex:
// TODO Add support using PMSetDuplex / PMGetDuplex
break;
@@ -665,7 +662,9 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
PMSessionValidatePageFormat(d->session(), d->format(), kPMDontWantBoolean);
break;
}
-
+ case PPK_DocumentName:
+ PMPrintSettingsSetJobName(d->settings(), QCFString(value.toString()));
+ break;
case PPK_FullPage:
d->fullPage = value.toBool();
break;
@@ -770,10 +769,6 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_CustomBase:
// Special case, leave null
break;
- case PPK_DocumentName:
- // TODO Add support using PMPrintSettingsSetJobName / PMPrintSettingsGetJobName
- ret = QString();
- break;
case PPK_Duplex:
// TODO Add support using PMSetDuplex / PMGetDuplex
ret = QPrinter::DuplexNone;
@@ -807,6 +802,12 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
break;
// The following keys are properties and settings that are supported by the Mac PrintEngine
+ case PPK_DocumentName: {
+ CFStringRef name;
+ PMPrintSettingsGetJobName(d->settings(), &name);
+ ret = QCFString::toQString(name);
+ break;
+ }
case PPK_FullPage:
ret = d->fullPage;
break;
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index d36b7b87c1..34f3106313 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -237,7 +237,6 @@ QWin32PrintEngine::QWin32PrintEngine(QPrinter::PrinterMode mode)
| PaintOutsidePaintEvent))
{
Q_D(QWin32PrintEngine);
- d->docName = QLatin1String("document1");
d->mode = mode;
d->queryDefault();
d->initialize();
@@ -272,7 +271,10 @@ bool QWin32PrintEngine::begin(QPaintDevice *pdev)
DOCINFO di;
memset(&di, 0, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);
- di.lpszDocName = reinterpret_cast<const wchar_t *>(d->docName.utf16());
+ if (d->docName.isEmpty())
+ di.lpszDocName = L"document1";
+ else
+ di.lpszDocName = reinterpret_cast<const wchar_t *>(d->docName.utf16());
if (d->printToFile && !d->fileName.isEmpty())
di.lpszOutput = reinterpret_cast<const wchar_t *>(d->fileName.utf16());
if (ok && StartDoc(d->hdc, &di) == SP_ERROR) {