summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel/qcups.cpp
diff options
context:
space:
mode:
authorMartin Klapetek <mklapetek@kde.org>2013-09-11 21:02:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-11 21:52:50 +0200
commitea3f8ff6d0d1551a44b0c1a892470d9d48ebb858 (patch)
tree48dbfb80ee5477884d5a2b536b91d91e6f780af1 /src/printsupport/kernel/qcups.cpp
parent8a425026820cab9ea4b4e8bb05afde9f1092edd3 (diff)
Add CUPS Banner Pages options to print support
Adds a way to set standard CUPS Banner Pages. This widget is part of the Job Options widget/tab in Properties dialog. [ChangeLog][QtPrintSupport][QPrintDialog] Added support for setting CUPS Banner pages in the print dialog. Change-Id: Ia7a22b7a0f51c12d170986caee61af7109e781e9 Reviewed-by: John Layt <jlayt@kde.org>
Diffstat (limited to 'src/printsupport/kernel/qcups.cpp')
-rw-r--r--src/printsupport/kernel/qcups.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp
index 332245cc21..cf71e92e95 100644
--- a/src/printsupport/kernel/qcups.cpp
+++ b/src/printsupport/kernel/qcups.cpp
@@ -433,6 +433,63 @@ void QCUPSSupport::setJobPriority(QPrinter *printer, int priority)
setCupsOptions(printer, cupsOptions);
}
+void QCUPSSupport::setBannerPages(QPrinter *printer, const BannerPage startBannerPage, const BannerPage endBannerPage)
+{
+ QStringList cupsOptions = cupsOptionsList(printer);
+ QString startBanner, endBanner;
+
+ switch (startBannerPage) {
+ case NoBanner:
+ startBanner = QStringLiteral("none");
+ break;
+ case Standard:
+ startBanner = QStringLiteral("standard");
+ break;
+ case Unclassified:
+ startBanner = QStringLiteral("unclassified");
+ break;
+ case Confidential:
+ startBanner = QStringLiteral("confidential");
+ break;
+ case Classified:
+ startBanner = QStringLiteral("classified");
+ break;
+ case Secret:
+ startBanner = QStringLiteral("secret");
+ break;
+ case TopSecret:
+ startBanner = QStringLiteral("topsecret");
+ break;
+ }
+
+ switch (endBannerPage) {
+ case NoBanner:
+ endBanner = QStringLiteral("none");
+ break;
+ case Standard:
+ endBanner = QStringLiteral("standard");
+ break;
+ case Unclassified:
+ endBanner = QStringLiteral("unclassified");
+ break;
+ case Confidential:
+ endBanner = QStringLiteral("confidential");
+ break;
+ case Classified:
+ endBanner = QStringLiteral("classified");
+ break;
+ case Secret:
+ endBanner = QStringLiteral("secret");
+ break;
+ case TopSecret:
+ endBanner = QStringLiteral("topsecret");
+ break;
+ }
+
+ setCupsOption(cupsOptions, QStringLiteral("job-sheets"), startBanner + QLatin1Char(',') + endBanner);
+ setCupsOptions(printer, cupsOptions);
+}
+
bool QCUPSSupport::printerHasPPD(const char *printerName)
{
if (!isAvailable())