20 #include "cupsdlogpage.h"
21 #include "cupsdconf.h"
22 #include "qdirlineedit.h"
23 #include "sizewidget.h"
26 #include <tqcombobox.h>
28 #include <tqwhatsthis.h>
30 #include <tdelocale.h>
31 #include <tdefiledialog.h>
33 CupsdLogPage::CupsdLogPage(TQWidget *parent,
const char *name)
34 : CupsdPage(parent, name)
36 setPageLabel(i18n(
"Log"));
37 setHeader(i18n(
"Log Settings"));
38 setPixmap(
"contents");
40 accesslog_ =
new QDirLineEdit(
true,
this);
41 errorlog_ =
new QDirLineEdit(
true,
this);
42 pagelog_ =
new QDirLineEdit(
true,
this);
43 maxlogsize_ =
new SizeWidget(
this);
44 loglevel_ =
new TQComboBox(
this);
46 loglevel_->insertItem(i18n(
"Detailed Debugging"));
47 loglevel_->insertItem(i18n(
"Debug Information"));
48 loglevel_->insertItem(i18n(
"General Information"));
49 loglevel_->insertItem(i18n(
"Warnings"));
50 loglevel_->insertItem(i18n(
"Errors"));
51 loglevel_->insertItem(i18n(
"No Logging"));
58 TQLabel *l1 =
new TQLabel(i18n(
"Access log:"),
this);
59 TQLabel *l2 =
new TQLabel(i18n(
"Error log:"),
this);
60 TQLabel *l3 =
new TQLabel(i18n(
"Page log:"),
this);
61 TQLabel *l4 =
new TQLabel(i18n(
"Max log size:"),
this);
62 TQLabel *l5 =
new TQLabel(i18n(
"Log level:"),
this);
64 loglevel_->setCurrentItem(2);
66 TQGridLayout *m1 =
new TQGridLayout(
this, 6, 2, 10, 7);
67 m1->setRowStretch(5, 1);
68 m1->setColStretch(1, 1);
69 m1->addWidget(l1, 0, 0, TQt::AlignRight);
70 m1->addWidget(l2, 1, 0, TQt::AlignRight);
71 m1->addWidget(l3, 2, 0, TQt::AlignRight);
72 m1->addWidget(l4, 3, 0, TQt::AlignRight);
73 m1->addWidget(l5, 4, 0, TQt::AlignRight);
74 m1->addWidget(accesslog_, 0, 1);
75 m1->addWidget(errorlog_, 1, 1);
76 m1->addWidget(pagelog_, 2, 1);
77 m1->addWidget(maxlogsize_, 3, 1);
78 m1->addWidget(loglevel_, 4, 1);
81 bool CupsdLogPage::loadConfig(CupsdConf *conf, TQString&)
84 accesslog_->setURL(conf_->accesslog_);
85 errorlog_->setURL(conf_->errorlog_);
86 pagelog_->setURL(conf_->pagelog_);
87 maxlogsize_->setSizeString(conf_->maxlogsize_);
88 loglevel_->setCurrentItem(conf_->loglevel_);
93 bool CupsdLogPage::saveConfig(CupsdConf *conf, TQString&)
95 conf->accesslog_ = accesslog_->url();
96 conf->errorlog_ = errorlog_->url();
97 conf->pagelog_ = pagelog_->url();
98 conf->maxlogsize_ = maxlogsize_->sizeString();
99 conf->loglevel_ = loglevel_->currentItem();
104 void CupsdLogPage::setInfos(CupsdConf *conf)
106 TQWhatsThis::add(accesslog_, conf->comments_.toolTip(
"accesslog"));
107 TQWhatsThis::add(errorlog_, conf->comments_.toolTip(
"errorlog"));
108 TQWhatsThis::add(pagelog_, conf->comments_.toolTip(
"pagelog"));
109 TQWhatsThis::add(maxlogsize_, conf->comments_.toolTip(
"maxlogsize"));
110 TQWhatsThis::add(loglevel_, conf->comments_.toolTip(
"loglevel"));