summaryrefslogtreecommitdiffstats
path: root/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-05-08 12:56:45 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-08 06:58:27 +0200
commitde11b9f5a7aaab79e816983a72b8e92ac84ce5d6 (patch)
treeaafbf1b22400bbaf90046b415490667164a2d93a /src/printsupport/dialogs/qpagesetupdialog_unix.cpp
parent80f7a388906f94f58bf765a32b9abbb16f967db2 (diff)
Revert "QtPrintSupport: Remove remaining LPR specific code"
This doesn't compile with a typical cross-compilation setup, which generally won't include cups headers. The commit should have been rejected, but wasn't, due to a bug in the Qt Project CI. Since it now causes all other modules depending on qtbase to fail their CI, it must be reverted to minimize disruption while the commit can be amended and/or the test toolchain updated to include cups headers. This reverts commit 80f7a388906f94f58bf765a32b9abbb16f967db2. Change-Id: I315ae275b37de358a74af28ab7bd691c9849acba Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Diffstat (limited to 'src/printsupport/dialogs/qpagesetupdialog_unix.cpp')
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
index a1e7d559db..90fb3ef542 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
@@ -53,8 +53,11 @@
#include <private/qabstractpagesetupdialog_p.h>
#include <private/qprinter_p.h>
-#include <private/qcups_p.h>
-#include <private/qprintengine_pdf_p.h>
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
+# include <private/qcups_p.h>
+# include <cups/cups.h>
+# include <private/qprintengine_pdf_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -221,12 +224,16 @@ public:
void init();
QPageSetupWidget *widget;
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
QCUPSSupport *cups;
+#endif
};
QPageSetupDialogPrivate::~QPageSetupDialogPrivate()
{
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
delete cups;
+#endif
}
void QPageSetupDialogPrivate::init()
@@ -235,12 +242,14 @@ void QPageSetupDialogPrivate::init()
widget = new QPageSetupWidget(q);
widget->setPrinter(printer);
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
if (printer->outputFormat() == QPrinter::NativeFormat && QCUPSSupport::isAvailable()) {
cups = new QCUPSSupport;
widget->selectPrinter(cups);
} else {
cups = 0;
}
+#endif
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel,
@@ -344,7 +353,9 @@ void QPageSetupWidget::setupPrinter() const
int ps = m_printer->pageSize();
if (val.type() == QVariant::Int) {
ps = val.toInt();
- } else if (m_cups && QCUPSSupport::isAvailable() && m_cups->currentPPD()) {
+ }
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
+ else if (m_cups && QCUPSSupport::isAvailable() && m_cups->currentPPD()) {
QByteArray cupsPageSize = val.toByteArray();
QPrintEngine *engine = m_printer->printEngine();
engine->setProperty(PPK_CupsStringPageSize, QString::fromLatin1(cupsPageSize));
@@ -362,7 +373,7 @@ void QPageSetupWidget::setupPrinter() const
break;
}
}
-
+#endif
if (ps == QPrinter::Custom)
m_printer->setPaperSize(sizeForOrientation(orientation, m_paperSize), QPrinter::Point);
else
@@ -379,7 +390,7 @@ void QPageSetupWidget::selectPrinter(QCUPSSupport *cups)
{
m_cups = cups;
widget.paperSize->clear();
-
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
if (m_cups && QCUPSSupport::isAvailable()) {
const ppd_option_t* pageSizes = m_cups->pageSizes();
const int numChoices = pageSizes ? pageSizes->num_choices : 0;
@@ -415,7 +426,7 @@ void QPageSetupWidget::selectPrinter(QCUPSSupport *cups)
m_bottomMargin = paper.bottom() - content.bottom();
}
}
-
+#endif
if (widget.paperSize->count() == 0) {
populatePaperSizes(widget.paperSize);
widget.paperSize->setCurrentIndex(widget.paperSize->findData(
@@ -460,7 +471,9 @@ void QPageSetupWidget::_q_paperSizeChanged()
bool custom = size == QPrinter::Custom;
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
custom = custom ? !m_cups : custom;
+#endif
widget.paperWidth->setEnabled(custom);
widget.paperHeight->setEnabled(custom);
@@ -472,14 +485,16 @@ void QPageSetupWidget::_q_paperSizeChanged()
m_pagePreview->setPaperSize(m_paperSize);
} else {
Q_ASSERT(m_printer);
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
if (m_cups) { // combobox is filled with cups based data
QByteArray cupsPageSize = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray();
m_paperSize = m_cups->paperRect(cupsPageSize).size();
if (orientation == QPrinter::Landscape)
m_paperSize = QSizeF(m_paperSize.height(), m_paperSize.width()); // swap
- } else {
- m_paperSize = qt_printerPaperSize(orientation, size, QPrinter::Point, 1);
}
+ else
+#endif
+ m_paperSize = qt_printerPaperSize(orientation, size, QPrinter::Point, 1);
m_pagePreview->setPaperSize(m_paperSize);
widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier);