20 #include "cupsdfilterpage.h"
21 #include "cupsdconf.h"
22 #include "sizewidget.h"
25 #include <tqlineedit.h>
27 #include <tqwhatsthis.h>
28 #include <tqcombobox.h>
30 #include <tdelocale.h>
31 #include <knuminput.h>
33 CupsdFilterPage::CupsdFilterPage(TQWidget *parent,
const char *name)
34 : CupsdPage(parent, name)
36 setPageLabel(i18n(
"Filter"));
37 setHeader(i18n(
"Filter Settings"));
40 user_ =
new TQLineEdit(
this);
41 group_ =
new TQLineEdit(
this);
42 ripcache_ =
new SizeWidget(
this);
43 filterlimit_ =
new KIntNumInput(
this);
45 filterlimit_->setRange(0, 1000, 1,
true);
46 filterlimit_->setSpecialValueText(i18n(
"Unlimited"));
47 filterlimit_->setSteps(1, 10);
49 TQLabel *l1 =
new TQLabel(i18n(
"User:"),
this);
50 TQLabel *l2 =
new TQLabel(i18n(
"Group:"),
this);
51 TQLabel *l3 =
new TQLabel(i18n(
"RIP cache:"),
this);
52 TQLabel *l4 =
new TQLabel(i18n(
"Filter limit:"),
this);
54 TQGridLayout *m1 =
new TQGridLayout(
this, 5, 2, 10, 7);
55 m1->setRowStretch(4, 1);
56 m1->setColStretch(1, 1);
57 m1->addWidget(l1, 0, 0, TQt::AlignRight);
58 m1->addWidget(l2, 1, 0, TQt::AlignRight);
59 m1->addWidget(l3, 2, 0, TQt::AlignRight);
60 m1->addWidget(l4, 3, 0, TQt::AlignRight);
61 m1->addWidget(user_, 0, 1);
62 m1->addWidget(group_, 1, 1);
63 m1->addWidget(ripcache_, 2, 1);
64 m1->addWidget(filterlimit_, 3, 1);
67 bool CupsdFilterPage::loadConfig(CupsdConf *conf, TQString&)
70 user_->setText(conf_->user_);
71 group_->setText(conf_->group_);
72 ripcache_->setSizeString(conf_->ripcache_);
73 filterlimit_->setValue(conf_->filterlimit_);
78 bool CupsdFilterPage::saveConfig(CupsdConf *conf, TQString&)
80 conf->user_ = user_->text();
81 conf->group_ = group_->text();
82 conf->ripcache_ = ripcache_->sizeString();
83 conf->filterlimit_ = filterlimit_->value();
88 void CupsdFilterPage::setInfos(CupsdConf *conf)
90 TQWhatsThis::add(user_, conf->comments_.toolTip(
"user"));
91 TQWhatsThis::add(group_, conf->comments_.toolTip(
"group"));
92 TQWhatsThis::add(ripcache_, conf->comments_.toolTip(
"ripcache"));
93 TQWhatsThis::add(filterlimit_, conf->comments_.toolTip(
"filterlimit"));