KDEPrint
cupsdfilterpage.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "cupsdfilterpage.h"
00021 #include "cupsdconf.h"
00022 #include "sizewidget.h"
00023
00024 #include <QtGui/QLabel>
00025 #include <QtGui/QLineEdit>
00026 #include <QtGui/QLayout>
00027 #include <QtGui/QComboBox>
00028
00029 #include <klocale.h>
00030 #include <knuminput.h>
00031
00032 CupsdFilterPage::CupsdFilterPage(QWidget *parent)
00033 : CupsdPage(parent)
00034 {
00035 setPageLabel(i18n("Filter"));
00036 setHeader(i18n("Filter Settings"));
00037 setPixmap("view-filter");
00038
00039 user_ = new QLineEdit(this);
00040 group_ = new QLineEdit(this);
00041 ripcache_ = new SizeWidget(this);
00042 filterlimit_ = new KIntNumInput(this);
00043
00044 filterlimit_->setRange(0, 1000, 1, true);
00045 filterlimit_->setSpecialValueText(i18n("Unlimited"));
00046 filterlimit_->setSteps(1, 10);
00047
00048 QLabel *l1 = new QLabel(i18n("User:"), this);
00049 QLabel *l2 = new QLabel(i18n("Group:"), this);
00050 QLabel *l3 = new QLabel(i18n("RIP cache:"), this);
00051 QLabel *l4 = new QLabel(i18n("Filter limit:"), this);
00052
00053 QGridLayout *m1 = new QGridLayout(this);
00054 m1->setMargin(10);
00055 m1->setSpacing(7);
00056 m1->setRowStretch(4, 1);
00057 m1->setColumnStretch(1, 1);
00058 m1->addWidget(l1, 0, 0, Qt::AlignRight);
00059 m1->addWidget(l2, 1, 0, Qt::AlignRight);
00060 m1->addWidget(l3, 2, 0, Qt::AlignRight);
00061 m1->addWidget(l4, 3, 0, Qt::AlignRight);
00062 m1->addWidget(user_, 0, 1);
00063 m1->addWidget(group_, 1, 1);
00064 m1->addWidget(ripcache_, 2, 1);
00065 m1->addWidget(filterlimit_, 3, 1);
00066 }
00067
00068 bool CupsdFilterPage::loadConfig(CupsdConf *conf, QString&)
00069 {
00070 conf_ = conf;
00071 user_->setText(conf_->user_);
00072 group_->setText(conf_->group_);
00073 ripcache_->setSizeString(conf_->ripcache_);
00074 filterlimit_->setValue(conf_->filterlimit_);
00075
00076 return true;
00077 }
00078
00079 bool CupsdFilterPage::saveConfig(CupsdConf *conf, QString&)
00080 {
00081 conf->user_ = user_->text();
00082 conf->group_ = group_->text();
00083 conf->ripcache_ = ripcache_->sizeString();
00084 conf->filterlimit_ = filterlimit_->value();
00085
00086 return true;
00087 }
00088
00089 void CupsdFilterPage::setInfos(CupsdConf *conf)
00090 {
00091 user_->setWhatsThis(conf->comments_.toolTip("user"));
00092 group_->setWhatsThis(conf->comments_.toolTip("group"));
00093 ripcache_->setWhatsThis(conf->comments_.toolTip("ripcache"));
00094 filterlimit_->setWhatsThis(conf->comments_.toolTip("filterlimit"));
00095 }