diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-05-03 21:25:04 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-05-03 21:25:04 +0200 |
commit | 34f712e79e97b757b4426e1ffa09e065c9e379a1 (patch) | |
tree | 6a0143c41ccff3f51981f40cecbcd5f5cc705307 /src/gui/dialogs | |
parent | f169264b7b27c4ada295c1a250162c6bed6ca06b (diff) |
remove postscript support from Qt
I really wanted to do this since many years
already! :)
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/qprintdialog_unix.cpp | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 5b5c49d158..c6a1474b21 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -726,7 +726,6 @@ void QUnixPrintWidgetPrivate::updateWidget() if (widget.printers->count()) widget.printers->insertSeparator(widget.printers->count()); widget.printers->addItem(QPrintDialog::tr("Print to File (PDF)")); - widget.printers->addItem(QPrintDialog::tr("Print to File (Postscript)")); filePrintersAdded = true; } if (!printToFile && filePrintersAdded) { @@ -740,8 +739,6 @@ void QUnixPrintWidgetPrivate::updateWidget() || printer->printerName().isEmpty())) { if (printer->outputFormat() == QPrinter::PdfFormat) - widget.printers->setCurrentIndex(widget.printers->count() - 2); - else if (printer->outputFormat() == QPrinter::PostScriptFormat) widget.printers->setCurrentIndex(widget.printers->count() - 1); widget.filename->setEnabled(true); widget.lOutput->setEnabled(true); @@ -771,19 +768,13 @@ void QUnixPrintWidgetPrivate::_q_printerChanged(int index) if (filePrintersAdded) { Q_ASSERT(index != printerCount - 3); // separator - if (index > printerCount - 3) { // PDF or postscript - bool pdfPrinter = (index == printerCount - 2); + if (index == printerCount - 1) { // PDF widget.location->setText(QPrintDialog::tr("Local file")); - widget.type->setText(QPrintDialog::tr("Write %1 file").arg(pdfPrinter ? QString::fromLatin1("PDF") - : QString::fromLatin1("PostScript"))); + widget.type->setText(QPrintDialog::tr("Write PDF file")); widget.properties->setEnabled(true); widget.filename->setEnabled(true); QString filename = widget.filename->text(); QString suffix = QFileInfo(filename).suffix(); - if (pdfPrinter && suffix == QLatin1String("ps")) - filename = filename.replace(QLatin1String(".ps"), QLatin1String(".pdf")); - if (!pdfPrinter && suffix == QLatin1String("pdf")) - filename = filename.replace(QLatin1String(".pdf"), QLatin1String(".ps")); widget.filename->setText(filename); widget.lOutput->setEnabled(true); if (propertiesDialog) @@ -852,12 +843,7 @@ void QUnixPrintWidgetPrivate::_q_btnBrowseClicked() #endif if (!filename.isEmpty()) { widget.filename->setText(filename); - if (filename.endsWith(QString::fromLatin1(".ps"), Qt::CaseInsensitive)) - widget.printers->setCurrentIndex(widget.printers->count() - 1); // the postscript one - else if (filename.endsWith(QString::fromLatin1(".pdf"), Qt::CaseInsensitive)) - widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one - else if (widget.printers->currentIndex() != widget.printers->count() - 1) // if ps is not selected, pdf is default - widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one + widget.printers->setCurrentIndex(widget.printers->count() - 1); // the pdf one } } @@ -877,20 +863,14 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties(QPrinter *p) cur = home; #ifdef Q_WS_X11 if (p->docName().isEmpty()) { - if (p->outputFormat() == QPrinter::PostScriptFormat) - cur += QLatin1String("print.ps"); - else - cur += QLatin1String("print.pdf"); + cur += QLatin1String("print.pdf"); } else { QRegExp re(QString::fromLatin1("(.*)\\.\\S+")); if (re.exactMatch(p->docName())) cur += re.cap(1); else cur += p->docName(); - if (p->outputFormat() == QPrinter::PostScriptFormat) - cur += QLatin1String(".ps"); - else - cur += QLatin1String(".pdf"); + cur += QLatin1String(".pdf"); } #endif widget.filename->setText(cur); @@ -962,7 +942,7 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() propertiesDialog->applyPrinterProperties(q->printer()); if (q->isOptionEnabled(QPrintDialog::PrintToFile) - && (widget.printers->currentIndex() > widget.printers->count() - 3)) // PDF or postscript + && (widget.printers->currentIndex() == widget.printers->count() - 1)) // PDF propertiesDialog->selectPdfPsPrinter(q->printer()); else propertiesDialog->selectPrinter(); @@ -1004,13 +984,10 @@ void QUnixPrintWidgetPrivate::setupPrinter() const int printerCount = widget.printers->count(); const int index = widget.printers->currentIndex(); - if (filePrintersAdded && index > printerCount - 3) { // PDF or postscript + if (filePrintersAdded && index == printerCount - 1) { // PDF printer->setPrinterName(QString()); Q_ASSERT(index != printerCount - 3); // separator - if (index == printerCount - 2) - printer->setOutputFormat(QPrinter::PdfFormat); - else - printer->setOutputFormat(QPrinter::PostScriptFormat); + printer->setOutputFormat(QPrinter::PdfFormat); QString path = widget.filename->text(); if (QDir::isRelativePath(path)) path = QDir::homePath() + QDir::separator() + path; |