| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/printsupport/dialogs/qprintdialog_unix.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | static void initResources() | - | ||||||||||||||||||
| 11 | { | - | ||||||||||||||||||
| 12 | do { extern int qInitResources_qprintdialog (); qInitResources_qprintdialog (); } while (0); | - | ||||||||||||||||||
| 13 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | class QOptionTreeItem; | - | ||||||||||||||||||
| 18 | class QPPDOptionsModel; | - | ||||||||||||||||||
| 19 | - | |||||||||||||||||||
| 20 | class 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 {}; | - | ||||||||||||||||||
| 27 | public: | - | ||||||||||||||||||
| 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 | - | |||||||||||||||||||
| 37 | private: | - | ||||||||||||||||||
| 38 | friend class QUnixPrintWidgetPrivate; | - | ||||||||||||||||||
| 39 | Ui::QPrintPropertiesWidget widget; | - | ||||||||||||||||||
| 40 | QDialogButtonBox *m_buttons; | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | QCupsJobWidget *m_jobOptions; | - | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | }; | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | class QUnixPrintWidgetPrivate; | - | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | class 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 | - | |||||||||||||||||||
| 56 | public: | - | ||||||||||||||||||
| 57 | explicit QUnixPrintWidget(QPrinter *printer, QWidget *parent = 0); | - | ||||||||||||||||||
| 58 | ~QUnixPrintWidget(); | - | ||||||||||||||||||
| 59 | void updatePrinter(); | - | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | private: | - | ||||||||||||||||||
| 62 | friend class QPrintDialogPrivate; | - | ||||||||||||||||||
| 63 | friend class QUnixPrintWidgetPrivate; | - | ||||||||||||||||||
| 64 | QUnixPrintWidgetPrivate *d; | - | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | }; | - | ||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | class QUnixPrintWidgetPrivate | - | ||||||||||||||||||
| 71 | { | - | ||||||||||||||||||
| 72 | public: | - | ||||||||||||||||||
| 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 | - | |||||||||||||||||||
| 96 | private: | - | ||||||||||||||||||
| 97 | QPrintDialogPrivate *optionsPane; | - | ||||||||||||||||||
| 98 | bool filePrintersAdded; | - | ||||||||||||||||||
| 99 | bool propertiesDialogShown; | - | ||||||||||||||||||
| 100 | }; | - | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | class 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: | - | ||||||||||||||||||
| 106 | public: | - | ||||||||||||||||||
| 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 | }; | - | ||||||||||||||||||
| 134 | QPrintPropertiesDialog::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__ ":" "240"), this, qFlagLocation("1""accept()" "\0" __FILE__ ":" "240")); | - | ||||||||||||||||||
| 147 | connect(m_buttons->button(QDialogButtonBox::Cancel), qFlagLocation("2""clicked()" "\0" __FILE__ ":" "241"), this, qFlagLocation("1""reject()" "\0" __FILE__ ":" "241")); | - | ||||||||||||||||||
| 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 | - | |||||||||||||||||||
| 155 | QPrintPropertiesDialog::~QPrintPropertiesDialog() | - | ||||||||||||||||||
| 156 | { | - | ||||||||||||||||||
| 157 | } | - | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | void 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 | - | |||||||||||||||||||
| 167 | void QPrintPropertiesDialog::setupPrinter() const | - | ||||||||||||||||||
| 168 | { | - | ||||||||||||||||||
| 169 | widget.pageSetup->setupPrinter(); | - | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | m_jobOptions->setupPrinter(); | - | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | } never executed:  end of block | 0 | ||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | void QPrintPropertiesDialog::selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName) | - | ||||||||||||||||||
| 176 | { | - | ||||||||||||||||||
| 177 | widget.pageSetup->selectPrinter(outputFormat, printerName); | - | ||||||||||||||||||
| 178 | } never executed:  end of block | 0 | ||||||||||||||||||
| 179 | QPrintDialogPrivate::QPrintDialogPrivate() | - | ||||||||||||||||||
| 180 | : top(0), bottom(0), buttons(0), collapseButton(0) | - | ||||||||||||||||||
| 181 | { | - | ||||||||||||||||||
| 182 | initResources(); | - | ||||||||||||||||||
| 183 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | QPrintDialogPrivate::~QPrintDialogPrivate() | - | ||||||||||||||||||
| 186 | { | - | ||||||||||||||||||
| 187 | } | - | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | void 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__ ":" "334"), q, qFlagLocation("1""_q_checkFields()" "\0" __FILE__ ":" "334")); | - | ||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | QObject::connect(buttons, qFlagLocation("2""rejected()" "\0" __FILE__ ":" "336"), q, qFlagLocation("1""reject()" "\0" __FILE__ ":" "336")); | - | ||||||||||||||||||
| 231 | - | |||||||||||||||||||
| 232 | QObject::connect(options.printSelection, qFlagLocation("2""toggled(bool)" "\0" __FILE__ ":" "338"), | - | ||||||||||||||||||
| 233 | q, qFlagLocation("1""_q_togglePageSetCombo(bool)" "\0" __FILE__ ":" "339")); | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | QObject::connect(options.printCurrentPage, qFlagLocation("2""toggled(bool)" "\0" __FILE__ ":" "341"), | - | ||||||||||||||||||
| 236 | q, qFlagLocation("1""_q_togglePageSetCombo(bool)" "\0" __FILE__ ":" "342")); | - | ||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | QObject::connect(collapseButton, qFlagLocation("2""released()" "\0" __FILE__ ":" "344"), q, qFlagLocation("1""_q_collapseOrExpandDialog()" "\0" __FILE__ ":" "344")); | - | ||||||||||||||||||
| 239 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | void 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 
 | 0-4 | ||||||||||||||||||
