@@ -133,6 +133,9 @@ private Q_SLOTS:
133
133
bool anyAdvancedOptionConflict () const ;
134
134
135
135
136
+ Ui::QPrintPropertiesWidget widget;
137
+ QDialogButtonBox *m_buttons;
138
+
136
139
Ui::QPrintPropertiesWidget widget;
137
140
QDialogButtonBox *m_buttons;
138
141
QPrintDevice *m_currentPrintDevice;
@@ -324,6 +327,24 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrintDevice *
324
327
widget.tabs ->setTabEnabled (advancedTabIndex, false );
325
328
}
326
329
330
+ if (currentPrintDevice->isFeatureAvailable (QPrintDevice::PDPK_JobHold, QVariant())
331
+ || currentPrintDevice->isFeatureAvailable(QPrintDevice::PDPK_JobBillingInfo, QVariant())
332
+ || currentPrintDevice->isFeatureAvailable(QPrintDevice::PDPK_JobPriority, QVariant())
333
+ || currentPrintDevice->isFeatureAvailable(QPrintDevice::PDPK_JobStartCoverPage, QVariant())
334
+ || currentPrintDevice->isFeatureAvailable(QPrintDevice::PDPK_JobEndCoverPage, QVariant()))
335
+ {
336
+ m_jobOptions = new QPrintJobWidget (printer, currentPrintDevice, this );
337
+ widget.tabs ->insertTab (1 , m_jobOptions, tr (" Job Options" ));
338
+ }
339
+
340
+ const int advancedTabIndex = widget.tabs->indexOf (widget.cupsPropertiesPage);
341
+ if (currentPrintDevice->isFeatureAvailable (QPrintDevice::PDPK_AdvancedOptions, QVariant())) {
342
+ widget.tabs ->setTabEnabled (advancedTabIndex, true );
343
+ widget.scrollArea ->setWidget (createAdvancedOptionsWidget (currentPrintDevice));
344
+ } else {
345
+ widget.tabs ->setTabEnabled (advancedTabIndex, false );
346
+ }
347
+
327
348
widget.conflictsLabel->setVisible (anyAdvancedOptionConflict());
328
349
}
329
350
@@ -341,6 +362,9 @@ void QPrintPropertiesDialog::setupPrinter() const
341
362
if (m_jobOptions)
342
363
m_currentPrintDevice->setProperty (QPrintDevice::PDPK_AdvancedOptions, QVariant (QByteArray (" #clear#" )));
343
364
365
+ widget.pageSetup ->setupPrinter ();
366
+ m_currentPrintDevice->setProperty (QPrintDevice::PDPK_AdvancedOptions, QVariant (QByteArray (" #clear#" )));
367
+
344
368
widget.pageSetup ->setupPrinter ();
345
369
346
370
if (m_jobOptions) {
@@ -533,6 +557,10 @@ static const char *ppdOptionProperty = "_q_ppd_option";
533
557
QDialog::showEvent (event);
534
558
}
535
559
560
+ widget.conflictsLabel->setVisible (anyAdvancedOptionConflict());
561
+ QDialog::showEvent (event);
562
+ }
563
+
536
564
// Used to store the option name for each QComboBox that represents an advanced option
537
565
static const char *optionNameProperty = " _q_print_option_name" ;
538
566
@@ -651,6 +679,9 @@ bool QPrintPropertiesDialog::createAdvancedOptionsWidget()
651
679
652
680
if (qstrcmp (option->defchoice , selectedChoice) != 0 )
653
681
void QPrintPropertiesDialog::setPrinterAdvancedOptions () const
682
+ {
683
+ for (const QComboBox *choicesCb : m_advancedOptionsCombos) {
684
+ void QPrintPropertiesDialog::setPrinterAdvancedOptions () const
654
685
{
655
686
for (const QComboBox *choicesCb : m_advancedOptionsCombos) {
656
687
QByteArray optionName = qvariant_cast<QByteArray>(choicesCb->property (optionNameProperty));
@@ -809,6 +840,7 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma
809
840
options.duplexShort ->setEnabled (supportedDuplexMode.contains (QPrint::DuplexShortSide));
810
841
811
842
// support feature PDPK_AdvancedColorMode if you want to display Color option separately
843
+ // among other advanced options in QPrintProperties dialog (eg. CUPS)
812
844
if (top->d ->m_currentPrintDevice .isFeatureAvailable (QPrintDevice::PDPK_AdvancedColorMode, QVariant ())) {
813
845
options.colorMode ->setEnabled (false );
814
846
} else {
@@ -891,6 +923,10 @@ void QPrintDialogPrivate::updatePpdDuplexOption(QRadioButton *radio)
891
923
&& top->d ->m_currentPrintDevice .isFeatureAvailable (QPrintDevice::PDPK_PageRange, QVariant ()));
892
924
}
893
925
926
+ options.pagesRadioButton ->setEnabled (outputFormat != QPrinter::PdfFormat
927
+ && top->d ->m_currentPrintDevice .isFeatureAvailable (QPrintDevice::PDPK_PageRange, QVariant ()));
928
+ }
929
+
894
930
void QPrintDialogPrivate::setExplicitDuplexMode (QRadioButton *radio)
895
931
{
896
932
const bool checked = radio->isChecked ();
@@ -1020,6 +1056,25 @@ void QPrintDialogPrivate::setupPrinter()
1020
1056
options.pageSetCombo ->itemData (options.pageSetCombo ->currentIndex ()));
1021
1057
}
1022
1058
1059
+ if (options.pagesRadioButton ->isEnabled () && options.pagesRadioButton ->isChecked ()) {
1060
+ QString pageRange = options.pagesLineEdit ->text ();
1061
+ const QPageRanges ranges = QPageRanges::fromString (pageRange);
1062
+ if (!ranges.isEmpty ()) {
1063
+ p->setPrintRange (QPrinter::PageRange);
1064
+ p->setPageRanges (ranges);
1065
+ }
1066
+ top->d ->m_currentPrintDevice .setProperty (QPrintDevice::PDPK_PageRange, pageRange);
1067
+ }
1068
+ if (!q->testOption (QPrintDialog::PrintPageRange) && options.printRange ->isChecked ()) {
1069
+ QString pageRange = tr (" %1-%2" ).arg (options.from ->value ()).arg (qMax (options.from ->value (),options.to ->value ()));
1070
+ top->d ->m_currentPrintDevice .setProperty (QPrintDevice::PDPK_PageRange, pageRange);
1071
+ }
1072
+
1073
+ if (options.pageSetCombo ->isEnabled ()) {
1074
+ top->d ->m_currentPrintDevice .setProperty (QPrintDevice::PDPK_PageSet,
1075
+ options.pageSetCombo ->itemData (options.pageSetCombo ->currentIndex ()));
1076
+ }
1077
+
1023
1078
if (options.colorMode ->isEnabled ()) {
1024
1079
p->setColorMode (options.color ->isChecked () ? QPrinter::Color : QPrinter::GrayScale);
1025
1080
}
0 commit comments