1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/0010-CUPS-Use-printer-job-billing-as-default-instead-of-the-empty-string.patch

63 lines
2.6 KiB
Diff
Raw Normal View History

From 2831fa76655c614ed3df0816401514950e79b5e6 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <albert.astals.cid@kdab.com>
Date: Wed, 6 Dec 2017 12:00:00 +0100
Subject: [PATCH] CUPS: Use printer job-billing as default instead of the empty
string
This also reads the job-billing from lpoptions if set there for the particular printer
Change-Id: Ia4a6961de504005b8dcd9209da0624e9ae9ef7e4
Reviewed-by: Laurent Montel <laurent.montel@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
---
src/plugins/printsupport/cups/qppdprintdevice.cpp | 2 ++
src/printsupport/kernel/qcups_p.h | 1 +
src/printsupport/widgets/qcupsjobwidget.cpp | 6 +++++-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp
index e11d301..0fd6f5f 100644
--- a/src/plugins/printsupport/cups/qppdprintdevice.cpp
+++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp
@@ -431,6 +431,8 @@ QVariant QPpdPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) con
return printerOption(QStringLiteral("job-priority"));
else if (key == PDPK_CupsJobSheets)
return printerOption(QStringLiteral("job-sheets"));
+ else if (key == PDPK_CupsJobBilling)
+ return printerOption(QStringLiteral("job-billing"));
return QVariant();
}
diff --git a/src/printsupport/kernel/qcups_p.h b/src/printsupport/kernel/qcups_p.h
index 906a548..c6bbacc 100644
--- a/src/printsupport/kernel/qcups_p.h
+++ b/src/printsupport/kernel/qcups_p.h
@@ -71,6 +71,7 @@ QT_BEGIN_NAMESPACE
#define PDPK_PpdOption QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 1)
#define PDPK_CupsJobPriority QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 2)
#define PDPK_CupsJobSheets QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 3)
+#define PDPK_CupsJobBilling QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 4)
class Q_PRINTSUPPORT_EXPORT QCUPSSupport
{
diff --git a/src/printsupport/widgets/qcupsjobwidget.cpp b/src/printsupport/widgets/qcupsjobwidget.cpp
index 4535f75..adaaff8 100644
--- a/src/printsupport/widgets/qcupsjobwidget.cpp
+++ b/src/printsupport/widgets/qcupsjobwidget.cpp
@@ -139,7 +139,11 @@ QTime QCupsJobWidget::jobHoldTime() const
void QCupsJobWidget::initJobBilling()
{
- setJobBilling(QString());
+ QString jobBilling;
+ if (m_printDevice)
+ jobBilling = m_printDevice->property(PDPK_CupsJobBilling).toString();
+
+ setJobBilling(jobBilling);
}
void QCupsJobWidget::setJobBilling(const QString &jobBilling)
--
2.7.4