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>
This commit is contained in:
Albert Astals Cid 2017-12-06 12:00:00 +01:00
parent 83538a360e
commit 2831fa7665
3 changed files with 8 additions and 1 deletions

View File

@ -431,6 +431,8 @@ QVariant QPpdPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) con
return printerOption(QStringLiteral("job-priority")); return printerOption(QStringLiteral("job-priority"));
else if (key == PDPK_CupsJobSheets) else if (key == PDPK_CupsJobSheets)
return printerOption(QStringLiteral("job-sheets")); return printerOption(QStringLiteral("job-sheets"));
else if (key == PDPK_CupsJobBilling)
return printerOption(QStringLiteral("job-billing"));
return QVariant(); return QVariant();
} }

View File

@ -71,6 +71,7 @@ QT_BEGIN_NAMESPACE
#define PDPK_PpdOption QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 1) #define PDPK_PpdOption QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 1)
#define PDPK_CupsJobPriority QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 2) #define PDPK_CupsJobPriority QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 2)
#define PDPK_CupsJobSheets QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 3) #define PDPK_CupsJobSheets QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 3)
#define PDPK_CupsJobBilling QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 4)
class Q_PRINTSUPPORT_EXPORT QCUPSSupport class Q_PRINTSUPPORT_EXPORT QCUPSSupport
{ {

View File

@ -139,7 +139,11 @@ QTime QCupsJobWidget::jobHoldTime() const
void QCupsJobWidget::initJobBilling() 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) void QCupsJobWidget::setJobBilling(const QString &jobBilling)