# kdeprint Library API Documentation

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

# kmconfigdialog.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 "kmconfigdialog.h"
    00021 #include "kmconfigpage.h"
    00022 #include "kmfactory.h"
    00023 #include "kmuimanager.h"
    00024
    00025 #include "kmconfiggeneral.h"
    00026 #include "kmconfigpreview.h"
    00027 #include "kmconfigcommand.h"
    00028 #include "kmconfigfilter.h"
    00029 #include "kmconfigfonts.h"
    00030 #include "kmconfigjobs.h"
    00031
    00032 #include <qlayout.h>
    00033 #include <klocale.h>
    00034 #include <kiconloader.h>
    00035 #include <kconfig.h>
    00036
    00037 KMConfigDialog::KMConfigDialog(QWidget *parent, const char *name)
    00038 : KDialogBase(IconList,i18n("KDE Print Configuration"),Ok|Cancel,Ok,parent,name,true,true)
    00039 {
    00040     m_pages.setAutoDelete(false);
    00041     addConfigPage(new KMConfigGeneral(this));
    00042     addConfigPage(new KMConfigPreview(this));
    00043     addConfigPage(new KMConfigFonts(this));
    00044     addConfigPage(new KMConfigCommand(this));
    00045     addConfigPage(new KMConfigFilter(this));
    00046     addConfigPage(new KMConfigJobs(this));
    00047     KMFactory::self()->uiManager()->setupConfigDialog(this);
    00048
    00049     // initialize pages
    00050     KConfig *conf = KMFactory::self()->printConfig();
    00051     QPtrListIterator<KMConfigPage>  it(m_pages);
    00052     for (;it.current();++it)
    00053         it.current()->loadConfig(conf);
    00054
    00055     // resize dialog
    00056     resize(450,400);
    00057 }
    00058
    00059 void KMConfigDialog::addConfigPage(KMConfigPage *page)
    00060 {
    00061     if (page)
    00062     {
    00063         QPixmap icon = KGlobal::instance()->iconLoader()->loadIcon(
    00064                                                                    page->pagePixmap(),
    00065                                                                    KIcon::NoGroup,
    00066                                                                        KIcon::SizeMedium
    00067                                                                   );
    00068
    00069         QFrame  *frame = addPage(page->pageName(),page->pageHeader(),icon);
    00070         page->reparent(frame,QPoint(0,0));
    00071         QVBoxLayout *lay = new QVBoxLayout(frame, 0, 0);
    00072         lay->addWidget(page);
    00073         m_pages.append(page);
    00074     }
    00075 }
    00076
    00077 void KMConfigDialog::slotOk()
    00078 {
    00079     // save configuration
    00080     KConfig *conf = KMFactory::self()->printConfig();
    00081     QPtrListIterator<KMConfigPage>  it(m_pages);
    00082     for (;it.current();++it)
    00083         it.current()->saveConfig(conf);
    00084     KMFactory::self()->saveConfig();
    00085
    00086     // close the dialog
    00087     KDialogBase::slotOk();
    00088 }
    00089 #include "kmconfigdialog.moc"

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