Skip to content

Commit 49e2c38

Browse files
committed
qppdprintdevice: create temp queue to get ppd from IPP attributes
Call `cupsCopyDestInfo` to create temp queue. CUPS will create ppd file from IPP attributes for temp queue. Otherwise, when opening the Qt print dialog in the case of an IPP printer, CUPS does not yet know its properties (such as duplex), so all printer properties may not be displayed in the print dialog. Task-number: QTBUG-46093 Pick-to: 6.12 Change-Id: I8ce4e8ec1a12cadd9ebc1c8ce94207b4116a4571 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
1 parent ee06f3e commit 49e2c38

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/plugins/printsupport/cups/qppdprintdevice.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ QPpdPrintDevice::QPpdPrintDevice(const QString &id)
3737
m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance.isNull() ? nullptr : m_cupsInstance.constData());
3838
if (m_cupsDest) {
3939
const char *ppdFile = cupsGetPPD(m_cupsName);
40+
if (ppdFile == nullptr) {
41+
// For auto-discovered IPP printers without a local CUPS queue, CUPS doesn't have a PPD yet.
42+
// Request supported values/capabilities, which could be used to read capabilities (IPP attributes) directly.
43+
// But for now, we call it only for the useful side-effect that CUPS creates a temp queue
44+
// and a PPD file from the IPP attributes for this queue that can be retrieved then.
45+
if (cups_dinfo_t *destInfo = cupsCopyDestInfo(CUPS_HTTP_DEFAULT, m_cupsDest)) {
46+
cupsFreeDestInfo(destInfo);
47+
ppdFile = cupsGetPPD(m_cupsName);
48+
}
49+
}
4050
if (ppdFile) {
4151
m_ppd = ppdOpenFile(ppdFile);
4252
unlink(ppdFile);

0 commit comments

Comments
 (0)