# kdeprint Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# cupsdlogpage.cpp

    00001 /*
    00002  *  This file is part of the KDE libraries
    00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
    00004  *
    00005  *  This library is free software; you can redistribute it and/or
    00006  *  modify it under the terms of the GNU Library General Public
    00007  *  License version 2 as published by the Free Software Foundation.
    00008  *
    00009  *  This library is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  *  Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this library; see the file COPYING.LIB.  If not, write to
    00016  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  *  Boston, MA 02111-1307, USA.
    00018  **/
    00019
    00020 #include "cupsdlogpage.h"
    00021 #include "cupsdconf.h"
    00022 #include "qdirlineedit.h"
    00023 #include "sizewidget.h"
    00024
    00025 #include <qlabel.h>
    00026 #include <qcombobox.h>
    00027 #include <qlayout.h>
    00028 #include <qwhatsthis.h>
    00029
    00030 #include <klocale.h>
    00031 #include <kfiledialog.h>
    00032
    00033 CupsdLogPage::CupsdLogPage(QWidget *parent, const char *name)
    00034     : CupsdPage(parent, name)
    00035 {
    00036     setPageLabel(i18n("Log"));
    00037     setHeader(i18n("Log Settings"));
    00038     setPixmap("contents");
    00039
    00040     accesslog_ = new QDirLineEdit(true, this);
    00041     errorlog_ = new QDirLineEdit(true, this);
    00042     pagelog_ = new QDirLineEdit(true, this);
    00043     maxlogsize_ = new SizeWidget(this);
    00044     loglevel_ = new QComboBox(this);
    00045
    00046     loglevel_->insertItem(i18n("Detailed Debugging"));
    00047     loglevel_->insertItem(i18n("Debug Information"));
    00048     loglevel_->insertItem(i18n("General Information"));
    00049     loglevel_->insertItem(i18n("Warnings"));
    00050     loglevel_->insertItem(i18n("Errors"));
    00051     loglevel_->insertItem(i18n("No Logging"));
    00052
    00053     /*maxlogsize_->setRange(0, 100, 1, true);
    00054     maxlogsize_->setSteps(1, 5);
    00055     maxlogsize_->setSpecialValueText(i18n("Unlimited"));
    00056     maxlogsize_->setSuffix(i18n("MB"));*/
    00057
    00058     QLabel *l1 = new QLabel(i18n("Access log:"), this);
    00059     QLabel *l2 = new QLabel(i18n("Error log:"), this);
    00060     QLabel *l3 = new QLabel(i18n("Page log:"), this);
    00061     QLabel *l4 = new QLabel(i18n("Max log size:"), this);
    00062     QLabel *l5 = new QLabel(i18n("Log level:"), this);
    00063
    00064     loglevel_->setCurrentItem(2);
    00065
    00066     QGridLayout *m1 = new QGridLayout(this, 6, 2, 10, 7);
    00067     m1->setRowStretch(5, 1);
    00068     m1->setColStretch(1, 1);
    00069     m1->addWidget(l1, 0, 0, Qt::AlignRight);
    00070     m1->addWidget(l2, 1, 0, Qt::AlignRight);
    00071     m1->addWidget(l3, 2, 0, Qt::AlignRight);
    00072     m1->addWidget(l4, 3, 0, Qt::AlignRight);
    00073     m1->addWidget(l5, 4, 0, Qt::AlignRight);
    00074     m1->addWidget(accesslog_, 0, 1);
    00075     m1->addWidget(errorlog_, 1, 1);
    00076     m1->addWidget(pagelog_, 2, 1);
    00077     m1->addWidget(maxlogsize_, 3, 1);
    00078     m1->addWidget(loglevel_, 4, 1);
    00079 }
    00080
    00081 bool CupsdLogPage::loadConfig(CupsdConf *conf, QString&)
    00082 {
    00083     conf_ = conf;
    00084     accesslog_->setURL(conf_->accesslog_);
    00085     errorlog_->setURL(conf_->errorlog_);
    00086     pagelog_->setURL(conf_->pagelog_);
    00087     maxlogsize_->setSizeString(conf_->maxlogsize_);
    00088     loglevel_->setCurrentItem(conf_->loglevel_);
    00089
    00090     return true;
    00091 }
    00092
    00093 bool CupsdLogPage::saveConfig(CupsdConf *conf, QString&)
    00094 {
    00095     conf->accesslog_ = accesslog_->url();
    00096     conf->errorlog_ = errorlog_->url();
    00097     conf->pagelog_ = pagelog_->url();
    00098     conf->maxlogsize_ = maxlogsize_->sizeString();
    00099     conf->loglevel_ = loglevel_->currentItem();
    00100
    00101     return true;
    00102 }
    00103
    00104 void CupsdLogPage::setInfos(CupsdConf *conf)
    00105 {
    00106     QWhatsThis::add(accesslog_, conf->comments_.toolTip("accesslog"));
    00107     QWhatsThis::add(errorlog_, conf->comments_.toolTip("errorlog"));
    00108     QWhatsThis::add(pagelog_, conf->comments_.toolTip("pagelog"));
    00109     QWhatsThis::add(maxlogsize_, conf->comments_.toolTip("maxlogsize"));
    00110     QWhatsThis::add(loglevel_, conf->comments_.toolTip("loglevel"));
    00111 }

This file is part of the documentation for kdeprint Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:01 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003