• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDEPrint

cupsdlogpage.cpp

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
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     /*maxlogsize_->setRange(0, 100, 1, true);
00053     maxlogsize_->setSteps(1, 5);
00054     maxlogsize_->setSpecialValueText(i18n("Unlimited"));
00055     maxlogsize_->setSuffix(i18n("MB"));*/
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 }

KDEPrint

Skip menu "KDEPrint"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  •   KDEPrint
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal