summaryrefslogtreecommitdiffstats
path: root/src/plugins/printsupport/cups/qppdprintdevice.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals.cid@kdab.com>2018-02-05 09:20:20 +0100
committerAlbert Astals Cid <albert.astals.cid@kdab.com>2018-04-04 16:56:36 +0000
commit84cc8d0badb4abc3c9a96d59c61dddce916a216c (patch)
tree67212f2b15e3e4b4a92a5d53325dfbcdef9609e8 /src/plugins/printsupport/cups/qppdprintdevice.cpp
parent40a15ecaad98ec7538b4d4b8099d4d9c1061b3b8 (diff)
cups: Support raw printers
They don't have a ppd but we don't *really* need a ppd to just print Change-Id: Idf6b6dafc19420a511b057194488e2170cae4d70 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/printsupport/cups/qppdprintdevice.cpp')
-rw-r--r--src/plugins/printsupport/cups/qppdprintdevice.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp
index 21d11ca709..454bc89bfe 100644
--- a/src/plugins/printsupport/cups/qppdprintdevice.cpp
+++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp
@@ -75,14 +75,13 @@ QPpdPrintDevice::QPpdPrintDevice(const QString &id)
ppdMarkDefaults(m_ppd);
cupsMarkOptions(m_ppd, m_cupsDest->num_options, m_cupsDest->options);
ppdLocalize(m_ppd);
- } else {
- cupsFreeDests(1, m_cupsDest);
- m_cupsDest = nullptr;
- m_ppd = nullptr;
+
+ m_minimumPhysicalPageSize = QSize(m_ppd->custom_min[0], m_ppd->custom_min[1]);
+ m_maximumPhysicalPageSize = QSize(m_ppd->custom_max[0], m_ppd->custom_max[1]);
+ m_customMargins = QMarginsF(m_ppd->custom_margins[0], m_ppd->custom_margins[3],
+ m_ppd->custom_margins[2], m_ppd->custom_margins[1]);
}
- }
- if (m_cupsDest && m_ppd) {
m_name = printerOption("printer-info");
m_location = printerOption("printer-location");
m_makeAndModel = printerOption("printer-make-and-model");
@@ -98,10 +97,6 @@ QPpdPrintDevice::QPpdPrintDevice(const QString &id)
// Cups ppd_file_t variable_sizes custom_min custom_max
// PPD MaxMediaWidth MaxMediaHeight
m_supportsCustomPageSizes = type & CUPS_PRINTER_VARIABLE;
- m_minimumPhysicalPageSize = QSize(m_ppd->custom_min[0], m_ppd->custom_min[1]);
- m_maximumPhysicalPageSize = QSize(m_ppd->custom_max[0], m_ppd->custom_max[1]);
- m_customMargins = QMarginsF(m_ppd->custom_margins[0], m_ppd->custom_margins[3],
- m_ppd->custom_margins[2], m_ppd->custom_margins[1]);
}
}
}
@@ -118,7 +113,7 @@ QPpdPrintDevice::~QPpdPrintDevice()
bool QPpdPrintDevice::isValid() const
{
- return m_cupsDest && m_ppd;
+ return m_cupsDest;
}
bool QPpdPrintDevice::isDefault() const
@@ -163,8 +158,8 @@ void QPpdPrintDevice::loadPageSizes() const
}
}
}
- m_havePageSizes = true;
}
+ m_havePageSizes = true;
}
QPageSize QPpdPrintDevice::defaultPageSize() const