kmpropertypage.cpp
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #include "kmpropertypage.h"
00021 #include "kmpropwidget.h"
00022 #include "kmpropcontainer.h"
00023 #include "kmprinter.h"
00024 #include "kmfactory.h"
00025 #include "kmuimanager.h"
00026 
00027 #include "kmpropgeneral.h"
00028 
00029 #include <qvbox.h>
00030 #include <kiconloader.h>
00031 
00032 KMPropertyPage::KMPropertyPage(QWidget *parent, const char *name)
00033 : CJanusWidget(parent,name)
00034 {
00035     m_widgets.setAutoDelete(false);
00036 
00037     initialize();
00038 }
00039 
00040 KMPropertyPage::~KMPropertyPage()
00041 {
00042 }
00043 
00044 void KMPropertyPage::setPrinter(KMPrinter *p)
00045 {
00046     QPtrListIterator<KMPropWidget>  it(m_widgets);
00047     for (;it.current();++it)
00048         it.current()->setPrinterBase(p);
00049 }
00050 
00051 void KMPropertyPage::addPropPage(KMPropWidget *w)
00052 {
00053     if (w)
00054     {
00055         m_widgets.append(w);
00056         KMPropContainer *ctn = new KMPropContainer(this,"Container");
00057         ctn->setWidget(w);
00058         connect(ctn,SIGNAL(enable(bool)),SLOT(slotEnable(bool)));
00059 
00060         QPixmap icon = KGlobal::instance()->iconLoader()->loadIcon(
00061                                                                    w->pixmap(),
00062                                                                    KIcon::NoGroup,
00063                                                                    KIcon::SizeMedium
00064                                                                   );
00065         addPage(ctn,w->title(),w->header(),icon);
00066     }
00067 }
00068 
00069 void KMPropertyPage::slotEnable(bool on)
00070 {
00071     QWidget *w = (QWidget*)(sender());
00072     if (on)
00073         enablePage(w);
00074     else
00075         disablePage(w);
00076 }
00077 
00078 void KMPropertyPage::initialize()
00079 {
00080     
00081     addPropPage(new KMPropGeneral(this, "General"));
00082     
00083     KMFactory::self()->uiManager()->setupPropertyPages(this);
00084 }
00085 
00086 void KMPropertyPage::reload()
00087 {
00088     clearPages();
00089     m_widgets.clear();
00090     initialize();
00091     setPrinter(0);
00092 }
00093 
00094 #include "kmpropertypage.moc"
 
This file is part of the documentation for kdeprint Library Version 3.2.0.