kmpropmembers.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., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  **/
00019 
00020 #include "kmpropmembers.h"
00021 #include "kmprinter.h"
00022 #include "kmwizard.h"
00023 
00024 #include <qtextview.h>
00025 #include <qlayout.h>
00026 #include <klocale.h>
00027 
00028 KMPropMembers::KMPropMembers(QWidget *parent, const char *name)
00029 : KMPropWidget(parent,name)
00030 {
00031     m_members = new QTextView(this);
00032     m_members->setPaper(colorGroup().background());
00033     m_members->setFrameStyle(QFrame::NoFrame);
00034 
00035     QVBoxLayout *main_ = new QVBoxLayout(this, 10, 0);
00036     main_->addWidget(m_members);
00037 
00038     m_pixmap = "kdeprint_printer_class";
00039     m_title = i18n("Members");
00040     m_header = i18n("Class Members");
00041 }
00042 
00043 KMPropMembers::~KMPropMembers()
00044 {
00045 }
00046 
00047 void KMPropMembers::setPrinter(KMPrinter *p)
00048 {
00049     if (p && ((p->isClass(false) && p->isLocal()) || p->isImplicit()))
00050     {
00051         QStringList l = p->members();
00052         QString     txt("<ul>");
00053         for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it)
00054             txt.append("<li>" + (*it) + "</li>");
00055         txt.append("</ul>");
00056         m_members->setText(txt);
00057         emit enable(true);
00058         emit enableChange(!p->isImplicit());
00059     }
00060     else
00061     {
00062         emit enable(false);
00063         m_members->setText("");
00064     }
00065 }
00066 
00067 void KMPropMembers::configureWizard(KMWizard *w)
00068 {
00069     w->configure(KMWizard::Class,KMWizard::Class,true);
00070 }
KDE Home | KDE Accessibility Home | Description of Access Keys