diff options
Diffstat (limited to 'src/printsupport/dialogs/qpagesetupdialog_unix.cpp')
-rw-r--r-- | src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 31 |
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); |