20 #include "cupsdjobspage.h"
21 #include "cupsdconf.h"
24 #include <tqcheckbox.h>
26 #include <tqwhatsthis.h>
28 #include <tdelocale.h>
29 #include <knuminput.h>
31 CupsdJobsPage::CupsdJobsPage(TQWidget *parent,
const char *name)
32 : CupsdPage(parent, name)
34 setPageLabel(i18n(
"Jobs"));
35 setHeader(i18n(
"Print Jobs Settings"));
36 setPixmap(
"document-print");
38 keepjobhistory_ =
new TQCheckBox(i18n(
"Preserve job history"),
this);
39 keepjobfiles_ =
new TQCheckBox(i18n(
"Preserve job files"),
this);
40 autopurgejobs_ =
new TQCheckBox(i18n(
"Auto purge jobs"),
this);
41 maxjobs_ =
new KIntNumInput(
this);
42 maxjobsperprinter_ =
new KIntNumInput(
this);
43 maxjobsperuser_ =
new KIntNumInput(
this);
45 maxjobs_->setRange(0, 1000, 1,
true);
46 maxjobs_->setSteps(1, 10);
47 maxjobs_->setSpecialValueText(i18n(
"Unlimited"));
48 maxjobsperprinter_->setRange(0, 1000, 1,
true);
49 maxjobsperprinter_->setSpecialValueText(i18n(
"Unlimited"));
50 maxjobsperprinter_->setSteps(1, 10);
51 maxjobsperuser_->setRange(0, 1000, 1,
true);
52 maxjobsperuser_->setSpecialValueText(i18n(
"Unlimited"));
53 maxjobsperuser_->setSteps(1, 10);
55 TQLabel *l1 =
new TQLabel(i18n(
"Max jobs:"),
this);
56 TQLabel *l2 =
new TQLabel(i18n(
"Max jobs per printer:"),
this);
57 TQLabel *l3 =
new TQLabel(i18n(
"Max jobs per user:"),
this);
59 TQGridLayout *m1 =
new TQGridLayout(
this, 7, 2, 10, 7);
60 m1->setRowStretch(6, 1);
61 m1->setColStretch(1, 1);
62 m1->addWidget(keepjobhistory_, 0, 1);
63 m1->addWidget(keepjobfiles_, 1, 1);
64 m1->addWidget(autopurgejobs_, 2, 1);
65 m1->addWidget(l1, 3, 0, TQt::AlignRight);
66 m1->addWidget(l2, 4, 0, TQt::AlignRight);
67 m1->addWidget(l3, 5, 0, TQt::AlignRight);
68 m1->addWidget(maxjobs_, 3, 1);
69 m1->addWidget(maxjobsperprinter_, 4, 1);
70 m1->addWidget(maxjobsperuser_, 5, 1);
72 connect(keepjobhistory_, TQ_SIGNAL(toggled(
bool)), TQ_SLOT(historyChanged(
bool)));
73 keepjobhistory_->setChecked(
true);
76 bool CupsdJobsPage::loadConfig(CupsdConf *conf, TQString&)
79 keepjobhistory_->setChecked(conf_->keepjobhistory_);
80 if (conf_->keepjobhistory_)
82 keepjobfiles_->setChecked(conf_->keepjobfiles_);
83 autopurgejobs_->setChecked(conf_->autopurgejobs_);
85 maxjobs_->setValue(conf_->maxjobs_);
86 maxjobsperprinter_->setValue(conf_->maxjobsperprinter_);
87 maxjobsperuser_->setValue(conf_->maxjobsperuser_);
92 bool CupsdJobsPage::saveConfig(CupsdConf *conf, TQString&)
94 conf->keepjobhistory_ = keepjobhistory_->isChecked();
95 if (conf->keepjobhistory_)
97 conf->keepjobfiles_ = keepjobfiles_->isChecked();
98 conf->autopurgejobs_ = autopurgejobs_->isChecked();
100 conf->maxjobs_ = maxjobs_->value();
101 conf->maxjobsperprinter_ = maxjobsperprinter_->value();
102 conf->maxjobsperuser_ = maxjobsperuser_->value();
107 void CupsdJobsPage::setInfos(CupsdConf *conf)
109 TQWhatsThis::add(keepjobhistory_, conf->comments_.toolTip(
"preservejobhistory"));
110 TQWhatsThis::add(keepjobfiles_, conf->comments_.toolTip(
"preservejobfiles"));
111 TQWhatsThis::add(autopurgejobs_, conf->comments_.toolTip(
"autopurgejobs"));
112 TQWhatsThis::add(maxjobs_, conf->comments_.toolTip(
"maxjobs"));
113 TQWhatsThis::add(maxjobsperprinter_, conf->comments_.toolTip(
"maxjobsperprinter"));
114 TQWhatsThis::add(maxjobsperuser_, conf->comments_.toolTip(
"maxjobsperuser"));
117 void CupsdJobsPage::historyChanged(
bool on)
119 keepjobfiles_->setEnabled(on);
120 autopurgejobs_->setEnabled(on);
123 #include "cupsdjobspage.moc"