summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2014-01-17 16:16:31 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 19:33:59 +0100
commit27c33a8f7a9469fd8b55de62b11e0b6b868636c5 (patch)
tree6b599ed8d6177c34edd73359256550730ae4bc9c /src
parent0ee72b09fd99b756a85de78bafb03c7dee163ef5 (diff)
QPrintEngne - Fix PPK_Creator
Add support to the Mac and Windows print engines to preserve the creator name when switching between native and pdf format. Change-Id: Ie036af3140f24d8e34aa886f091384f93aa0157b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm12
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac_p.h1
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp14
-rw-r--r--src/printsupport/kernel/qprintengine_win_p.h1
4 files changed, 16 insertions, 12 deletions
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index b11afc745e..48af06ec02 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -607,9 +607,6 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
// The following keys are settings that are unsupported by the Mac PrintEngine
case PPK_ColorMode:
break;
- case PPK_Creator:
- // TODO Add value preservation support by using local variable
- break;
case PPK_CustomBase:
break;
case PPK_Duplex:
@@ -662,6 +659,9 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
case PPK_CollateCopies:
PMSetCollate(d->settings(), value.toBool());
break;
+ case PPK_Creator:
+ d->m_creator = value.toString();
+ break;
case PPK_DocumentName:
PMPrintSettingsSetJobName(d->settings(), QCFString(value.toString()));
break;
@@ -759,9 +759,6 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_ColorMode:
ret = QPrinter::Color;
break;
- case PPK_Creator:
- ret = QString();
- break;
case PPK_CustomBase:
// Special case, leave null
break;
@@ -804,6 +801,9 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
ret = bool(status);
break;
}
+ case PPK_Creator:
+ ret = d->m_creator;
+ break;
case PPK_DocumentName: {
CFStringRef name;
PMPrintSettingsGetJobName(d->settings(), &name);
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac_p.h b/src/plugins/platforms/cocoa/qprintengine_mac_p.h
index 644a07184f..e3a8520811 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac_p.h
+++ b/src/plugins/platforms/cocoa/qprintengine_mac_p.h
@@ -125,6 +125,7 @@ public:
NSPrintInfo *printInfo;
PMResolution resolution;
QString outputFilename;
+ QString m_creator;
bool fullPage;
QPaintEngine *paintEngine;
bool hasCustomPaperSize;
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index d48c1a730d..958e4a0989 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1290,9 +1290,6 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
break;
// The following keys are settings that are unsupported by the Windows PrintEngine
- case PPK_Creator:
- // TODO Add value preservation support by using local variable
- break;
case PPK_CustomBase:
break;
case PPK_Duplex:
@@ -1326,6 +1323,10 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
}
break;
+ case PPK_Creator:
+ d->m_creator = value.toString();
+ break;
+
case PPK_DocumentName:
if (isActive()) {
qWarning("QWin32PrintEngine: Cannot change document name while printing is active");
@@ -1505,9 +1506,6 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
// The following keys are settings that are unsupported by the Windows PrintEngine
// Return sensible default values to ensure consistent behavior across platforms
- case PPK_Creator:
- value = QString();
- break;
case PPK_Duplex:
// TODO Add support using DEVMODE.dmDuplex
value = QPrinter::DuplexNone;
@@ -1540,6 +1538,10 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
}
break;
+ case PPK_Creator:
+ value = d->m_creator;
+ break;
+
case PPK_DocumentName:
value = d->docName;
break;
diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h
index 93fe993088..040140d50f 100644
--- a/src/printsupport/kernel/qprintengine_win_p.h
+++ b/src/printsupport/kernel/qprintengine_win_p.h
@@ -210,6 +210,7 @@ public:
// Document info
QString docName;
+ QString m_creator;
QString fileName;
QPrinter::PrinterState state;