- backport from 4.7 branch to get the printDialog to check for default
paperSize via CUPS, it replaces the patch qt-everywhere-opensource-src-4.6.2-cups.patch
This commit is contained in:
parent
06fc35cad4
commit
6727595b76
68
qt-everywhere-opensource-src-4.6.2-cups-QTBUG-6471.patch
Normal file
68
qt-everywhere-opensource-src-4.6.2-cups-QTBUG-6471.patch
Normal file
@ -0,0 +1,68 @@
|
||||
--- a/src/gui/dialogs/qprintdialog_unix.cpp
|
||||
+++ b/src/gui/dialogs/qprintdialog_unix.cpp
|
||||
@@ -154,6 +154,9 @@
|
||||
bool checkFields();
|
||||
void setupPrinter();
|
||||
void setOptionsPane(QPrintDialogPrivate *pane);
|
||||
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
||||
+ void setCupsProperties();
|
||||
+#endif
|
||||
|
||||
// slots
|
||||
void _q_printerChanged(int index);
|
||||
@@ -942,7 +945,7 @@
|
||||
|
||||
void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked()
|
||||
{
|
||||
- if (propertiesDialog == 0) {
|
||||
+ if (!propertiesDialog) {
|
||||
propertiesDialog = new QPrintPropertiesDialog(q);
|
||||
propertiesDialog->setResult(QDialog::Rejected);
|
||||
}
|
||||
@@ -962,6 +965,35 @@
|
||||
propertiesDialog->exec();
|
||||
}
|
||||
|
||||
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
||||
+void QUnixPrintWidgetPrivate::setCupsProperties()
|
||||
+{
|
||||
+ if (cups && QCUPSSupport::isAvailable()) {
|
||||
+ QPrintEngine *engine = printer->printEngine();
|
||||
+ const ppd_option_t* pageSizes = cups->pageSizes();
|
||||
+ QByteArray cupsPageSize;
|
||||
+ for (int i = 0; i < pageSizes->num_choices; ++i) {
|
||||
+ if (static_cast<int>(pageSizes->choices[i].marked) == 1)
|
||||
+ cupsPageSize = pageSizes->choices[i].choice;
|
||||
+ }
|
||||
+ engine->setProperty(PPK_CupsStringPageSize, QString::fromLatin1(cupsPageSize));
|
||||
+ engine->setProperty(PPK_CupsOptions, cups->options());
|
||||
+
|
||||
+ QRect pageRect = cups->pageRect(cupsPageSize);
|
||||
+ engine->setProperty(PPK_CupsPageRect, pageRect);
|
||||
+
|
||||
+ QRect paperRect = cups->paperRect(cupsPageSize);
|
||||
+ engine->setProperty(PPK_CupsPaperRect, paperRect);
|
||||
+
|
||||
+ for (int ps = 0; ps < QPrinter::NPaperSize; ++ps) {
|
||||
+ QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(ps));
|
||||
+ if (size.width == paperRect.width() && size.height == paperRect.height())
|
||||
+ printer->setPaperSize(static_cast<QPrinter::PaperSize>(ps));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
void QUnixPrintWidgetPrivate::setupPrinter()
|
||||
{
|
||||
const int printerCount = widget.printers->count();
|
||||
@@ -986,6 +1018,10 @@
|
||||
|
||||
if (propertiesDialog && propertiesDialog->result() == QDialog::Accepted)
|
||||
propertiesDialog->setupPrinter();
|
||||
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
||||
+ if (!propertiesDialog)
|
||||
+ setCupsProperties();
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
@ -1,84 +0,0 @@
|
||||
diff -ur qt-everywhere-opensource-src-4.6.2/src/gui/dialogs/qprintdialog_unix.cpp qt-everywhere-opensource-src-4.6.2-cups/src/gui/dialogs/qprintdialog_unix.cpp
|
||||
--- qt-everywhere-opensource-src-4.6.2/src/gui/dialogs/qprintdialog_unix.cpp 2010-02-11 16:55:22.000000000 +0100
|
||||
+++ qt-everywhere-opensource-src-4.6.2-cups/src/gui/dialogs/qprintdialog_unix.cpp 2010-02-28 04:34:16.000000000 +0100
|
||||
@@ -569,6 +569,32 @@
|
||||
void QPrintDialogPrivate::selectPrinter(QCUPSSupport *cups)
|
||||
{
|
||||
options.duplex->setEnabled(cups && cups->ppdOption("Duplex"));
|
||||
+
|
||||
+ if (cups) {
|
||||
+ const ppd_option_t* duplex = cups->ppdOption("Duplex");
|
||||
+ if (duplex) {
|
||||
+ // copy default ppd duplex to qt dialog
|
||||
+ if (qstrcmp(duplex->defchoice, "DuplexTumble") == 0)
|
||||
+ options.duplexShort->setChecked(true);
|
||||
+ else if (qstrcmp(duplex->defchoice, "DuplexNoTumble") == 0)
|
||||
+ options.duplexLong->setChecked(true);
|
||||
+ else
|
||||
+ options.noDuplex->setChecked(true);
|
||||
+ }
|
||||
+
|
||||
+ if (cups->currentPPD()) {
|
||||
+ // set default color
|
||||
+ if (cups->currentPPD()->color_device)
|
||||
+ options.color->setChecked(true);
|
||||
+ else
|
||||
+ options.grayscale->setChecked(true);
|
||||
+ }
|
||||
+
|
||||
+ // set collation
|
||||
+ const ppd_option_t *collate = cups->ppdOption("Collate");
|
||||
+ if (collate)
|
||||
+ options.collate->setChecked(qstrcmp(collate->defchoice, "True")==0);
|
||||
+ }
|
||||
}
|
||||
#endif
|
||||
|
||||
diff -ur qt-everywhere-opensource-src-4.6.2/src/gui/painting/qprinter.cpp qt-everywhere-opensource-src-4.6.2-cups/src/gui/painting/qprinter.cpp
|
||||
--- qt-everywhere-opensource-src-4.6.2/src/gui/painting/qprinter.cpp 2010-02-11 16:55:22.000000000 +0100
|
||||
+++ qt-everywhere-opensource-src-4.6.2-cups/src/gui/painting/qprinter.cpp 2010-02-28 04:55:15.000000000 +0100
|
||||
@@ -627,6 +627,44 @@
|
||||
&& d_ptr->paintEngine->type() != QPaintEngine::MacPrinter) {
|
||||
setOutputFormat(QPrinter::PdfFormat);
|
||||
}
|
||||
+
|
||||
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
||||
+ // fill in defaults from ppd file
|
||||
+ QCUPSSupport cups;
|
||||
+
|
||||
+ int printernum = -1;
|
||||
+ for (int i = 0; i < cups.availablePrintersCount(); i++) {
|
||||
+ if (printerName().toLocal8Bit() == cups.availablePrinters()[i].name)
|
||||
+ printernum = i;
|
||||
+ }
|
||||
+ if (printernum >= 0) {
|
||||
+ cups.setCurrentPrinter(printernum);
|
||||
+
|
||||
+ const ppd_option_t* duplex = cups.ppdOption("Duplex");
|
||||
+ if (duplex) {
|
||||
+ // copy default ppd duplex to qt dialog
|
||||
+ if (qstrcmp(duplex->defchoice, "DuplexTumble") == 0)
|
||||
+ setDuplex(DuplexShortSide);
|
||||
+ else if (qstrcmp(duplex->defchoice, "DuplexNoTumble") == 0)
|
||||
+ setDuplex(DuplexLongSide);
|
||||
+ else
|
||||
+ setDuplex(DuplexNone);
|
||||
+ }
|
||||
+
|
||||
+ if (cups.currentPPD()) {
|
||||
+ // set default color
|
||||
+ if (cups.currentPPD()->color_device)
|
||||
+ setColorMode(Color);
|
||||
+ else
|
||||
+ setColorMode(GrayScale);
|
||||
+ }
|
||||
+
|
||||
+ // set collation
|
||||
+ const ppd_option_t *collate = cups.ppdOption("Collate");
|
||||
+ if (collate)
|
||||
+ setCollateCopies(qstrcmp(collate->defchoice, "True")==0);
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
|
||||
/*!
|
12
qt.spec
12
qt.spec
@ -13,7 +13,7 @@ Summary: Qt toolkit
|
||||
Name: qt
|
||||
Epoch: 1
|
||||
Version: 4.6.2
|
||||
Release: 13%{?dist}
|
||||
Release: 14%{?dist}
|
||||
|
||||
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
|
||||
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
||||
@ -56,8 +56,6 @@ Patch53: qt-x11-opensource-src-4.5.0-fix-qatomic-inline-asm.patch
|
||||
# fix invalid assumptions about mysql_config --libs
|
||||
# http://bugzilla.redhat.com/440673
|
||||
Patch54: qt-x11-opensource-src-4.5.1-mysql_config.patch
|
||||
# http://bugs.kde.org/show_bug.cgi?id=180051#c22
|
||||
Patch55: qt-everywhere-opensource-src-4.6.2-cups.patch
|
||||
# fix type cast issue on s390x
|
||||
Patch56: qt-everywhere-opensource-src-4.6.2-webkit-s390x.patch
|
||||
# fix type cast issue on sparc64
|
||||
@ -87,6 +85,7 @@ Patch213: qt-x11-opensource-src-4.6.2-tablet-wacom-QTBUG-8599.patch
|
||||
# it should be included in 4.6.3
|
||||
Patch214: qt-everywhere-opensource-src-4.6.2-QTBUG-6932.patch
|
||||
patch215: qt-everywhere-opensource-src-4.6.2-atomic-s390.patch
|
||||
patch216: qt-everywhere-opensource-src-4.6.2-cups-QTBUG-6471.patch
|
||||
|
||||
Source10: http://gstreamer.freedesktop.org/data/images/artwork/gstreamer-logo.svg
|
||||
Source11: hi16-phonon-gstreamer.png
|
||||
@ -421,7 +420,6 @@ Qt libraries used for drawing widgets and OpenGL items.
|
||||
%patch53 -p1 -b .qatomic-inline-asm
|
||||
## TODO: upstream me
|
||||
%patch54 -p1 -b .mysql_config
|
||||
%patch55 -p1 -b .cups-1
|
||||
%patch56 -p1 -b .typecast_s390x
|
||||
%patch57 -p1 -b .typecast_sparc64
|
||||
|
||||
@ -445,6 +443,7 @@ Qt libraries used for drawing widgets and OpenGL items.
|
||||
%patch213 -p1 -b .tablet-wacom-QTBUG-8599
|
||||
%patch214 -p1 -b .QTBUG-6932
|
||||
%patch215 -p1 -b .atomic-s390
|
||||
%patch216 -p1 -b .cups-QTBUG-6471
|
||||
|
||||
# drop -fexceptions from $RPM_OPT_FLAGS
|
||||
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's|-fexceptions||g'`
|
||||
@ -1038,6 +1037,11 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Apr 15 2010 Than Ngo <than@redhat.com> - 4.6.2-14
|
||||
- backport from 4.7 branch to get the printDialog to check
|
||||
for default paperSize via CUPS, it replaces the patch
|
||||
qt-everywhere-opensource-src-4.6.2-cups.patch
|
||||
|
||||
* Tue Apr 06 2010 Than Ngo <than@redhat.com> - 4.6.2-13
|
||||
- backport from 4.7 branch to fix s390(x) atomic ops crashes
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user