KDEPrint
cupsdlogpage.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 "cupsdlogpage.h"
00021 #include "cupsdconf.h"
00022 #include "qdirlineedit.h"
00023 #include "sizewidget.h"
00024
00025 #include <QtGui/QLabel>
00026 #include <QtGui/QComboBox>
00027 #include <QtGui/QLayout>
00028
00029 #include <klocale.h>
00030 #include <kfiledialog.h>
00031
00032 CupsdLogPage::CupsdLogPage(QWidget *parent)
00033 : CupsdPage(parent)
00034 {
00035 setPageLabel(i18n("Log"));
00036 setHeader(i18n("Log Settings"));
00037 setPixmap("help-contents");
00038
00039 accesslog_ = new QDirLineEdit(true, this);
00040 errorlog_ = new QDirLineEdit(true, this);
00041 pagelog_ = new QDirLineEdit(true, this);
00042 maxlogsize_ = new SizeWidget(this);
00043 loglevel_ = new QComboBox(this);
00044
00045 loglevel_->addItem(i18n("Detailed Debugging"));
00046 loglevel_->addItem(i18n("Debug Information"));
00047 loglevel_->addItem(i18n("General Information"));
00048 loglevel_->addItem(i18n("Warnings"));
00049 loglevel_->addItem(i18n("Errors"));
00050 loglevel_->addItem(i18n("No Logging"));
00051
00052
00053
00054
00055
00056
00057 QLabel *l1 = new QLabel(i18n("Access log:"), this);
00058 QLabel *l2 = new QLabel(i18n("Error log:"), this);
00059 QLabel *l3 = new QLabel(i18n("Page log:"), this);
00060 QLabel *l4 = new QLabel(i18n("Max log size:"), this);
00061 QLabel *l5 = new QLabel(i18n("Log level:"), this);
00062
00063 loglevel_->setCurrentIndex(2);
00064
00065 QGridLayout *m1 = new QGridLayout(this);
00066 m1->setMargin(10);
00067 m1->setSpacing(7);
00068 m1->setRowStretch(5, 1);
00069 m1->setColumnStretch(1, 1);
00070 m1->addWidget(l1, 0, 0, Qt::AlignRight);
00071 m1->addWidget(l2, 1, 0, Qt::AlignRight);
00072 m1->addWidget(l3, 2, 0, Qt::AlignRight);
00073 m1->addWidget(l4, 3, 0, Qt::AlignRight);
00074 m1->addWidget(l5, 4, 0, Qt::AlignRight);
00075 m1->addWidget(accesslog_, 0, 1);
00076 m1->addWidget(errorlog_, 1, 1);
00077 m1->addWidget(pagelog_, 2, 1);
00078 m1->addWidget(maxlogsize_, 3, 1);
00079 m1->addWidget(loglevel_, 4, 1);
00080 }
00081
00082 bool CupsdLogPage::loadConfig(CupsdConf *conf, QString&)
00083 {
00084 conf_ = conf;
00085 accesslog_->setUrl(conf_->accesslog_);
00086 errorlog_->setUrl(conf_->errorlog_);
00087 pagelog_->setUrl(conf_->pagelog_);
00088 maxlogsize_->setSizeString(conf_->maxlogsize_);
00089 loglevel_->setCurrentIndex(conf_->loglevel_);
00090
00091 return true;
00092 }
00093
00094 bool CupsdLogPage::saveConfig(CupsdConf *conf, QString&)
00095 {
00096 conf->accesslog_ = accesslog_->url();
00097 conf->errorlog_ = errorlog_->url();
00098 conf->pagelog_ = pagelog_->url();
00099 conf->maxlogsize_ = maxlogsize_->sizeString();
00100 conf->loglevel_ = loglevel_->currentIndex();
00101
00102 return true;
00103 }
00104
00105 void CupsdLogPage::setInfos(CupsdConf *conf)
00106 {
00107 accesslog_->setWhatsThis(conf->comments_.toolTip("accesslog"));
00108 errorlog_->setWhatsThis(conf->comments_.toolTip("errorlog"));
00109 pagelog_->setWhatsThis(conf->comments_.toolTip("pagelog"));
00110 maxlogsize_->setWhatsThis(conf->comments_.toolTip("maxlogsize"));
00111 loglevel_->setWhatsThis(conf->comments_.toolTip("loglevel"));
00112 }