00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#include "cupsdservermiscpage.h"
00021
00022
#include "qdirlineedit.h"
00023
#include <qlineedit.h>
00024
#include <klocale.h>
00025
#include <qlayout.h>
00026
#include <qlabel.h>
00027
#include <qwhatsthis.h>
00028
00029
#include "cupsdconf.h"
00030
#include "cupsdoption.h"
00031
00032 CupsdServerMiscPage::CupsdServerMiscPage(
QWidget *parent,
const char *name)
00033 : CupsdPage(parent, name)
00034 {
00035 path_.append(i18n(
"Server"));
00036 path_.append(i18n(
"Misc"));
00037 header_ = i18n(
"Server Miscellaneous Configuration");
00038
00039
for (
int i=0;i<2;i++)
00040 opt_[i] =
new CupsdOption(
this);
00041
00042 printcap_ =
new QDirLineEdit(opt_[0]);
00043 printcap_->setFileEdit(
true);
00044 ripcache_ =
new QLineEdit(opt_[1]);
00045
00046
QLabel *l1 =
new QLabel(i18n(
"Printcap file:"),
this);
00047 QLabel *l2 =
new QLabel(i18n(
"RIP cache:"),
this);
00048
00049
QGridLayout *main_ =
new QGridLayout(
this, 4, 2, 10, 10);
00050 main_->
addWidget(deflabel_, 0, 1, Qt::AlignRight|Qt::AlignVCenter);
00051 main_->
addWidget(opt_[0], 1, 1);
00052 main_->
addWidget(opt_[1], 2, 1);
00053 main_->
addWidget(l1, 1, 0);
00054 main_->
addWidget(l2, 2, 0);
00055 main_->
setRowStretch(3, 1);
00056 }
00057
00058 CupsdServerMiscPage::~CupsdServerMiscPage()
00059 {
00060 }
00061
00062
bool CupsdServerMiscPage::loadConfig(CupsdConf *conf,
QString&)
00063 {
00064 conf_ = conf;
00065
if (!conf->printcap_.isNull())
00066 {
00067 opt_[0]->setDefault(
false);
00068 printcap_->setText(conf->printcap_);
00069 }
00070
if (!conf->ripcache_.isNull())
00071 {
00072 opt_[1]->setDefault(
false);
00073 ripcache_->setText(conf->ripcache_);
00074 }
00075
return true;
00076 }
00077
00078
bool CupsdServerMiscPage::saveConfig(CupsdConf *conf,
QString& msg)
00079 {
00080
if (!opt_[0]->isDefault() && !printcap_->text().isNull()) conf->printcap_ = printcap_->text();
00081
if (!opt_[1]->isDefault() && !ripcache_->text().isNull()) conf->ripcache_ = ripcache_->text();
00082
return true;
00083 }
00084
00085
void CupsdServerMiscPage::setDefaults()
00086 {
00087 printcap_->setText(
"/etc/printcap");
00088 ripcache_->setText(
"8m");
00089 }
00090
00091
void CupsdServerMiscPage::setInfos(CupsdConf *conf)
00092 {
00093
QWhatsThis::add(printcap_, conf->comments_.toolTip(PRINTCAP_COMM));
00094
QWhatsThis::add(ripcache_, conf->comments_.toolTip(RIPCACHE_COMM));
00095 }