CUPS: Fix lpoptions file not being taken into account

This is actually two fixes.
 * We need to call cupsMarkOptions
 * CUPS differentiates between the "" and the nullptr instance, so we need
   to change the call to cupsGetNamedDest accordingly

Change-Id: If2692e405b6b71f8ee91362e6e72eabd9202d704
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
Albert Astals Cid 2017-12-05 12:05:32 +01:00
parent 8b8e53f726
commit c61810b6f5

View File

@ -473,7 +473,7 @@ void QPpdPrintDevice::loadPrinter()
}
// Get the print instance and PPD file
m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance.isNull() ? nullptr : m_cupsInstance.constData());
if (m_cupsDest) {
const char *ppdFile = cupsGetPPD(m_cupsName);
if (ppdFile) {
@ -482,6 +482,7 @@ void QPpdPrintDevice::loadPrinter()
}
if (m_ppd) {
ppdMarkDefaults(m_ppd);
cupsMarkOptions(m_ppd, m_cupsDest->num_options, m_cupsDest->options);
} else {
cupsFreeDests(1, m_cupsDest);
m_cupsDest = 0;