| # kdeprint Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmpropusers.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 "kmpropusers.h"
    00021 #include "kmprinter.h"
    00022 #include "kmwizard.h"
    00023
    00024 #include <qtextview.h>
    00025 #include <qlayout.h>
    00026 #include <klocale.h>
    00027
    00028 KMPropUsers::KMPropUsers(QWidget *parent, const char *name)
    00029 : KMPropWidget(parent,name)
    00030 {
    00031     m_text = new QTextView(this);
    00032     m_text->setPaper(colorGroup().background());
    00033     m_text->setFrameStyle(QFrame::NoFrame);
    00034
    00035     QVBoxLayout *l0 = new QVBoxLayout(this, 10, 0);
    00036     l0->addWidget(m_text, 1);
    00037
    00038     m_title = i18n("Users");
    00039     m_header = i18n("Users Access Settings");
    00040     m_pixmap = "kdeprint_printer_users";
    00041 }
    00042
    00043 KMPropUsers::~KMPropUsers()
    00044 {
    00045 }
    00046
    00047 void KMPropUsers::setPrinter(KMPrinter *p)
    00048 {
    00049     if (p && p->isPrinter())
    00050     {
    00051         QString txt("<p>%1:<ul>%1</ul></p>");
    00052         QStringList users;
    00053         if (!p->option("requesting-user-name-denied").isEmpty())
    00054         {
    00055             txt = txt.arg(i18n("Denied users"));
    00056             users = QStringList::split(",", p->option("requesting-user-name-denied"), false);
    00057             if (users.count() == 1 && users[0] == "none")
    00058                 users.clear();
    00059         }
    00060         else if (!p->option("requesting-user-name-allowed").isEmpty())
    00061         {
    00062             txt = txt.arg(i18n("Allowed users"));
    00063             users = QStringList::split(",", p->option("requesting-user-name-allowed"), false);
    00064             if (users.count() == 1 && users[0] == "all")
    00065                 users.clear();
    00066         }
    00067         if (users.count() > 0)
    00068         {
    00069             QString s;
    00070             for (QStringList::ConstIterator it=users.begin(); it!=users.end(); ++it)
    00071                 s.append("<li>").append(*it).append("</li>");
    00072             txt = txt.arg(s);
    00073             m_text->setText(txt);
    00074         }
    00075         else
    00076             m_text->setText(i18n("All users allowed"));
    00077         emit enable(true);
    00078         emit enableChange(p->isLocal());
    00079     }
    00080     else
    00081     {
    00082         emit enable(false);
    00083         m_text->setText("");
    00084     }
    00085 }
    00086
    00087 void KMPropUsers::configureWizard(KMWizard *w)
    00088 {
    00089     w->configure(KMWizard::Custom+4,KMWizard::Custom+4,true);
    00090 }

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