OpenCoverage

qprintdialog_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/dialogs/qprintdialog_unix.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10static void initResources()-
11{-
12 do { extern int qInitResources_qprintdialog (); qInitResources_qprintdialog (); } while (0);-
13}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
14-
15-
16-
17class QOptionTreeItem;-
18class QPPDOptionsModel;-
19-
20class QPrintPropertiesDialog : public QDialog-
21{-
22 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
23#pragma GCC diagnostic push-
24 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
25#pragma GCC diagnostic pop-
26 struct QPrivateSignal {};-
27public:-
28 QPrintPropertiesDialog(QAbstractPrintDialog *parent = 0);-
29 ~QPrintPropertiesDialog();-
30-
31 void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName);-
32-
33-
34 void applyPrinterProperties(QPrinter *p);-
35 void setupPrinter() const;-
36-
37private:-
38 friend class QUnixPrintWidgetPrivate;-
39 Ui::QPrintPropertiesWidget widget;-
40 QDialogButtonBox *m_buttons;-
41-
42 QCupsJobWidget *m_jobOptions;-
43-
44};-
45-
46class QUnixPrintWidgetPrivate;-
47-
48class QUnixPrintWidget : public QWidget-
49{-
50 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
51#pragma GCC diagnostic push-
52 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
53#pragma GCC diagnostic pop-
54 struct QPrivateSignal {};-
55-
56public:-
57 explicit QUnixPrintWidget(QPrinter *printer, QWidget *parent = 0);-
58 ~QUnixPrintWidget();-
59 void updatePrinter();-
60-
61private:-
62 friend class QPrintDialogPrivate;-
63 friend class QUnixPrintWidgetPrivate;-
64 QUnixPrintWidgetPrivate *d;-
65 -
66 -
67 -
68};-
69-
70class QUnixPrintWidgetPrivate-
71{-
72public:-
73 QUnixPrintWidgetPrivate(QUnixPrintWidget *q, QPrinter *prn);-
74 ~QUnixPrintWidgetPrivate();-
75-
76-
77 void applyPrinterProperties();-
78 bool checkFields();-
79 void setupPrinter();-
80 void setOptionsPane(QPrintDialogPrivate *pane);-
81 void setupPrinterProperties();-
82-
83 void _q_printerChanged(int index);-
84 void _q_btnPropertiesClicked();-
85 void _q_btnBrowseClicked();-
86-
87 QUnixPrintWidget * const parent;-
88 QPrintPropertiesDialog *propertiesDialog;-
89 Ui::QPrintWidget widget;-
90 QAbstractPrintDialog * q;-
91 QPrinter *printer;-
92 QPrintDevice m_currentPrintDevice;-
93-
94 void updateWidget();-
95-
96private:-
97 QPrintDialogPrivate *optionsPane;-
98 bool filePrintersAdded;-
99 bool propertiesDialogShown;-
100};-
101-
102class QPrintDialogPrivate : public QAbstractPrintDialogPrivate-
103{-
104 inline QPrintDialog* q_func() { return static_cast<QPrintDialog *>(q_ptr); } inline const QPrintDialog* q_func() const { return static_cast<const QPrintDialog *>(q_ptr); } friend class QPrintDialog;-
105 public: static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QPrintDialog", sourceText, disambiguation, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QPrintDialog", sourceText, disambiguation, n); } private:-
106public:-
107 QPrintDialogPrivate();-
108 ~QPrintDialogPrivate();-
109-
110 void init();-
111-
112 void applyPrinterProperties();-
113-
114 void selectPrinter(const QPrinter::OutputFormat outputFormat);-
115-
116 void _q_togglePageSetCombo(bool);-
117-
118 void _q_checkFields();-
119-
120 void _q_collapseOrExpandDialog();-
121-
122 void setupPrinter();-
123 void updateWidgets();-
124-
125 virtual void setTabs(const QList<QWidget*> &tabs) override;-
126-
127 Ui::QPrintSettingsOutput options;-
128 QUnixPrintWidget *top;-
129 QWidget *bottom;-
130 QDialogButtonBox *buttons;-
131 QPushButton *collapseButton;-
132 QPrinter::OutputFormat printerOutputFormat;-
133};-
134QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent)-
135 : QDialog(parent)-
136{-
137 setWindowTitle(tr("Printer Properties"));-
138 QVBoxLayout *lay = new QVBoxLayout(this);-
139 this->setLayout(lay);-
140 QWidget *content = new QWidget(this);-
141 widget.setupUi(content);-
142 m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);-
143 lay->addWidget(content);-
144 lay->addWidget(m_buttons);-
145-
146 connect(m_buttons->button(QDialogButtonBox::Ok), qFlagLocation("2""clicked()" "\0" __FILE__ ":" "246"), this, qFlagLocation("1""accept()" "\0" __FILE__ ":" "246"));-
147 connect(m_buttons->button(QDialogButtonBox::Cancel), qFlagLocation("2""clicked()" "\0" __FILE__ ":" "247"), this, qFlagLocation("1""reject()" "\0" __FILE__ ":" "247"));-
148-
149-
150 m_jobOptions = new QCupsJobWidget();-
151 widget.tabs->addTab(m_jobOptions, tr("Job Options"));-
152-
153}
never executed: end of block
0
154-
155QPrintPropertiesDialog::~QPrintPropertiesDialog()-
156{-
157}-
158-
159void QPrintPropertiesDialog::applyPrinterProperties(QPrinter *p)-
160{-
161 widget.pageSetup->setPrinter(p);-
162-
163 m_jobOptions->setPrinter(p);-
164-
165}
never executed: end of block
0
166-
167void QPrintPropertiesDialog::setupPrinter() const-
168{-
169 widget.pageSetup->setupPrinter();-
170-
171 m_jobOptions->setupPrinter();-
172-
173}
never executed: end of block
0
174-
175void QPrintPropertiesDialog::selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName)-
176{-
177 widget.pageSetup->selectPrinter(outputFormat, printerName);-
178}
never executed: end of block
0
179QPrintDialogPrivate::QPrintDialogPrivate()-
180 : top(0), bottom(0), buttons(0), collapseButton(0)-
181{-
182 initResources();-
183}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
184-
185QPrintDialogPrivate::~QPrintDialogPrivate()-
186{-
187}-
188-
189void QPrintDialogPrivate::init()-
190{-
191 QPrintDialog * const q = q_func();-
192-
193 top = new QUnixPrintWidget(q->printer(), q);-
194 bottom = new QWidget(q);-
195 options.setupUi(bottom);-
196 options.color->setIconSize(QSize(32, 32));-
197 options.color->setIcon(QIcon(QLatin1String(":/qt-project.org/dialogs/qprintdialog/images/status-color.png")));-
198 options.grayscale->setIconSize(QSize(32, 32));-
199 options.grayscale->setIcon(QIcon(QLatin1String(":/qt-project.org/dialogs/qprintdialog/images/status-gray-scale.png")));-
200-
201-
202-
203 options.pageSetCombo->addItem(tr("All Pages"), QVariant::fromValue(QCUPSSupport::AllPages));-
204 options.pageSetCombo->addItem(tr("Odd Pages"), QVariant::fromValue(QCUPSSupport::OddPages));-
205 options.pageSetCombo->addItem(tr("Even Pages"), QVariant::fromValue(QCUPSSupport::EvenPages));-
206-
207-
208 top->d->setOptionsPane(this);-
209-
210 buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, q);-
211 collapseButton = new QPushButton(QPrintDialog::tr("&Options >>"), buttons);-
212 buttons->addButton(collapseButton, QDialogButtonBox::ResetRole);-
213 bottom->setVisible(false);-
214-
215 QPushButton *printButton = buttons->button(QDialogButtonBox::Ok);-
216 printButton->setText(QPrintDialog::tr("&Print"));-
217 printButton->setDefault(true);-
218-
219 QVBoxLayout *lay = new QVBoxLayout(q);-
220 q->setLayout(lay);-
221 lay->addWidget(top);-
222 lay->addWidget(bottom);-
223 lay->addWidget(buttons);-
224-
225-
226-
227-
228 QObject::connect(buttons, qFlagLocation("2""accepted()" "\0" __FILE__ ":" "340"), q, qFlagLocation("1""_q_checkFields()" "\0" __FILE__ ":" "340"));-
229-
230 QObject::connect(buttons, qFlagLocation("2""rejected()" "\0" __FILE__ ":" "342"), q, qFlagLocation("1""reject()" "\0" __FILE__ ":" "342"));-
231-
232 QObject::connect(options.printSelection, qFlagLocation("2""toggled(bool)" "\0" __FILE__ ":" "344"),-
233 q, qFlagLocation("1""_q_togglePageSetCombo(bool)" "\0" __FILE__ ":" "345"));-
234-
235 QObject::connect(options.printCurrentPage, qFlagLocation("2""toggled(bool)" "\0" __FILE__ ":" "347"),-
236 q, qFlagLocation("1""_q_togglePageSetCombo(bool)" "\0" __FILE__ ":" "348"));-
237-
238 QObject::connect(collapseButton, qFlagLocation("2""released()" "\0" __FILE__ ":" "350"), q, qFlagLocation("1""_q_collapseOrExpandDialog()" "\0" __FILE__ ":" "350"));-
239}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
240-
241-
242void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputFormat)-
243{-
244 QPrintDialog * const q = q_func();-
245 QPrinter *p = q->printer();-
246 printerOutputFormat = outputFormat;-
247-
248 if (p->colorMode() == QPrinter::Color
p->colorMode()...Printer::ColorDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-4
249 options.color->setChecked(true);
executed 4 times by 1 test: options.color->setChecked(true);
Executed by:
  • tst_QPrinter
4
250 else-
251 options.grayscale->setChecked(true);
never executed: options.grayscale->setChecked(true);
0
252-
253 switch (p->duplex()) {-
254 case
executed 4 times by 1 test: case QPrinter::DuplexNone:
Executed by:
  • tst_QPrinter
QPrinter::DuplexNone:
executed 4 times by 1 test: case QPrinter::DuplexNone:
Executed by:
  • tst_QPrinter
4
255 options.noDuplex->setChecked(true); break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QPrinter
4
256 case
never executed: case QPrinter::DuplexLongSide:
QPrinter::DuplexLongSide:
never executed: case QPrinter::DuplexLongSide:
0
257 case
never executed: case QPrinter::DuplexAuto:
QPrinter::DuplexAuto:
never executed: case QPrinter::DuplexAuto:
0
258 options.duplexLong->setChecked(true); break;
never executed: break;
0
259 case
never executed: case QPrinter::DuplexShortSide:
QPrinter::DuplexShortSide:
never executed: case QPrinter::DuplexShortSide:
0
260 options.duplexShort->setChecked(true); break;
never executed: break;
0
261 }-
262 options.copies->setValue(p->copyCount());-
263 options.collate->setChecked(p->collateCopies());-
264 options.reverse->setChecked(p->pageOrder() == QPrinter::LastPageFirst);-
265-
266 if (outputFormat == QPrinter::PdfFormat
outputFormat =...ter::PdfFormatDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
|| options.printSelection->isChecked()
options.printS...n->isChecked()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
0-4
267 || options.printCurrentPage->isChecked()
options.printC...e->isChecked()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-4
268-
269 options.pageSetCombo->setEnabled(false);
never executed: options.pageSetCombo->setEnabled(false);
0
270 else-
271 options.pageSetCombo->setEnabled(true);
executed 4 times by 1 test: options.pageSetCombo->setEnabled(true);
Executed by:
  • tst_QPrinter
4
272}-
273-
274void QPrintDialogPrivate::applyPrinterProperties()-
275{-
276-
277 top->d->applyPrinterProperties();-
278}
never executed: end of block
0
279-
280void QPrintDialogPrivate::setupPrinter()-
281{-
282-
283 top->d->setupPrinter();-
284-
285-
286 QPrintDialog * const q = q_func();-
287 QPrinter* p = q->printer();-
288-
289 if (options.duplex->isEnabled()
options.duplex->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
290 if (options.noDuplex->isChecked()
options.noDuplex->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
291 p->setDuplex(QPrinter::DuplexNone);
never executed: p->setDuplex(QPrinter::DuplexNone);
0
292 else if (options.duplexLong->isChecked()
options.duplex...g->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
293 p->setDuplex(QPrinter::DuplexLongSide);
never executed: p->setDuplex(QPrinter::DuplexLongSide);
0
294 else-
295 p->setDuplex(QPrinter::DuplexShortSide);
never executed: p->setDuplex(QPrinter::DuplexShortSide);
0
296 }-
297-
298 p->setColorMode(options.color->isChecked() ? QPrinter::Color : QPrinter::GrayScale);-
299 p->setPageOrder(options.reverse->isChecked() ? QPrinter::LastPageFirst : QPrinter::FirstPageFirst);-
300-
301-
302 if (options.printAll->isChecked()
options.printAll->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
303 p->setPrintRange(QPrinter::AllPages);-
304 p->setFromTo(0,0);-
305 }
never executed: end of block
else if (options.printSelection->isChecked()
options.printS...n->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
306 p->setPrintRange(QPrinter::Selection);-
307 p->setFromTo(0,0);-
308 }
never executed: end of block
else if (options.printCurrentPage->isChecked()
options.printC...e->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
309 p->setPrintRange(QPrinter::CurrentPage);-
310 p->setFromTo(0,0);-
311 }
never executed: end of block
else if (options.printRange->isChecked()
options.printR...e->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
312 if (q->isOptionEnabled(QPrintDialog::PrintPageRange)
q->isOptionEna...rintPageRange)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
313 p->setPrintRange(QPrinter::PageRange);-
314 p->setFromTo(options.from->value(), qMax(options.from->value(), options.to->value()));-
315 }
never executed: end of block
else {
0
316-
317-
318 p->setPrintRange(QPrinter::AllPages);-
319 p->setFromTo(0,0);-
320 }
never executed: end of block
0
321 }-
322-
323-
324-
325 if (p->printRange() == QPrinter::AllPages
p->printRange(...nter::AllPagesDescription
TRUEnever evaluated
FALSEnever evaluated
|| p->printRange() == QPrinter::PageRange
p->printRange(...ter::PageRangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
326-
327 QCUPSSupport::PageSet pageSet = options.pageSetCombo->itemData(options.pageSetCombo->currentIndex()).value<QCUPSSupport::PageSet>();-
328 if (q->isOptionEnabled(QPrintDialog::PrintPageRange)
q->isOptionEna...rintPageRange)Description
TRUEnever evaluated
FALSEnever evaluated
0
329 && p->printRange() == QPrinter::PageRange
p->printRange(...ter::PageRangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
330 && (
(q->fromPage() % 2 == 0)Description
TRUEnever evaluated
FALSEnever evaluated
q->fromPage() % 2 == 0)
(q->fromPage() % 2 == 0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
331-
332 switch (pageSet) {-
333 case
never executed: case QCUPSSupport::AllPages:
QCUPSSupport::AllPages:
never executed: case QCUPSSupport::AllPages:
0
334 break;
never executed: break;
0
335 case
never executed: case QCUPSSupport::OddPages:
QCUPSSupport::OddPages:
never executed: case QCUPSSupport::OddPages:
0
336 QCUPSSupport::setPageSet(p, QCUPSSupport::EvenPages);-
337 break;
never executed: break;
0
338 case
never executed: case QCUPSSupport::EvenPages:
QCUPSSupport::EvenPages:
never executed: case QCUPSSupport::EvenPages:
0
339 QCUPSSupport::setPageSet(p, QCUPSSupport::OddPages);-
340 break;
never executed: break;
0
341 }-
342 }
never executed: end of block
else if (pageSet != QCUPSSupport::AllPages
pageSet != QCU...port::AllPagesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
343 QCUPSSupport::setPageSet(p, pageSet);-
344 }
never executed: end of block
0
345-
346-
347-
348 if (!q->isOptionEnabled(QPrintDialog::PrintPageRange)
!q->isOptionEn...rintPageRange)Description
TRUEnever evaluated
FALSEnever evaluated
&& options.printRange->isChecked()
options.printR...e->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
349 QCUPSSupport::setPageRange(p, options.from->value(), qMax(options.from->value(), options.to->value()));
never executed: QCUPSSupport::setPageRange(p, options.from->value(), qMax(options.from->value(), options.to->value()));
0
350 }
never executed: end of block
0
351-
352-
353-
354 p->setCopyCount(options.copies->value());-
355 p->setCollateCopies(options.collate->isChecked());-
356}
never executed: end of block
0
357-
358void QPrintDialogPrivate::_q_togglePageSetCombo(bool checked)-
359{-
360 if (printerOutputFormat == QPrinter::PdfFormat
printerOutputF...ter::PdfFormatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
361 return;
never executed: return;
0
362-
363 options.pageSetCombo->setDisabled(checked);-
364}
never executed: end of block
0
365-
366void QPrintDialogPrivate::_q_collapseOrExpandDialog()-
367{-
368 int collapseHeight = 0;-
369 QPrintDialog * const q = q_func();-
370 QWidget *widgetToHide = bottom;-
371 if (widgetToHide->isVisible()
widgetToHide->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
372 collapseButton->setText(QPrintDialog::tr("&Options >>"));-
373 collapseHeight = widgetToHide->y() + widgetToHide->height() - (top->y() + top->height());-
374 }
never executed: end of block
0
375 else-
376 collapseButton->setText(QPrintDialog::tr("&Options <<"));
never executed: collapseButton->setText(QPrintDialog::tr("&Options <<"));
0
377 widgetToHide->setVisible(! widgetToHide->isVisible());-
378 if (! widgetToHide->isVisible()
! widgetToHide->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
379 q->layout()->activate();-
380 q->resize( QSize(q->width(), q->height() - collapseHeight) );-
381 }
never executed: end of block
0
382}
never executed: end of block
0
383-
384-
385void QPrintDialogPrivate::_q_checkFields()-
386{-
387 QPrintDialog * const q = q_func();-
388 if (top->d->checkFields()
top->d->checkFields()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
389 q->accept();
never executed: q->accept();
0
390}
never executed: end of block
0
391-
392-
393-
394void QPrintDialogPrivate::updateWidgets()-
395{-
396 QPrintDialog * const q = q_func();-
397 options.gbPrintRange->setVisible(q->isOptionEnabled(QPrintDialog::PrintPageRange) ||-
398 q->isOptionEnabled(QPrintDialog::PrintSelection) ||-
399 q->isOptionEnabled(QPrintDialog::PrintCurrentPage));-
400-
401 options.printRange->setEnabled(q->isOptionEnabled(QPrintDialog::PrintPageRange));-
402 options.printSelection->setVisible(q->isOptionEnabled(QPrintDialog::PrintSelection));-
403 options.printCurrentPage->setVisible(q->isOptionEnabled(QPrintDialog::PrintCurrentPage));-
404 options.collate->setVisible(q->isOptionEnabled(QPrintDialog::PrintCollateCopies));-
405-
406-
407-
408 if (!q->isOptionEnabled(QPrintDialog::PrintPageRange)
!q->isOptionEn...rintPageRange)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
0-1
409 && (q->isOptionEnabled(QPrintDialog::PrintSelection)
q->isOptionEna...rintSelection)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
|| q->isOptionEnabled(QPrintDialog::PrintCurrentPage)
q->isOptionEna...ntCurrentPage)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
)) {
0-1
410 options.pageSetCombo->setVisible(false);-
411 options.pageSetLabel->setVisible(false);-
412 }
never executed: end of block
else {
0
413 options.pageSetCombo->setVisible(true);-
414 options.pageSetLabel->setVisible(true);-
415 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
416-
417 if (!q->isOptionEnabled(QPrintDialog::PrintPageRange)
!q->isOptionEn...rintPageRange)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-1
418-
419-
420 options.gbPrintRange->setVisible(true);-
421 options.printRange->setEnabled(true);-
422 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
423-
424-
425 switch (q->printRange()) {-
426 case
executed 1 time by 1 test: case QPrintDialog::AllPages:
Executed by:
  • tst_QPrinter
QPrintDialog::AllPages:
executed 1 time by 1 test: case QPrintDialog::AllPages:
Executed by:
  • tst_QPrinter
1
427 options.printAll->setChecked(true);-
428 options.pageSetCombo->setEnabled(true);-
429 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
430 case
never executed: case QPrintDialog::Selection:
QPrintDialog::Selection:
never executed: case QPrintDialog::Selection:
0
431 options.printSelection->setChecked(true);-
432 options.pageSetCombo->setEnabled(false);-
433 break;
never executed: break;
0
434 case
never executed: case QPrintDialog::PageRange:
QPrintDialog::PageRange:
never executed: case QPrintDialog::PageRange:
0
435 options.printRange->setChecked(true);-
436 options.pageSetCombo->setEnabled(true);-
437 break;
never executed: break;
0
438 case
never executed: case QPrintDialog::CurrentPage:
QPrintDialog::CurrentPage:
never executed: case QPrintDialog::CurrentPage:
0
439 if (q->isOptionEnabled(QPrintDialog::PrintCurrentPage)
q->isOptionEna...ntCurrentPage)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
440 options.printCurrentPage->setChecked(true);-
441 options.pageSetCombo->setEnabled(false);-
442 }
never executed: end of block
0
443 break;
never executed: break;
0
444 default
never executed: default:
:
never executed: default:
0
445 break;
never executed: break;
0
446 }-
447 const int minPage = qMax(1, qMin(q->minPage() , q->maxPage()));-
448 const int maxPage = qMax(1, q->maxPage() == 2147483647 ? 9999 : q->maxPage());-
449-
450 options.from->setMinimum(minPage);-
451 options.to->setMinimum(minPage);-
452 options.from->setMaximum(maxPage);-
453 options.to->setMaximum(maxPage);-
454-
455 options.from->setValue(q->fromPage());-
456 options.to->setValue(q->toPage());-
457 top->d->updateWidget();-
458}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
459-
460void QPrintDialogPrivate::setTabs(const QList<QWidget*> &tabWidgets)-
461{-
462 QList<QWidget*>::ConstIterator iter = tabWidgets.begin();-
463 while(iter != tabWidgets.constEnd()
iter != tabWidgets.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
464 QWidget *tab = *iter;-
465 options.tabs->addTab(tab, tab->windowTitle());-
466 ++iter;-
467 }
never executed: end of block
0
468}
never executed: end of block
0
469QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent)-
470 : QAbstractPrintDialog(*(new QPrintDialogPrivate), printer, parent)-
471{-
472 QPrintDialogPrivate * const d = d_func();-
473 d->init();-
474}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QPrinter
2
475-
476-
477-
478-
479QPrintDialog::QPrintDialog(QWidget *parent)-
480 : QAbstractPrintDialog(*(new QPrintDialogPrivate), 0, parent)-
481{-
482 QPrintDialogPrivate * const d = d_func();-
483 d->init();-
484}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
485-
486QPrintDialog::~QPrintDialog()-
487{-
488}-
489-
490void QPrintDialog::setVisible(bool visible)-
491{-
492 QPrintDialogPrivate * const d = d_func();-
493-
494 if (visible
visibleDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
495 d->updateWidgets();
executed 1 time by 1 test: d->updateWidgets();
Executed by:
  • tst_QPrinter
1
496-
497 QAbstractPrintDialog::setVisible(visible);-
498}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
499-
500int QPrintDialog::exec()-
501{-
502 return
never executed: return QDialog::exec();
QDialog::exec();
never executed: return QDialog::exec();
0
503}-
504-
505void QPrintDialog::accept()-
506{-
507 QPrintDialogPrivate * const d = d_func();-
508 d->setupPrinter();-
509 QDialog::accept();-
510}
never executed: end of block
0
511QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter *prn)-
512 : parent(p), propertiesDialog(0), printer(prn), optionsPane(0),-
513 filePrintersAdded(false), propertiesDialogShown(false)-
514{-
515 q = 0;-
516 if (parent
parentDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-3
517 q = qobject_cast<QAbstractPrintDialog*> (parent->parent());
executed 3 times by 1 test: q = qobject_cast<QAbstractPrintDialog*> (parent->parent());
Executed by:
  • tst_QPrinter
3
518-
519 widget.setupUi(parent);-
520-
521 int currentPrinterIndex = 0;-
522 QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();-
523 if (ps
psDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-3
524 const QStringList printers = ps->availablePrintDeviceIds();-
525 const QString defaultPrinter = ps->defaultPrintDeviceId();-
526-
527 widget.printers->addItems(printers);-
528-
529 const int idx = printers.indexOf(defaultPrinter);-
530 if (idx >= 0
idx >= 0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-3
531 currentPrinterIndex = idx;
never executed: currentPrinterIndex = idx;
0
532 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
533 widget.properties->setEnabled(true);-
534-
535-
536 QFileSystemModel *fsm = new QFileSystemModel(widget.filename);-
537 fsm->setRootPath(QDir::homePath());-
538 widget.filename->setCompleter(new QCompleter(fsm, widget.filename));-
539-
540 _q_printerChanged(currentPrinterIndex);-
541-
542 QObject::connect(widget.printers, qFlagLocation("2""currentIndexChanged(int)" "\0" __FILE__ ":" "682"),-
543 parent, qFlagLocation("1""_q_printerChanged(int)" "\0" __FILE__ ":" "683"));-
544 QObject::connect(widget.fileBrowser, qFlagLocation("2""clicked()" "\0" __FILE__ ":" "684"), parent, qFlagLocation("1""_q_btnBrowseClicked()" "\0" __FILE__ ":" "684"));-
545 QObject::connect(widget.properties, qFlagLocation("2""clicked()" "\0" __FILE__ ":" "685"), parent, qFlagLocation("1""_q_btnPropertiesClicked()" "\0" __FILE__ ":" "685"));-
546-
547-
548 widget.preview->setVisible(false);-
549}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
550-
551void QUnixPrintWidgetPrivate::updateWidget()-
552{-
553 const bool printToFile = q == 0
q == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
|| q->isOptionEnabled(QPrintDialog::PrintToFile)
q->isOptionEna...::PrintToFile)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
;
0-1
554 if (printToFile
printToFileDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
&& !filePrintersAdded
!filePrintersAddedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-1
555 if (widget.printers->count()
widget.printers->count()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
)
0-1
556 widget.printers->insertSeparator(widget.printers->count());
never executed: widget.printers->insertSeparator(widget.printers->count());
0
557 widget.printers->addItem(QPrintDialog::tr("Print to File (PDF)"));-
558 filePrintersAdded = true;-
559 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
560 if (!printToFile
!printToFileDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
&& filePrintersAdded
filePrintersAddedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-1
561 widget.printers->removeItem(widget.printers->count()-1);-
562 widget.printers->removeItem(widget.printers->count()-1);-
563 if (widget.printers->count()
widget.printers->count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
564 widget.printers->removeItem(widget.printers->count()-1);
never executed: widget.printers->removeItem(widget.printers->count()-1);
0
565 filePrintersAdded = false;-
566 }
never executed: end of block
0
567 if (printer
printerDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
&& filePrintersAdded
filePrintersAddedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
&& (printer->outputFormat() != QPrinter::NativeFormat
printer->outpu...::NativeFormatDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
0-1
568 || printer->printerName().isEmpty()
printer->print...me().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
569 {-
570 if (printer->outputFormat() == QPrinter::PdfFormat
printer->outpu...ter::PdfFormatDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
571 widget.printers->setCurrentIndex(widget.printers->count() - 1);
executed 1 time by 1 test: widget.printers->setCurrentIndex(widget.printers->count() - 1);
Executed by:
  • tst_QPrinter
1
572 widget.filename->setEnabled(true);-
573 widget.lOutput->setEnabled(true);-
574 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
575-
576 widget.filename->setVisible(printToFile);-
577 widget.lOutput->setVisible(printToFile);-
578 widget.fileBrowser->setVisible(printToFile);-
579-
580 widget.properties->setVisible(q->isOptionEnabled(QAbstractPrintDialog::PrintShowPageSize));-
581}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
582-
583QUnixPrintWidgetPrivate::~QUnixPrintWidgetPrivate()-
584{-
585}-
586-
587void QUnixPrintWidgetPrivate::_q_printerChanged(int index)-
588{-
589 if (index < 0
index < 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-4
590 return;
never executed: return;
0
591 const int printerCount = widget.printers->count();-
592 widget.filename->setEnabled(false);-
593 widget.lOutput->setEnabled(false);-
594-
595-
596 if (propertiesDialog
propertiesDialogDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
){
0-4
597 delete propertiesDialog;-
598 propertiesDialog = 0;-
599 propertiesDialogShown = false;-
600 }
never executed: end of block
0
601-
602 if (filePrintersAdded
filePrintersAddedDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
) {
0-4
603 ((!(index != printerCount - 2)) ? qt_assert("index != printerCount - 2",__FILE__,743) : qt_noop());-
604 if (index == printerCount - 1
index == printerCount - 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
605 widget.location->setText(QPrintDialog::tr("Local file"));-
606 widget.type->setText(QPrintDialog::tr("Write PDF file"));-
607 widget.properties->setEnabled(true);-
608 widget.filename->setEnabled(true);-
609 QString filename = widget.filename->text();-
610 widget.filename->setText(filename);-
611 widget.lOutput->setEnabled(true);-
612 if (optionsPane
optionsPaneDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
613 optionsPane->selectPrinter(QPrinter::PdfFormat);
never executed: optionsPane->selectPrinter(QPrinter::PdfFormat);
0
614 return;
never executed: return;
0
615 }-
616 }
never executed: end of block
0
617-
618 if (printer
printerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-4
619 QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();-
620 if (ps
psDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-4
621 m_currentPrintDevice = ps->createPrintDevice(widget.printers->itemText(index));
executed 4 times by 1 test: m_currentPrintDevice = ps->createPrintDevice(widget.printers->itemText(index));
Executed by:
  • tst_QPrinter
4
622-
623 printer->setPrinterName(m_currentPrintDevice.id());-
624-
625 widget.location->setText(m_currentPrintDevice.location());-
626 widget.type->setText(m_currentPrintDevice.makeAndModel());-
627 if (optionsPane
optionsPaneDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
)
1-3
628 optionsPane->selectPrinter(QPrinter::NativeFormat);
executed 1 time by 1 test: optionsPane->selectPrinter(QPrinter::NativeFormat);
Executed by:
  • tst_QPrinter
1
629 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QPrinter
4
630}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QPrinter
4
631-
632void QUnixPrintWidgetPrivate::setOptionsPane(QPrintDialogPrivate *pane)-
633{-
634 optionsPane = pane;-
635 if (optionsPane
optionsPaneDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-3
636 optionsPane->selectPrinter(QPrinter::NativeFormat);
executed 3 times by 1 test: optionsPane->selectPrinter(QPrinter::NativeFormat);
Executed by:
  • tst_QPrinter
3
637}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
638-
639void QUnixPrintWidgetPrivate::_q_btnBrowseClicked()-
640{-
641 QString filename = widget.filename->text();-
642-
643 filename = QFileDialog::getSaveFileName(parent, QPrintDialog::tr("Print To File ..."), filename,-
644 QString(), 0, QFileDialog::DontConfirmOverwrite);-
645-
646-
647-
648 if (!filename.isEmpty()
!filename.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
649 widget.filename->setText(filename);-
650 widget.printers->setCurrentIndex(widget.printers->count() - 1);-
651 }
never executed: end of block
0
652}
never executed: end of block
0
653-
654void QUnixPrintWidgetPrivate::applyPrinterProperties()-
655{-
656 if (printer == 0
printer == 0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-3
657 return;
never executed: return;
0
658 if (printer->outputFileName().isEmpty()
printer->outpu...me().isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-3
659 QString home = QDir::homePath();-
660 QString cur = QDir::currentPath();-
661 if (home.at(home.length()-1) != QLatin1Char('/')
home.at(home.l...atin1Char('/')Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-3
662 home += QLatin1Char('/');
executed 3 times by 1 test: home += QLatin1Char('/');
Executed by:
  • tst_QPrinter
3
663 if (!cur.isEmpty()
!cur.isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
&& cur.at(cur.length()-1) != QLatin1Char('/')
cur.at(cur.len...atin1Char('/')Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-3
664 cur += QLatin1Char('/');
executed 3 times by 1 test: cur += QLatin1Char('/');
Executed by:
  • tst_QPrinter
3
665 if (!cur.startsWith(home)
!cur.startsWith(home)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-3
666 cur = home;
never executed: cur = home;
0
667 if (QGuiApplication::platformName() == QLatin1String("xcb")
QGuiApplicatio...1String("xcb")Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-3
668 if (printer->docName().isEmpty()
printer->docName().isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-3
669 cur += QLatin1String("print.pdf");-
670 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
else {
3
671 QRegExp re(QString::fromLatin1("(.*)\\.\\S+"));-
672 if (re.exactMatch(printer->docName())
re.exactMatch(...er->docName())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
673 cur += re.cap(1);
never executed: cur += re.cap(1);
0
674 else-
675 cur += printer->docName();
never executed: cur += printer->docName();
0
676 cur += QLatin1String(".pdf");-
677 }
never executed: end of block
0
678 }-
679-
680 widget.filename->setText(cur);-
681 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
682 else-
683 widget.filename->setText( printer->outputFileName() );
never executed: widget.filename->setText( printer->outputFileName() );
0
684 QString printerName = printer->printerName();-
685 if (!printerName.isEmpty()
!printerName.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
) {
0-3
686 const int i = widget.printers->findText(printerName);-
687 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
688 widget.printers->setCurrentIndex(i);
never executed: widget.printers->setCurrentIndex(i);
0
689 }
never executed: end of block
0
690-
691-
692 if (propertiesDialog
propertiesDialogDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-3
693 propertiesDialog->applyPrinterProperties(printer);
never executed: propertiesDialog->applyPrinterProperties(printer);
0
694}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
695-
696-
697bool QUnixPrintWidgetPrivate::checkFields()-
698{-
699 if (widget.filename->isEnabled()
widget.filename->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
700 QString file = widget.filename->text();-
701 QFile f(file);-
702 QFileInfo fi(f);-
703 bool exists = fi.exists();-
704 bool opened = false;-
705 if (exists
existsDescription
TRUEnever evaluated
FALSEnever evaluated
&& fi.isDir()
fi.isDir()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
706 QMessageBox::warning(q, q->windowTitle(),-
707 QPrintDialog::tr("%1 is a directory.\nPlease choose a different file name.").arg(file));-
708 return
never executed: return false;
false;
never executed: return false;
0
709 } else if ((exists
existsDescription
TRUEnever evaluated
FALSEnever evaluated
&& !fi.isWritable()
!fi.isWritable()Description
TRUEnever evaluated
FALSEnever evaluated
) || !(opened = f.open(QFile::Append))
!(opened = f.o...File::Append))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
710 QMessageBox::warning(q, q->windowTitle(),-
711 QPrintDialog::tr("File %1 is not writable.\nPlease choose a different file name.").arg(file));-
712 return
never executed: return false;
false;
never executed: return false;
0
713 } else if (exists
existsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
714 int ret = QMessageBox::question(q, q->windowTitle(),-
715 QPrintDialog::tr("%1 already exists.\nDo you want to overwrite it?").arg(file),-
716 QMessageBox::Yes|QMessageBox::No, QMessageBox::No);-
717 if (ret == QMessageBox::No
ret == QMessageBox::NoDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
718 return
never executed: return false;
false;
never executed: return false;
0
719 }
never executed: end of block
0
720 if (opened
openedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
721 f.close();-
722 if (!exists
!existsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
723 f.remove();
never executed: f.remove();
0
724 }
never executed: end of block
0
725 }
never executed: end of block
0
726-
727-
728 if (propertiesDialogShown
propertiesDialogShownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
729 QCUPSSupport::PagesPerSheet pagesPerSheet = propertiesDialog->widget.pageSetup->m_ui.pagesPerSheetCombo-
730 ->currentData().value<QCUPSSupport::PagesPerSheet>();-
731-
732 QCUPSSupport::PageSet pageSet = optionsPane->options.pageSetCombo->currentData().value<QCUPSSupport::PageSet>();-
733-
734-
735 if (pagesPerSheet != QCUPSSupport::OnePagePerSheet
pagesPerSheet ...nePagePerSheetDescription
TRUEnever evaluated
FALSEnever evaluated
0
736 && pageSet != QCUPSSupport::AllPages
pageSet != QCU...port::AllPagesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
737 QMessageBox::warning(q, q->windowTitle(),-
738 QPrintDialog::tr("Options 'Pages Per Sheet' and 'Page Set' cannot be used together.\nPlease turn one of those options off."));-
739 return
never executed: return false;
false;
never executed: return false;
0
740 }-
741 }
never executed: end of block
0
742-
743-
744-
745 return
never executed: return true;
true;
never executed: return true;
0
746}-
747-
748-
749void QUnixPrintWidgetPrivate::setupPrinterProperties()-
750{-
751 if (propertiesDialog
propertiesDialogDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
752 delete propertiesDialog;
never executed: delete propertiesDialog;
0
753-
754 propertiesDialog = new QPrintPropertiesDialog(q);-
755 propertiesDialog->setResult(QDialog::Rejected);-
756 propertiesDialogShown = false;-
757-
758 propertiesDialog->applyPrinterProperties(q->printer());-
759-
760 if (q->isOptionEnabled(QPrintDialog::PrintToFile)
q->isOptionEna...::PrintToFile)Description
TRUEnever evaluated
FALSEnever evaluated
0
761 && (
(widget.printe...->count() - 1)Description
TRUEnever evaluated
FALSEnever evaluated
widget.printers->currentIndex() == widget.printers->count() - 1)
(widget.printe...->count() - 1)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
762 propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString());-
763 }
never executed: end of block
0
764 else-
765 propertiesDialog->selectPrinter(QPrinter::NativeFormat, widget.printers->currentText());
never executed: propertiesDialog->selectPrinter(QPrinter::NativeFormat, widget.printers->currentText());
0
766}-
767-
768void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked()-
769{-
770 if (!propertiesDialog
!propertiesDialogDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
771 setupPrinterProperties();
never executed: setupPrinterProperties();
0
772 propertiesDialog->exec();-
773 if (!propertiesDialogShown
!propertiesDialogShownDescription
TRUEnever evaluated
FALSEnever evaluated
&& propertiesDialog->result() == QDialog::Rejected
propertiesDial...alog::RejectedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
774-
775-
776 delete propertiesDialog;-
777 propertiesDialog = 0;-
778 propertiesDialogShown = false;-
779 }
never executed: end of block
else
0
780-
781 propertiesDialogShown = true;
never executed: propertiesDialogShown = true;
0
782}-
783-
784void QUnixPrintWidgetPrivate::setupPrinter()-
785{-
786 const int printerCount = widget.printers->count();-
787 const int index = widget.printers->currentIndex();-
788-
789 if (filePrintersAdded
filePrintersAddedDescription
TRUEnever evaluated
FALSEnever evaluated
&& index == printerCount - 1
index == printerCount - 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
790 printer->setPrinterName(QString());-
791 ((!(index != printerCount - 2)) ? qt_assert("index != printerCount - 2",__FILE__,931) : qt_noop());-
792 printer->setOutputFormat(QPrinter::PdfFormat);-
793 QString path = widget.filename->text();-
794 if (QDir::isRelativePath(path)
QDir::isRelativePath(path)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
795 path = QDir::homePath() + QDir::separator() + path;
never executed: path = QDir::homePath() + QDir::separator() + path;
0
796 printer->setOutputFileName(path);-
797 }
never executed: end of block
0
798 else {-
799 printer->setPrinterName(widget.printers->currentText());-
800 printer->setOutputFileName(QString());-
801 }
never executed: end of block
0
802-
803 if (!propertiesDialog
!propertiesDialogDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
804 setupPrinterProperties();
never executed: setupPrinterProperties();
0
805-
806 if (propertiesDialog->result() == QDialog::Accepted
propertiesDial...alog::AcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
|| !propertiesDialogShown
!propertiesDialogShownDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
807 propertiesDialog->setupPrinter();
never executed: propertiesDialog->setupPrinter();
0
808}
never executed: end of block
0
809-
810-
811-
812QUnixPrintWidget::QUnixPrintWidget(QPrinter *printer, QWidget *parent)-
813 : QWidget(parent), d(new QUnixPrintWidgetPrivate(this, printer))-
814{-
815 d->applyPrinterProperties();-
816}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
817-
818-
819-
820QUnixPrintWidget::~QUnixPrintWidget()-
821{-
822 delete d;-
823}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
824-
825-
826-
827-
828-
829void QUnixPrintWidget::updatePrinter()-
830{-
831 d->setupPrinter();-
832}
never executed: end of block
0
833-
834-
835-
836-
837-
838-
839-
840-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9