20 #include "kmpropquota.h"
21 #include "kmprinter.h"
26 #include <tdelocale.h>
29 const char* unitKeyword(
int);
32 KMPropQuota::KMPropQuota(TQWidget *parent,
const char *name)
33 : KMPropWidget(parent,name)
35 m_period =
new TQLabel(
this);
36 m_sizelimit =
new TQLabel(
this);
37 m_pagelimit =
new TQLabel(
this);
39 TQLabel *l1 =
new TQLabel(i18n(
"&Period:"),
this);
40 TQLabel *l2 =
new TQLabel(i18n(
"&Size limit (KB):"),
this);
41 TQLabel *l3 =
new TQLabel(i18n(
"&Page limit:"),
this);
43 l1->setBuddy(m_period);
44 l2->setBuddy(m_sizelimit);
45 l3->setBuddy(m_pagelimit);
47 TQGridLayout *main_ =
new TQGridLayout(
this, 4, 2, 10, 10);
48 main_->setColStretch(1,1);
49 main_->setRowStretch(3,1);
50 main_->addWidget(l1,0,0);
51 main_->addWidget(l2,1,0);
52 main_->addWidget(l3,2,0);
53 main_->addWidget(m_period,0,1);
54 main_->addWidget(m_sizelimit,1,1);
55 main_->addWidget(m_pagelimit,2,1);
57 m_title = i18n(
"Quotas");
58 m_header = i18n(
"Quota Settings");
59 m_pixmap =
"system-lock-screen";
62 KMPropQuota::~KMPropQuota()
66 void KMPropQuota::setPrinter(KMPrinter *p)
68 if (p && p->isPrinter())
70 int qu(0), si(0), pa(0), un(0);
71 qu = p->option(
"job-quota-period").toInt();
72 si = p->option(
"job-k-limit").toInt();
73 pa = p->option(
"job-page-limit").toInt();
74 if (si == 0 && pa == 0)
78 m_period->setText(qu == -1 ? i18n(
"No quota") : TQString::number(qu).append(
" ").append(i18n(unitKeyword(un))));
79 m_sizelimit->setText(si ? TQString::number(si) : i18n(
"None"));
80 m_pagelimit->setText(pa ? TQString::number(pa) : i18n(
"None"));
82 emit enableChange(p->isLocal());
87 m_period->setText(
"");
88 m_sizelimit->setText(
"");
89 m_pagelimit->setText(
"");
93 void KMPropQuota::configureWizard(KMWizard *w)
95 w->configure(KMWizard::Custom+3,KMWizard::Custom+3,
true);