]> git.pld-linux.org Git - packages/qt4.git/blame - improve-cups-support.patch
- really disable openvg
[packages/qt4.git] / improve-cups-support.patch
CommitLineData
a3ed32b9
AM
1diff -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
2--- qt-everywhere-opensource-src-4.6.2/src/gui/dialogs/qprintdialog_unix.cpp 2010-02-11 16:55:22.000000000 +0100
3+++ qt-everywhere-opensource-src-4.6.2-cups/src/gui/dialogs/qprintdialog_unix.cpp 2010-02-28 04:34:16.000000000 +0100
4@@ -569,6 +569,32 @@
5 void QPrintDialogPrivate::selectPrinter(QCUPSSupport *cups)
6 {
7 options.duplex->setEnabled(cups && cups->ppdOption("Duplex"));
8+
9+ if (cups) {
10+ const ppd_option_t* duplex = cups->ppdOption("Duplex");
11+ if (duplex) {
12+ // copy default ppd duplex to qt dialog
13+ if (qstrcmp(duplex->defchoice, "DuplexTumble") == 0)
14+ options.duplexShort->setChecked(true);
15+ else if (qstrcmp(duplex->defchoice, "DuplexNoTumble") == 0)
16+ options.duplexLong->setChecked(true);
17+ else
18+ options.noDuplex->setChecked(true);
19+ }
20+
21+ if (cups->currentPPD()) {
22+ // set default color
23+ if (cups->currentPPD()->color_device)
24+ options.color->setChecked(true);
25+ else
26+ options.grayscale->setChecked(true);
27+ }
28+
29+ // set collation
30+ const ppd_option_t *collate = cups->ppdOption("Collate");
31+ if (collate)
32+ options.collate->setChecked(qstrcmp(collate->defchoice, "True")==0);
33+ }
34 }
35 #endif
36
37diff -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
38--- qt-everywhere-opensource-src-4.6.2/src/gui/painting/qprinter.cpp 2010-02-11 16:55:22.000000000 +0100
39+++ qt-everywhere-opensource-src-4.6.2-cups/src/gui/painting/qprinter.cpp 2010-02-28 04:55:15.000000000 +0100
40@@ -627,6 +627,44 @@
41 && d_ptr->paintEngine->type() != QPaintEngine::MacPrinter) {
42 setOutputFormat(QPrinter::PdfFormat);
43 }
44+
45+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
46+ // fill in defaults from ppd file
47+ QCUPSSupport cups;
48+
49+ int printernum = -1;
50+ for (int i = 0; i < cups.availablePrintersCount(); i++) {
51+ if (printerName().toLocal8Bit() == cups.availablePrinters()[i].name)
52+ printernum = i;
53+ }
54+ if (printernum >= 0) {
55+ cups.setCurrentPrinter(printernum);
56+
57+ const ppd_option_t* duplex = cups.ppdOption("Duplex");
58+ if (duplex) {
59+ // copy default ppd duplex to qt dialog
60+ if (qstrcmp(duplex->defchoice, "DuplexTumble") == 0)
61+ setDuplex(DuplexShortSide);
62+ else if (qstrcmp(duplex->defchoice, "DuplexNoTumble") == 0)
63+ setDuplex(DuplexLongSide);
64+ else
65+ setDuplex(DuplexNone);
66+ }
67+
68+ if (cups.currentPPD()) {
69+ // set default color
70+ if (cups.currentPPD()->color_device)
71+ setColorMode(Color);
72+ else
73+ setColorMode(GrayScale);
74+ }
75+
76+ // set collation
77+ const ppd_option_t *collate = cups.ppdOption("Collate");
78+ if (collate)
79+ setCollateCopies(qstrcmp(collate->defchoice, "True")==0);
80+ }
81+#endif
82 }
83
84 /*!
This page took 0.371691 seconds and 4 git commands to generate.