9#include <QFontDatabase>
13#include <QTableWidget>
14#include <QTableWidgetItem>
17#include <QPrintEngine>
19#include <kernel/qprintdevice_p.h>
24
25
26
27
28
29
30
31
36 m_printDevice(printDevice)
54 QCUPSSupport::setJobHold(m_printer, jobHold(), jobHoldTime());
55 QCUPSSupport::setJobBilling(m_printer, jobBilling());
56 QCUPSSupport::setJobPriority(m_printer, jobPriority());
57 QCUPSSupport::setBannerPages(m_printer, startBannerPage(), endBannerPage());
62 m_savedJobHoldWithTime = { jobHold(), jobHoldTime() };
63 m_savedJobBilling = jobBilling();
64 m_savedPriority = jobPriority();
65 m_savedJobSheets = { startBannerPage(), endBannerPage() };
70 setJobHold(m_savedJobHoldWithTime.jobHold, m_savedJobHoldWithTime.time);
73 setJobBilling(m_savedJobBilling);
75 setJobPriority(m_savedPriority);
77 setStartBannerPage(m_savedJobSheets.startBannerPage);
78 setEndBannerPage(m_savedJobSheets.endBannerPage);
83 m_ui.jobHoldComboBox->addItem(tr(
"Print Immediately"), QVariant::fromValue(QCUPSSupport::NoHold));
84 m_ui.jobHoldComboBox->addItem(tr(
"Hold Indefinitely"), QVariant::fromValue(QCUPSSupport::Indefinite));
85 m_ui.jobHoldComboBox->addItem(tr(
"Day (06:00 to 17:59)"), QVariant::fromValue(QCUPSSupport::DayTime));
86 m_ui.jobHoldComboBox->addItem(tr(
"Night (18:00 to 05:59)"), QVariant::fromValue(QCUPSSupport::Night));
87 m_ui.jobHoldComboBox->addItem(tr(
"Second Shift (16:00 to 23:59)"), QVariant::fromValue(QCUPSSupport::SecondShift));
88 m_ui.jobHoldComboBox->addItem(tr(
"Third Shift (00:00 to 07:59)"), QVariant::fromValue(QCUPSSupport::ThirdShift));
89 m_ui.jobHoldComboBox->addItem(tr(
"Weekend (Saturday to Sunday)"), QVariant::fromValue(QCUPSSupport::Weekend));
90 m_ui.jobHoldComboBox->addItem(tr(
"Specific Time"), QVariant::fromValue(QCUPSSupport::SpecificTime));
92 connect(m_ui.jobHoldComboBox, &QComboBox::currentIndexChanged,
this, &QCupsJobWidget::toggleJobHoldTime);
94 QCUPSSupport::JobHoldUntilWithTime jobHoldWithTime;
97 const QString jobHoldUntilString = m_printDevice->property(PDPK_CupsJobHoldUntil).toString();
98 jobHoldWithTime = QCUPSSupport::parseJobHoldUntil(jobHoldUntilString);
101 setJobHold(jobHoldWithTime.jobHold, jobHoldWithTime.time);
105void QCupsJobWidget::setJobHold(QCUPSSupport::JobHoldUntil jobHold, QTime holdUntilTime)
107 if (jobHold == QCUPSSupport::SpecificTime && holdUntilTime.isNull()) {
108 jobHold = QCUPSSupport::NoHold;
111 m_ui.jobHoldComboBox->setCurrentIndex(m_ui.jobHoldComboBox->findData(QVariant::fromValue(jobHold)));
112 m_ui.jobHoldTimeEdit->setTime(holdUntilTime);
117 return qvariant_cast<QCUPSSupport::JobHoldUntil>(m_ui.jobHoldComboBox->itemData(m_ui.jobHoldComboBox->currentIndex()));
122 if (jobHold() == QCUPSSupport::SpecificTime)
123 m_ui.jobHoldTimeEdit->setEnabled(
true);
125 m_ui.jobHoldTimeEdit->setEnabled(
false);
130 return m_ui.jobHoldTimeEdit->time();
137 jobBilling = m_printDevice->property(PDPK_CupsJobBilling).toString();
139 setJobBilling(jobBilling);
144 m_ui.jobBillingLineEdit->setText(jobBilling);
149 return m_ui.jobBillingLineEdit->text();
157 priority = m_printDevice->property(PDPK_CupsJobPriority).toInt(&ok);
162 if (priority < 0 || priority > 100)
165 setJobPriority(priority);
170 m_ui.jobPrioritySpinBox->setValue(jobPriority);
175 return m_ui.jobPrioritySpinBox->value();
180 m_ui.startBannerPageCombo->addItem(tr(
"None",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::NoBanner));
181 m_ui.startBannerPageCombo->addItem(tr(
"Standard",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Standard));
182 m_ui.startBannerPageCombo->addItem(tr(
"Unclassified",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Unclassified));
183 m_ui.startBannerPageCombo->addItem(tr(
"Confidential",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Confidential));
184 m_ui.startBannerPageCombo->addItem(tr(
"Classified",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Classified));
185 m_ui.startBannerPageCombo->addItem(tr(
"Secret",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Secret));
186 m_ui.startBannerPageCombo->addItem(tr(
"Top Secret",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::TopSecret));
188 m_ui.endBannerPageCombo->addItem(tr(
"None",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::NoBanner));
189 m_ui.endBannerPageCombo->addItem(tr(
"Standard",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Standard));
190 m_ui.endBannerPageCombo->addItem(tr(
"Unclassified",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Unclassified));
191 m_ui.endBannerPageCombo->addItem(tr(
"Confidential",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Confidential));
192 m_ui.endBannerPageCombo->addItem(tr(
"Classified",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Classified));
193 m_ui.endBannerPageCombo->addItem(tr(
"Secret",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Secret));
194 m_ui.endBannerPageCombo->addItem(tr(
"Top Secret",
"CUPS Banner page"), QVariant::fromValue(QCUPSSupport::TopSecret));
196 QCUPSSupport::JobSheets jobSheets;
199 const QString jobSheetsString = m_printDevice->property(PDPK_CupsJobSheets).toString();
200 jobSheets = QCUPSSupport::parseJobSheets(jobSheetsString);
203 setStartBannerPage(jobSheets.startBannerPage);
204 setEndBannerPage(jobSheets.endBannerPage);
207void QCupsJobWidget::setStartBannerPage(
const QCUPSSupport::BannerPage bannerPage)
209 m_ui.startBannerPageCombo->setCurrentIndex(m_ui.startBannerPageCombo->findData(QVariant::fromValue(bannerPage)));
214 return qvariant_cast<QCUPSSupport::BannerPage>(m_ui.startBannerPageCombo->itemData(m_ui.startBannerPageCombo->currentIndex()));
217void QCupsJobWidget::setEndBannerPage(
const QCUPSSupport::BannerPage bannerPage)
219 m_ui.endBannerPageCombo->setCurrentIndex(m_ui.endBannerPageCombo->findData(QVariant::fromValue(bannerPage)));
224 return qvariant_cast<QCUPSSupport::BannerPage>(m_ui.endBannerPageCombo->itemData(m_ui.endBannerPageCombo->currentIndex()));
229#include "moc_qcupsjobwidget_p.cpp"
Combined button and popup list for selecting options.