| 249 | options.color->setChecked(true); executed 4 times by 1 test:  options.color->setChecked(true);Executed by: 
 | 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: QPrinter::DuplexNone: case QPrinter::DuplexNone:Executed by: 
 executed 4 times by 1 test:  case QPrinter::DuplexNone:Executed by: 
 | 4 | ||||||||||||||||||
| 255 | options.noDuplex->setChecked(true); break; executed 4 times by 1 test:  break;Executed by: 
 | 4 | ||||||||||||||||||
| 256 | case never executed: QPrinter::DuplexLongSide: case QPrinter::DuplexLongSide:never executed:  case QPrinter::DuplexLongSide: | 0 | ||||||||||||||||||
| 257 | case never executed: QPrinter::DuplexAuto: case QPrinter::DuplexAuto:never executed:  case QPrinter::DuplexAuto: | 0 | ||||||||||||||||||
| 258 | options.duplexLong->setChecked(true); break; never executed:  break; | 0 | ||||||||||||||||||
| 259 | case never executed: QPrinter::DuplexShortSide: case 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 
 
 | 0-4 | ||||||||||||||||||
| 267 | || options.printCurrentPage->isChecked() 
 | 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: 
 | 4 | ||||||||||||||||||
| 272 | } | - | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | void QPrintDialogPrivate::applyPrinterProperties() | - | ||||||||||||||||||
| 275 | { | - | ||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | top->d->applyPrinterProperties(); | - | ||||||||||||||||||
| 278 | } never executed:  end of block | 0 | ||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | void 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() 
 | 0 | ||||||||||||||||||
