00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#include "cupsddirpage.h"
00021
#include "cupsdconf.h"
00022
#include "qdirlineedit.h"
00023
#include "qdirmultilineedit.h"
00024
00025
#include <qlabel.h>
00026
#include <qlayout.h>
00027
#include <qwhatsthis.h>
00028
00029
#include <klocale.h>
00030
00031 CupsdDirPage::CupsdDirPage(
QWidget *parent,
const char *name)
00032 : CupsdPage(parent, name)
00033 {
00034 setPageLabel(i18n(
"Folders"));
00035 setHeader(i18n(
"Folders Settings"));
00036 setPixmap(
"folder");
00037
00038 datadir_ =
new QDirLineEdit(
false,
this);
00039 documentdir_ =
new QDirLineEdit(
false,
this);
00040 fontpath_ =
new QDirMultiLineEdit(
this);
00041 requestdir_ =
new QDirLineEdit(
false,
this);
00042 serverbin_ =
new QDirLineEdit(
false,
this);
00043 serverfiles_ =
new QDirLineEdit(
false,
this);
00044 tmpfiles_ =
new QDirLineEdit(
false,
this);
00045
00046
QLabel *l1 =
new QLabel(i18n(
"Data folder:"),
this);
00047 QLabel *l2 =
new QLabel(i18n(
"Document folder:"),
this);
00048 QLabel *l3 =
new QLabel(i18n(
"Font path:"),
this);
00049 QLabel *l4 =
new QLabel(i18n(
"Request folder:"),
this);
00050 QLabel *l5 =
new QLabel(i18n(
"Server binaries:"),
this);
00051 QLabel *l6 =
new QLabel(i18n(
"Server files:"),
this);
00052 QLabel *l7 =
new QLabel(i18n(
"Temporary files:"),
this);
00053
00054
QGridLayout *m1 =
new QGridLayout(
this, 8, 2, 10, 7);
00055 m1->
setRowStretch(7, 1);
00056 m1->
setColStretch(1, 1);
00057 m1->
addWidget(l1, 0, 0, Qt::AlignRight);
00058 m1->
addWidget(l2, 1, 0, Qt::AlignRight);
00059 m1->
addWidget(l3, 2, 0, Qt::AlignRight|Qt::AlignTop);
00060 m1->
addWidget(l4, 3, 0, Qt::AlignRight);
00061 m1->
addWidget(l5, 4, 0, Qt::AlignRight);
00062 m1->
addWidget(l6, 5, 0, Qt::AlignRight);
00063 m1->
addWidget(l7, 6, 0, Qt::AlignRight);
00064 m1->
addWidget(datadir_, 0, 1);
00065 m1->
addWidget(documentdir_, 1, 1);
00066 m1->
addWidget(fontpath_, 2, 1);
00067 m1->
addWidget(requestdir_, 3, 1);
00068 m1->
addWidget(serverbin_, 4, 1);
00069 m1->
addWidget(serverfiles_, 5, 1);
00070 m1->
addWidget(tmpfiles_, 6, 1);
00071 }
00072
00073
bool CupsdDirPage::loadConfig(CupsdConf *conf,
QString&)
00074 {
00075 conf_ = conf;
00076 datadir_->setURL(conf_->datadir_);
00077 documentdir_->setURL(conf_->documentdir_);
00078 fontpath_->setURLs(conf_->fontpath_);
00079 requestdir_->setURL(conf_->requestdir_);
00080 serverbin_->setURL(conf_->serverbin_);
00081 serverfiles_->setURL(conf_->serverfiles_);
00082 tmpfiles_->setURL(conf_->tmpfiles_);
00083
00084
return true;
00085 }
00086
00087
bool CupsdDirPage::saveConfig(CupsdConf *conf,
QString&)
00088 {
00089 conf->datadir_ = datadir_->url();
00090 conf->documentdir_ = documentdir_->url();
00091 conf->fontpath_ = fontpath_->urls();
00092 conf->requestdir_ = requestdir_->url();
00093 conf->serverbin_ = serverbin_->url();
00094 conf->serverfiles_ = serverfiles_->url();
00095 conf->tmpfiles_ = tmpfiles_->url();
00096
00097
return true;
00098 }
00099
00100
void CupsdDirPage::setInfos(CupsdConf *conf)
00101 {
00102
QWhatsThis::add(datadir_, conf->comments_.toolTip(
"datadir"));
00103
QWhatsThis::add(documentdir_, conf->comments_.toolTip(
"documentroot"));
00104
QWhatsThis::add(fontpath_, conf->comments_.toolTip(
"fontpath"));
00105
QWhatsThis::add(requestdir_, conf->comments_.toolTip(
"requestroot"));
00106
QWhatsThis::add(serverbin_, conf->comments_.toolTip(
"serverbin"));
00107
QWhatsThis::add(serverfiles_, conf->comments_.toolTip(
"serverroot"));
00108
QWhatsThis::add(tmpfiles_, conf->comments_.toolTip(
"tempdir"));
00109 }