# kdeprint Library API Documentation

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

# kmpropquota.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 "kmpropquota.h"
    00021 #include "kmprinter.h"
    00022 #include "kmwizard.h"
    00023
    00024 #include <qlabel.h>
    00025 #include <qlayout.h>
    00026 #include <klocale.h>
    00027
    00028 // some forward declarations (see kmwquota.cpp)
    00029 const char* unitKeyword(int);
    00030 int findUnit(int&);
    00031
    00032 KMPropQuota::KMPropQuota(QWidget *parent, const char *name)
    00033 : KMPropWidget(parent,name)
    00034 {
    00035     m_period = new QLabel(this);
    00036     m_sizelimit = new QLabel(this);
    00037     m_pagelimit = new QLabel(this);
    00038
    00039     QLabel  *l1 = new QLabel(i18n("&Period:"), this);
    00040     QLabel  *l2 = new QLabel(i18n("&Size limit (KB):"), this);
    00041     QLabel  *l3 = new QLabel(i18n("&Page limit:"), this);
    00042
    00043     l1->setBuddy(m_period);
    00044     l2->setBuddy(m_sizelimit);
    00045     l3->setBuddy(m_pagelimit);
    00046
    00047     QGridLayout *main_ = new QGridLayout(this, 4, 2, 10, 10);
    00048     main_->setColStretch(1,1);
    00049     main_->setRowStretch(3,1);
    00050     main_->addWidget(l1,0,0);
    00051     main_->addWidget(l2,1,0);
    00052     main_->addWidget(l3,2,0);
    00053     main_->addWidget(m_period,0,1);
    00054     main_->addWidget(m_sizelimit,1,1);
    00055     main_->addWidget(m_pagelimit,2,1);
    00056
    00057     m_title = i18n("Quotas");
    00058     m_header = i18n("Quota Settings");
    00059     m_pixmap = "lock";
    00060 }
    00061
    00062 KMPropQuota::~KMPropQuota()
    00063 {
    00064 }
    00065
    00066 void KMPropQuota::setPrinter(KMPrinter *p)
    00067 {
    00068     if (p && p->isPrinter())
    00069     {
    00070         int qu(0), si(0), pa(0), un(0);
    00071         qu = p->option("job-quota-period").toInt();
    00072         si = p->option("job-k-limit").toInt();
    00073         pa = p->option("job-page-limit").toInt();
    00074         if (si == 0 && pa == 0)
    00075             qu = -1;
    00076         if (qu > 0)
    00077             un = findUnit(qu);
    00078         m_period->setText(qu == -1 ? i18n("No quota") : QString::number(qu).append(" ").append(i18n(unitKeyword(un))));
    00079         m_sizelimit->setText(si ? QString::number(si) : i18n("None"));
    00080         m_pagelimit->setText(pa ? QString::number(pa) : i18n("None"));
    00081         emit enable(true);
    00082         emit enableChange(p->isLocal());
    00083     }
    00084     else
    00085     {
    00086         emit enable(false);
    00087         m_period->setText("");
    00088         m_sizelimit->setText("");
    00089         m_pagelimit->setText("");
    00090     }
    00091 }
    00092
    00093 void KMPropQuota::configureWizard(KMWizard *w)
    00094 {
    00095     w->configure(KMWizard::Custom+3,KMWizard::Custom+3,true);
    00096 }

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:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003