| 290 | if (options.noDuplex->isChecked() 
 | 0 | ||||||||||||||||||
| 291 | p->setDuplex(QPrinter::DuplexNone); never executed:  p->setDuplex(QPrinter::DuplexNone); | 0 | ||||||||||||||||||
| 292 | else if (options.duplexLong->isChecked() 
 | 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() 
 | 0 | ||||||||||||||||||
| 303 | p->setPrintRange(QPrinter::AllPages); | - | ||||||||||||||||||
| 304 | p->setFromTo(0,0); | - | ||||||||||||||||||
| 305 | } never executed: else if (options.printSelection->isChecked() end of block
 | 0 | ||||||||||||||||||
| 306 | p->setPrintRange(QPrinter::Selection); | - | ||||||||||||||||||
| 307 | p->setFromTo(0,0); | - | ||||||||||||||||||
| 308 | } never executed: else if (options.printCurrentPage->isChecked() end of block
 | 0 | ||||||||||||||||||
| 309 | p->setPrintRange(QPrinter::CurrentPage); | - | ||||||||||||||||||
| 310 | p->setFromTo(0,0); | - | ||||||||||||||||||
| 311 | } never executed: else if (options.printRange->isChecked() end of block
 | 0 | ||||||||||||||||||
| 312 | if (q->isOptionEnabled(QPrintDialog::PrintPageRange) 
 | 0 | ||||||||||||||||||
| 313 | p->setPrintRange(QPrinter::PageRange); | - | ||||||||||||||||||
| 314 | p->setFromTo(options.from->value(), qMax(options.from->value(), options.to->value())); | - | ||||||||||||||||||
| 315 | } never executed: else { end of block | 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 
 
 | 0 | ||||||||||||||||||
| 326 | - | |||||||||||||||||||
| 327 | QCUPSSupport::PageSet pageSet = options.pageSetCombo->itemData(options.pageSetCombo->currentIndex()).value<QCUPSSupport::PageSet>(); | - | ||||||||||||||||||
| 328 | if (q->isOptionEnabled(QPrintDialog::PrintPageRange) 
 | 0 | ||||||||||||||||||
| 329 | && p->printRange() == QPrinter::PageRange 
 | 0 | ||||||||||||||||||
| 330 | && ( 
 
 | 0 | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | switch (pageSet) { | - | ||||||||||||||||||
| 333 | case never executed: QCUPSSupport::AllPages: case QCUPSSupport::AllPages:never executed:  case QCUPSSupport::AllPages: | 0 | ||||||||||||||||||
| 334 | break; never executed:  break; | 0 | ||||||||||||||||||
| 335 | case never executed: QCUPSSupport::OddPages: case QCUPSSupport::OddPages:never executed:  case QCUPSSupport::OddPages: | 0 | ||||||||||||||||||
| 336 | QCUPSSupport::setPageSet(p, QCUPSSupport::EvenPages); | - | ||||||||||||||||||
| 337 | break; never executed:  break; | 0 | ||||||||||||||||||
| 338 | case never executed: QCUPSSupport::EvenPages: case QCUPSSupport::EvenPages:never executed:  case QCUPSSupport::EvenPages: | 0 | ||||||||||||||||||
| 339 | QCUPSSupport::setPageSet(p, QCUPSSupport::OddPages); | - | ||||||||||||||||||
| 340 | break; never executed:  break; | 0 | ||||||||||||||||||
| 341 | } | - | ||||||||||||||||||
| 342 | } never executed: else if (pageSet != QCUPSSupport::AllPages end of block
 | 0 | ||||||||||||||||||
| 343 | QCUPSSupport::setPageSet(p, pageSet); | - | ||||||||||||||||||
| 344 | } never executed:  end of block | 0 | ||||||||||||||||||
| 345 | - | |||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 | - | |||||||||||||||||||
| 348 | if (!q->isOptionEnabled(QPrintDialog::PrintPageRange) 
 
 | 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 | - | |||||||||||||||||||
| 358 | void QPrintDialogPrivate::_q_togglePageSetCombo(bool checked) | - | ||||||||||||||||||
| 359 | { | - | ||||||||||||||||||
| 360 | if (printerOutputFormat == QPrinter::PdfFormat 
 | 0 | ||||||||||||||||||
| 361 | return; never executed:  return; | 0 | ||||||||||||||||||
| 362 | - | |||||||||||||||||||
| 363 | options.pageSetCombo->setDisabled(checked); | - | ||||||||||||||||||
| 364 | } never executed:  end of block | 0 | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | void QPrintDialogPrivate::_q_collapseOrExpandDialog() | - | ||||||||||||||||||
| 367 | { | - | ||||||||||||||||||
| 368 | int collapseHeight = 0; | - | ||||||||||||||||||
| 369 | QPrintDialog * const q = q_func(); | - | ||||||||||||||||||
| 370 | QWidget *widgetToHide = bottom; | - | ||||||||||||||||||
| 371 | if (widgetToHide->isVisible() 
 | 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() 
 | 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 | - | |||||||||||||||||||
| 385 | void QPrintDialogPrivate::_q_checkFields() | - | ||||||||||||||||||
| 386 | { | - | ||||||||||||||||||
| 387 | QPrintDialog * const q = q_func(); | - | ||||||||||||||||||
| 388 | if (top->d->checkFields() 
 | 0 | ||||||||||||||||||
| 389 | q->accept(); never executed:  q->accept(); | 0 | ||||||||||||||||||
| 390 | } never executed:  end of block | 0 | ||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | - | |||||||||||||||||||
| 393 | - | |||||||||||||||||||
| 394 | void 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) 
 | 0-1 | ||||||||||||||||||
| 409 | && (q->isOptionEnabled(QPrintDialog::PrintSelection) 
 
 | 0-1 | ||||||||||||||||||
| 410 | options.pageSetCombo->setVisible(false); | - | ||||||||||||||||||
| 411 | options.pageSetLabel->setVisible(false); | - | ||||||||||||||||||
| 412 | } never executed: else { end of block | 0 | ||||||||||||||||||
| 413 | options.pageSetCombo->setVisible(true); | - | ||||||||||||||||||
| 414 | options.pageSetLabel->setVisible(true); | - | ||||||||||||||||||
| 415 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 416 | - | |||||||||||||||||||
| 417 | if (!q->isOptionEnabled(QPrintDialog::PrintPageRange) 
 | 0-1 | ||||||||||||||||||
| 418 | - | |||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | options.gbPrintRange->setVisible(true); | - | ||||||||||||||||||
| 421 | options.printRange->setEnabled(true); | - | ||||||||||||||||||
| 422 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 423 | - | |||||||||||||||||||
| 424 | - | |||||||||||||||||||
| 425 | switch (q->printRange()) { | - | ||||||||||||||||||
| 426 | case executed 1 time by 1 test: QPrintDialog::AllPages: case QPrintDialog::AllPages:Executed by: 
 executed 1 time by 1 test:  case QPrintDialog::AllPages:Executed by: 
 | 1 | ||||||||||||||||||
| 427 | options.printAll->setChecked(true); | - | ||||||||||||||||||
| 428 | options.pageSetCombo->setEnabled(true); | - | ||||||||||||||||||
| 429 | break; executed 1 time by 1 test:  break;Executed by: 
 | 1 | ||||||||||||||||||
| 430 | case never executed: QPrintDialog::Selection: case 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: QPrintDialog::PageRange: case 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: QPrintDialog::CurrentPage: case QPrintDialog::CurrentPage:never executed:  case QPrintDialog::CurrentPage: | 0 | ||||||||||||||||||
| 439 | if (q->isOptionEnabled(QPrintDialog::PrintCurrentPage) 
 | 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 blockExecuted by: 
 | 1 | ||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | void QPrintDialogPrivate::setTabs(const QList<QWidget*> &tabWidgets) | - | ||||||||||||||||||
| 461 | { | - | ||||||||||||||||||
| 462 | QList<QWidget*>::ConstIterator iter = tabWidgets.begin(); | - | ||||||||||||||||||
| 463 | while(iter != tabWidgets.constEnd() 
 | 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 | ||||||||||||||||||
| 469 | QPrintDialog::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 blockExecuted by: 
 | 2 | ||||||||||||||||||
| 475 | - | |||||||||||||||||||
| 476 | - | |||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | QPrintDialog::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 blockExecuted by: 
 | 1 | ||||||||||||||||||
| 485 | - | |||||||||||||||||||
| 486 | QPrintDialog::~QPrintDialog() | - | ||||||||||||||||||
| 487 | { | - | ||||||||||||||||||
| 488 | } | - | ||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | void QPrintDialog::setVisible(bool visible) | - | ||||||||||||||||||
| 491 | { | - | ||||||||||||||||||
| 492 | QPrintDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 493 | - | |||||||||||||||||||
| 494 | if (visible 
 | 0-1 | ||||||||||||||||||
| 495 | d->updateWidgets(); executed 1 time by 1 test:  d->updateWidgets();Executed by: 
 | 1 | ||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | QAbstractPrintDialog::setVisible(visible); | - | ||||||||||||||||||
| 498 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 499 | - | |||||||||||||||||||
| 500 | int QPrintDialog::exec() | - | ||||||||||||||||||
| 501 | { | - | ||||||||||||||||||
| 502 | return never executed: QDialog::exec(); return QDialog::exec();never executed:  return QDialog::exec(); | 0 | ||||||||||||||||||
| 503 | } | - | ||||||||||||||||||
| 504 | - | |||||||||||||||||||
| 505 | void QPrintDialog::accept() | - | ||||||||||||||||||
| 506 | { | - | ||||||||||||||||||
| 507 | QPrintDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 508 | d->setupPrinter(); | - | ||||||||||||||||||
| 509 | QDialog::accept(); | - | ||||||||||||||||||
| 510 | } never executed:  end of block | 0 | ||||||||||||||||||
| 511 | QUnixPrintWidgetPrivate::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 
 | 0-3 | ||||||||||||||||||
| 517 | q = qobject_cast<QAbstractPrintDialog*> (parent->parent()); executed 3 times by 1 test:  q = qobject_cast<QAbstractPrintDialog*> (parent->parent());Executed by: 
 | 3 | ||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | widget.setupUi(parent); | - | ||||||||||||||||||
| 520 | - | |||||||||||||||||||
| 521 | int currentPrinterIndex = 0; | - | ||||||||||||||||||
| 522 | QStringList printers; | - | ||||||||||||||||||
| 523 | QString defaultPrinter; | - | ||||||||||||||||||
| 524 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||||||||||||||
| 525 | if (ps 
 | 0-3 | ||||||||||||||||||
| 526 | printers = ps->availablePrintDeviceIds(); | - | ||||||||||||||||||
| 527 | defaultPrinter = ps->defaultPrintDeviceId(); | - | ||||||||||||||||||
| 528 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 529 | - | |||||||||||||||||||
| 530 | for (int i = 0; i < printers.size() 
 | 0-3 | ||||||||||||||||||
| 531 | widget.printers->addItem(printers.at(i)); | - | ||||||||||||||||||
| 532 | if (printers.at(i) == defaultPrinter 
 | 0 | ||||||||||||||||||
| 533 | currentPrinterIndex = i; never executed:  currentPrinterIndex = i; | 0 | ||||||||||||||||||
| 534 | } never executed:  end of block | 0 | ||||||||||||||||||
| 535 | widget.properties->setEnabled(true); | - | ||||||||||||||||||
| 536 | - | |||||||||||||||||||
| 537 | - | |||||||||||||||||||
| 538 | QFileSystemModel *fsm = new QFileSystemModel(widget.filename); | - | ||||||||||||||||||
| 539 | fsm->setRootPath(QDir::homePath()); | - | ||||||||||||||||||
| 540 | widget.filename->setCompleter(new QCompleter(fsm, widget.filename)); | - | ||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | _q_printerChanged(currentPrinterIndex); | - | ||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | QObject::connect(widget.printers, qFlagLocation("2""currentIndexChanged(int)" "\0" __FILE__ ":" "678"), | - | ||||||||||||||||||
| 545 | parent, qFlagLocation("1""_q_printerChanged(int)" "\0" __FILE__ ":" "679")); | - | ||||||||||||||||||
| 546 | QObject::connect(widget.fileBrowser, qFlagLocation("2""clicked()" "\0" __FILE__ ":" "680"), parent, qFlagLocation("1""_q_btnBrowseClicked()" "\0" __FILE__ ":" "680")); | - | ||||||||||||||||||
| 547 | QObject::connect(widget.properties, qFlagLocation("2""clicked()" "\0" __FILE__ ":" "681"), parent, qFlagLocation("1""_q_btnPropertiesClicked()" "\0" __FILE__ ":" "681")); | - | ||||||||||||||||||
| 548 | - | |||||||||||||||||||
| 549 | - | |||||||||||||||||||
| 550 | widget.preview->setVisible(false); | - | ||||||||||||||||||
| 551 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 552 | - | |||||||||||||||||||
| 553 | void QUnixPrintWidgetPrivate::updateWidget() | - | ||||||||||||||||||
| 554 | { | - | ||||||||||||||||||
| 555 | const bool printToFile = q == 0 
 
 | 0-1 | ||||||||||||||||||
| 556 | if (printToFile 
 
 | 0-1 | ||||||||||||||||||
| 557 | if (widget.printers->count() 
 | 0-1 | ||||||||||||||||||
| 558 | widget.printers->insertSeparator(widget.printers->count()); never executed:  widget.printers->insertSeparator(widget.printers->count()); | 0 | ||||||||||||||||||
| 559 | widget.printers->addItem(QPrintDialog::tr("Print to File (PDF)")); | - | ||||||||||||||||||
| 560 | filePrintersAdded = true; | - | ||||||||||||||||||
| 561 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 562 | if (!printToFile 
 
 | 0-1 | ||||||||||||||||||
| 563 | widget.printers->removeItem(widget.printers->count()-1); | - | ||||||||||||||||||
| 564 | widget.printers->removeItem(widget.printers->count()-1); | - | ||||||||||||||||||
| 565 | if (widget.printers->count() 
 | 0 | ||||||||||||||||||
| 566 | widget.printers->removeItem(widget.printers->count()-1); never executed:  widget.printers->removeItem(widget.printers->count()-1); | 0 | ||||||||||||||||||
| 567 | filePrintersAdded = false; | - | ||||||||||||||||||
| 568 | } never executed:  end of block | 0 | ||||||||||||||||||
| 569 | if (printer 
 
 
 | 0-1 | ||||||||||||||||||
| 570 | || printer->printerName().isEmpty() 
 | 0 | ||||||||||||||||||
| 571 | { | - | ||||||||||||||||||
| 572 | if (printer->outputFormat() == QPrinter::PdfFormat 
 | 0-1 | ||||||||||||||||||
| 573 | widget.printers->setCurrentIndex(widget.printers->count() - 1); executed 1 time by 1 test:  widget.printers->setCurrentIndex(widget.printers->count() - 1);Executed by: 
 | 1 | ||||||||||||||||||
| 574 | widget.filename->setEnabled(true); | - | ||||||||||||||||||
| 575 | widget.lOutput->setEnabled(true); | - | ||||||||||||||||||
| 576 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | widget.filename->setVisible(printToFile); | - | ||||||||||||||||||
| 579 | widget.lOutput->setVisible(printToFile); | - | ||||||||||||||||||
| 580 | widget.fileBrowser->setVisible(printToFile); | - | ||||||||||||||||||
| 581 | - | |||||||||||||||||||
| 582 | widget.properties->setVisible(q->isOptionEnabled(QAbstractPrintDialog::PrintShowPageSize)); | - | ||||||||||||||||||
| 583 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||||||||
| 584 | - | |||||||||||||||||||
| 585 | QUnixPrintWidgetPrivate::~QUnixPrintWidgetPrivate() | - | ||||||||||||||||||
| 586 | { | - | ||||||||||||||||||
| 587 | } | - | ||||||||||||||||||
| 588 | - | |||||||||||||||||||
| 589 | void QUnixPrintWidgetPrivate::_q_printerChanged(int index) | - | ||||||||||||||||||
| 590 | { | - | ||||||||||||||||||
| 591 | if (index < 0 
 | 0-4 | ||||||||||||||||||
| 592 | return; never executed:  return; | 0 | ||||||||||||||||||
| 593 | const int printerCount = widget.printers->count(); | - | ||||||||||||||||||
| 594 | widget.filename->setEnabled(false); | - | ||||||||||||||||||
| 595 | widget.lOutput->setEnabled(false); | - | ||||||||||||||||||
| 596 | - | |||||||||||||||||||
| 597 | - | |||||||||||||||||||
| 598 | if (propertiesDialog 
 | 0-4 | ||||||||||||||||||
| 599 | delete propertiesDialog; | - | ||||||||||||||||||
| 600 | propertiesDialog = 0; | - | ||||||||||||||||||
| 601 | propertiesDialogShown = false; | - | ||||||||||||||||||
| 602 | } never executed:  end of block | 0 | ||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | if (filePrintersAdded 
 | 0-4 | ||||||||||||||||||
| 605 | ((!(index != printerCount - 2)) ? qt_assert("index != printerCount - 2",__FILE__,739) : qt_noop()); | - | ||||||||||||||||||
| 606 | if (index == printerCount - 1 
 | 0 | ||||||||||||||||||
| 607 | widget.location->setText(QPrintDialog::tr("Local file")); | - | ||||||||||||||||||
| 608 | widget.type->setText(QPrintDialog::tr("Write PDF file")); | - | ||||||||||||||||||
| 609 | widget.properties->setEnabled(true); | - | ||||||||||||||||||
| 610 | widget.filename->setEnabled(true); | - | ||||||||||||||||||
| 611 | QString filename = widget.filename->text(); | - | ||||||||||||||||||
| 612 | widget.filename->setText(filename); | - | ||||||||||||||||||
| 613 | widget.lOutput->setEnabled(true); | - | ||||||||||||||||||
| 614 | if (optionsPane 
 | 0 | ||||||||||||||||||
| 615 | optionsPane->selectPrinter(QPrinter::PdfFormat); never executed:  optionsPane->selectPrinter(QPrinter::PdfFormat); | 0 | ||||||||||||||||||
| 616 | return; never executed:  return; | 0 | ||||||||||||||||||
| 617 | } | - | ||||||||||||||||||
| 618 | } never executed:  end of block | 0 | ||||||||||||||||||
| 619 | - | |||||||||||||||||||
| 620 | if (printer 
 | 0-4 | ||||||||||||||||||
| 621 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||||||||||||||
| 622 | if (ps 
 | 0-4 | ||||||||||||||||||
| 623 | m_currentPrintDevice = ps->createPrintDevice(widget.printers->itemText(index)); executed 4 times by 1 test:  m_currentPrintDevice = ps->createPrintDevice(widget.printers->itemText(index));Executed by: 
 | 4 | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | printer->setPrinterName(m_currentPrintDevice.id()); | - | ||||||||||||||||||
| 626 | - | |||||||||||||||||||
| 627 | widget.location->setText(m_currentPrintDevice.location()); | - | ||||||||||||||||||
| 628 | widget.type->setText(m_currentPrintDevice.makeAndModel()); | - | ||||||||||||||||||
| 629 | if (optionsPane 
 | 1-3 | ||||||||||||||||||
| 630 | optionsPane->selectPrinter(QPrinter::NativeFormat); executed 1 time by 1 test:  optionsPane->selectPrinter(QPrinter::NativeFormat);Executed by: 
 | 1 | ||||||||||||||||||
| 631 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 632 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 633 | - | |||||||||||||||||||
| 634 | void QUnixPrintWidgetPrivate::setOptionsPane(QPrintDialogPrivate *pane) | - | ||||||||||||||||||
| 635 | { | - | ||||||||||||||||||
| 636 | optionsPane = pane; | - | ||||||||||||||||||
| 637 | if (optionsPane 
 | 0-3 | ||||||||||||||||||
| 638 | optionsPane->selectPrinter(QPrinter::NativeFormat); executed 3 times by 1 test:  optionsPane->selectPrinter(QPrinter::NativeFormat);Executed by: 
 | 3 | ||||||||||||||||||
| 639 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 640 | - | |||||||||||||||||||
| 641 | void QUnixPrintWidgetPrivate::_q_btnBrowseClicked() | - | ||||||||||||||||||
| 642 | { | - | ||||||||||||||||||
| 643 | QString filename = widget.filename->text(); | - | ||||||||||||||||||
| 644 | - | |||||||||||||||||||
| 645 | filename = QFileDialog::getSaveFileName(parent, QPrintDialog::tr("Print To File ..."), filename, | - | ||||||||||||||||||
| 646 | QString(), 0, QFileDialog::DontConfirmOverwrite); | - | ||||||||||||||||||
| 647 | - | |||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | - | |||||||||||||||||||
| 650 | if (!filename.isEmpty() 
 | 0 | ||||||||||||||||||
| 651 | widget.filename->setText(filename); | - | ||||||||||||||||||
| 652 | widget.printers->setCurrentIndex(widget.printers->count() - 1); | - | ||||||||||||||||||
| 653 | } never executed:  end of block | 0 | ||||||||||||||||||
| 654 | } never executed:  end of block | 0 | ||||||||||||||||||
| 655 | - | |||||||||||||||||||
| 656 | void QUnixPrintWidgetPrivate::applyPrinterProperties() | - | ||||||||||||||||||
| 657 | { | - | ||||||||||||||||||
| 658 | if (printer == 0 
 | 0-3 | ||||||||||||||||||
| 659 | return; never executed:  return; | 0 | ||||||||||||||||||
| 660 | if (printer->outputFileName().isEmpty() 
 | 0-3 | ||||||||||||||||||
| 661 | QString home = QDir::homePath(); | - | ||||||||||||||||||
| 662 | QString cur = QDir::currentPath(); | - | ||||||||||||||||||
| 663 | if (home.at(home.length()-1) != QLatin1Char('/') 
 | 0-3 | ||||||||||||||||||
| 664 | home += QLatin1Char('/'); executed 3 times by 1 test:  home += QLatin1Char('/');Executed by: 
 | 3 | ||||||||||||||||||
| 665 | if (!cur.isEmpty() 
 
 | 0-3 | ||||||||||||||||||
| 666 | cur += QLatin1Char('/'); executed 3 times by 1 test:  cur += QLatin1Char('/');Executed by: 
 | 3 | ||||||||||||||||||
| 667 | if (!cur.startsWith(home) 
 | 0-3 | ||||||||||||||||||
| 668 | cur = home; never executed:  cur = home; | 0 | ||||||||||||||||||
| 669 | if (QGuiApplication::platformName() == QLatin1String("xcb") 
 | 0-3 | ||||||||||||||||||
| 670 | if (printer->docName().isEmpty() 
 | 0-3 | ||||||||||||||||||
| 671 | cur += QLatin1String("print.pdf"); | - | ||||||||||||||||||
| 672 | } executed 3 times by 1 test: else { end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 673 | QRegExp re(QString::fromLatin1("(.*)\\.\\S+")); | - | ||||||||||||||||||
| 674 | if (re.exactMatch(printer->docName()) 
 | 0 | ||||||||||||||||||
| 675 | cur += re.cap(1); never executed:  cur += re.cap(1); | 0 | ||||||||||||||||||
| 676 | else | - | ||||||||||||||||||
| 677 | cur += printer->docName(); never executed:  cur += printer->docName(); | 0 | ||||||||||||||||||
| 678 | cur += QLatin1String(".pdf"); | - | ||||||||||||||||||
| 679 | } never executed:  end of block | 0 | ||||||||||||||||||
| 680 | } | - | ||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | widget.filename->setText(cur); | - | ||||||||||||||||||
| 683 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 684 | else | - | ||||||||||||||||||
| 685 | widget.filename->setText( printer->outputFileName() ); never executed:  widget.filename->setText( printer->outputFileName() ); | 0 | ||||||||||||||||||
| 686 | QString printerName = printer->printerName(); | - | ||||||||||||||||||
| 687 | if (!printerName.isEmpty() 
 | 0-3 | ||||||||||||||||||
| 688 | for (int i = 0; i < widget.printers->count() 
 | 0 | ||||||||||||||||||
| 689 | if (widget.printers->itemText(i) == printerName 
 | 0 | ||||||||||||||||||
| 690 | widget.printers->setCurrentIndex(i); | - | ||||||||||||||||||
| 691 | break; never executed:  break; | 0 | ||||||||||||||||||
| 692 | } | - | ||||||||||||||||||
| 693 | } never executed:  end of block | 0 | ||||||||||||||||||
| 694 | } never executed:  end of block | 0 | ||||||||||||||||||
| 695 | - | |||||||||||||||||||
| 696 | - | |||||||||||||||||||
| 697 | if (propertiesDialog 
 | 0-3 | ||||||||||||||||||
| 698 | propertiesDialog->applyPrinterProperties(printer); never executed:  propertiesDialog->applyPrinterProperties(printer); | 0 | ||||||||||||||||||
| 699 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 700 | - | |||||||||||||||||||
| 701 | - | |||||||||||||||||||
| 702 | bool QUnixPrintWidgetPrivate::checkFields() | - | ||||||||||||||||||
| 703 | { | - | ||||||||||||||||||
| 704 | if (widget.filename->isEnabled() 
 | 0 | ||||||||||||||||||
| 705 | QString file = widget.filename->text(); | - | ||||||||||||||||||
| 706 | QFile f(file); | - | ||||||||||||||||||
| 707 | QFileInfo fi(f); | - | ||||||||||||||||||
| 708 | bool exists = fi.exists(); | - | ||||||||||||||||||
| 709 | bool opened = false; | - | ||||||||||||||||||
| 710 | if (exists 
 
 | 0 | ||||||||||||||||||
| 711 | QMessageBox::warning(q, q->windowTitle(), | - | ||||||||||||||||||
| 712 | QPrintDialog::tr("%1 is a directory.\nPlease choose a different file name.").arg(file)); | - | ||||||||||||||||||
| 713 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||||||||
| 714 | } else if ((exists 
 
 
 | 0 | ||||||||||||||||||
| 715 | QMessageBox::warning(q, q->windowTitle(), | - | ||||||||||||||||||
| 716 | QPrintDialog::tr("File %1 is not writable.\nPlease choose a different file name.").arg(file)); | - | ||||||||||||||||||
| 717 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||||||||
| 718 | } else if (exists 
 | 0 | ||||||||||||||||||
| 719 | int ret = QMessageBox::question(q, q->windowTitle(), | - | ||||||||||||||||||
| 720 | QPrintDialog::tr("%1 already exists.\nDo you want to overwrite it?").arg(file), | - | ||||||||||||||||||
| 721 | QMessageBox::Yes|QMessageBox::No, QMessageBox::No); | - | ||||||||||||||||||
| 722 | if (ret == QMessageBox::No 
 | 0 | ||||||||||||||||||
| 723 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||||||||
| 724 | } never executed:  end of block | 0 | ||||||||||||||||||
| 725 | if (opened 
 | 0 | ||||||||||||||||||
| 726 | f.close(); | - | ||||||||||||||||||
| 727 | if (!exists 
 | 0 | ||||||||||||||||||
| 728 | f.remove(); never executed:  f.remove(); | 0 | ||||||||||||||||||
| 729 | } never executed:  end of block | 0 | ||||||||||||||||||
| 730 | } never executed:  end of block | 0 | ||||||||||||||||||
| 731 | - | |||||||||||||||||||
| 732 | - | |||||||||||||||||||
| 733 | if (propertiesDialogShown 
 | 0 | ||||||||||||||||||
| 734 | QCUPSSupport::PagesPerSheet pagesPerSheet = propertiesDialog->widget.pageSetup->m_ui.pagesPerSheetCombo | - | ||||||||||||||||||
| 735 | ->currentData().value<QCUPSSupport::PagesPerSheet>(); | - | ||||||||||||||||||
| 736 | - | |||||||||||||||||||
| 737 | QCUPSSupport::PageSet pageSet = optionsPane->options.pageSetCombo->currentData().value<QCUPSSupport::PageSet>(); | - | ||||||||||||||||||
| 738 | - | |||||||||||||||||||
| 739 | - | |||||||||||||||||||
| 740 | if (pagesPerSheet != QCUPSSupport::OnePagePerSheet 
 | 0 | ||||||||||||||||||
| 741 | && pageSet != QCUPSSupport::AllPages 
 | 0 | ||||||||||||||||||
| 742 | QMessageBox::warning(q, q->windowTitle(), | - | ||||||||||||||||||
| 743 | QPrintDialog::tr("Options 'Pages Per Sheet' and 'Page Set' cannot be used together.\nPlease turn one of those options off.")); | - | ||||||||||||||||||
| 744 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||||||||
| 745 | } | - | ||||||||||||||||||
| 746 | } never executed:  end of block | 0 | ||||||||||||||||||
| 747 | - | |||||||||||||||||||
| 748 | - | |||||||||||||||||||
| 749 | - | |||||||||||||||||||
| 750 | return never executed: true; return true;never executed:  return true; | 0 | ||||||||||||||||||
| 751 | } | - | ||||||||||||||||||
| 752 | - | |||||||||||||||||||
| 753 | - | |||||||||||||||||||
| 754 | void QUnixPrintWidgetPrivate::setupPrinterProperties() | - | ||||||||||||||||||
| 755 | { | - | ||||||||||||||||||
| 756 | if (propertiesDialog 
 | 0 | ||||||||||||||||||
| 757 | delete propertiesDialog; never executed:  delete propertiesDialog; | 0 | ||||||||||||||||||
| 758 | - | |||||||||||||||||||
| 759 | propertiesDialog = new QPrintPropertiesDialog(q); | - | ||||||||||||||||||
| 760 | propertiesDialog->setResult(QDialog::Rejected); | - | ||||||||||||||||||
| 761 | propertiesDialogShown = false; | - | ||||||||||||||||||
| 762 | - | |||||||||||||||||||
| 763 | propertiesDialog->applyPrinterProperties(q->printer()); | - | ||||||||||||||||||
| 764 | - | |||||||||||||||||||
| 765 | if (q->isOptionEnabled(QPrintDialog::PrintToFile) 
 | 0 | ||||||||||||||||||
| 766 | && ( 
 
 | 0 | ||||||||||||||||||
| 767 | propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString()); | - | ||||||||||||||||||
| 768 | } never executed:  end of block | 0 | ||||||||||||||||||
| 769 | else | - | ||||||||||||||||||
| 770 | propertiesDialog->selectPrinter(QPrinter::NativeFormat, widget.printers->currentText()); never executed:  propertiesDialog->selectPrinter(QPrinter::NativeFormat, widget.printers->currentText()); | 0 | ||||||||||||||||||
| 771 | } | - | ||||||||||||||||||
| 772 | - | |||||||||||||||||||
| 773 | void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() | - | ||||||||||||||||||
| 774 | { | - | ||||||||||||||||||
| 775 | if (!propertiesDialog 
 | 0 | ||||||||||||||||||
| 776 | setupPrinterProperties(); never executed:  setupPrinterProperties(); | 0 | ||||||||||||||||||
| 777 | propertiesDialog->exec(); | - | ||||||||||||||||||
| 778 | if (!propertiesDialogShown 
 
 | 0 | ||||||||||||||||||
| 779 | - | |||||||||||||||||||
| 780 | - | |||||||||||||||||||
| 781 | delete propertiesDialog; | - | ||||||||||||||||||
| 782 | propertiesDialog = 0; | - | ||||||||||||||||||
| 783 | propertiesDialogShown = false; | - | ||||||||||||||||||
| 784 | } never executed: else end of block | 0 | ||||||||||||||||||
| 785 | - | |||||||||||||||||||
| 786 | propertiesDialogShown = true; never executed:  propertiesDialogShown = true; | 0 | ||||||||||||||||||
| 787 | } | - | ||||||||||||||||||
| 788 | - | |||||||||||||||||||
| 789 | void QUnixPrintWidgetPrivate::setupPrinter() | - | ||||||||||||||||||
| 790 | { | - | ||||||||||||||||||
| 791 | const int printerCount = widget.printers->count(); | - | ||||||||||||||||||
| 792 | const int index = widget.printers->currentIndex(); | - | ||||||||||||||||||
| 793 | - | |||||||||||||||||||
| 794 | if (filePrintersAdded 
 
 | 0 | ||||||||||||||||||
| 795 | printer->setPrinterName(QString()); | - | ||||||||||||||||||
| 796 | ((!(index != printerCount - 2)) ? qt_assert("index != printerCount - 2",__FILE__,930) : qt_noop()); | - | ||||||||||||||||||
| 797 | printer->setOutputFormat(QPrinter::PdfFormat); | - | ||||||||||||||||||
| 798 | QString path = widget.filename->text(); | - | ||||||||||||||||||
| 799 | if (QDir::isRelativePath(path) 
 | 0 | ||||||||||||||||||
| 800 | path = QDir::homePath() + QDir::separator() + path; never executed:  path = QDir::homePath() + QDir::separator() + path; | 0 | ||||||||||||||||||
| 801 | printer->setOutputFileName(path); | - | ||||||||||||||||||
| 802 | } never executed:  end of block | 0 | ||||||||||||||||||
| 803 | else { | - | ||||||||||||||||||
| 804 | printer->setPrinterName(widget.printers->currentText()); | - | ||||||||||||||||||
| 805 | printer->setOutputFileName(QString()); | - | ||||||||||||||||||
| 806 | } never executed:  end of block | 0 | ||||||||||||||||||
| 807 | - | |||||||||||||||||||
| 808 | if (!propertiesDialog 
 | 0 | ||||||||||||||||||
| 809 | setupPrinterProperties(); never executed:  setupPrinterProperties(); | 0 | ||||||||||||||||||
| 810 | - | |||||||||||||||||||
| 811 | if (propertiesDialog->result() == QDialog::Accepted 
 
 | 0 | ||||||||||||||||||
| 812 | propertiesDialog->setupPrinter(); never executed:  propertiesDialog->setupPrinter(); | 0 | ||||||||||||||||||
| 813 | } never executed:  end of block | 0 | ||||||||||||||||||
| 814 | - | |||||||||||||||||||
| 815 | - | |||||||||||||||||||
| 816 | - | |||||||||||||||||||
| 817 | QUnixPrintWidget::QUnixPrintWidget(QPrinter *printer, QWidget *parent) | - | ||||||||||||||||||
| 818 | : QWidget(parent), d(new QUnixPrintWidgetPrivate(this, printer)) | - | ||||||||||||||||||
| 819 | { | - | ||||||||||||||||||
| 820 | d->applyPrinterProperties(); | - | ||||||||||||||||||
| 821 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 822 | - | |||||||||||||||||||
| 823 | - | |||||||||||||||||||
| 824 | - | |||||||||||||||||||
| 825 | QUnixPrintWidget::~QUnixPrintWidget() | - | ||||||||||||||||||
| 826 | { | - | ||||||||||||||||||
| 827 | delete d; | - | ||||||||||||||||||
| 828 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||
| 829 | - | |||||||||||||||||||
| 830 | - | |||||||||||||||||||
| 831 | - | |||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | - | |||||||||||||||||||
| 834 | void QUnixPrintWidget::updatePrinter() | - | ||||||||||||||||||
| 835 | { | - | ||||||||||||||||||
| 836 | d->setupPrinter(); | - | ||||||||||||||||||
| 837 | } never executed:  end of block | 0 | ||||||||||||||||||
| 838 | - | |||||||||||||||||||
| 839 | - | |||||||||||||||||||
| 840 | - | |||||||||||||||||||
| 841 | - | |||||||||||||||||||
| 842 | - | |||||||||||||||||||
| 843 | - | |||||||||||||||||||
| 844 | - | |||||||||||||||||||
| 845 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |