kmpages.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 "kmpages.h"
00021 #include "kminfopage.h"
00022 #include "kmjobviewer.h"
00023 #include "kmpropertypage.h"
00024 #include "kminstancepage.h"
00025 
00026 #include <klocale.h>
00027 #include <kiconloader.h>
00028 #include <kdialog.h>
00029 
00030 KMPages::KMPages(QWidget *parent, const char *name)
00031 : QTabWidget(parent,name)
00032 {
00033     m_pages.setAutoDelete(false);
00034     initialize();
00035 }
00036 
00037 KMPages::~KMPages()
00038 {
00039 }
00040 
00041 void KMPages::setPrinter(KMPrinter *p)
00042 {
00043     QPtrListIterator<KMPrinterPage> it(m_pages);
00044     for (int i=0;it.current();++it,i++)
00045         it.current()->setPrinter(p);
00046 }
00047 
00048 void KMPages::initialize()
00049 {
00050     setMargin(KDialog::marginHint());
00051 
00052     // Info page
00053     KMInfoPage  *infopage = new KMInfoPage(this, "InfoPage");
00054     addTab(infopage, SmallIcon("help"), i18n("Information"));
00055     m_pages.append(infopage);
00056 
00057     // Job page
00058     KMJobViewer *jobviewer = new KMJobViewer(this, "JobViewer");
00059     addTab(jobviewer, SmallIcon("folder"), i18n("Jobs"));
00060     m_pages.append(jobviewer);
00061 
00062     // Property page
00063     KMPropertyPage  *proppage = new KMPropertyPage(this, "Property");
00064     addTab(proppage, SmallIcon("configure"), i18n("Properties"));
00065     m_pages.append(proppage);
00066 
00067     // Instance page
00068     KMInstancePage  *instpage = new KMInstancePage(this, "Instance");
00069     addTab(instpage, SmallIcon("fileprint"), i18n("Instances"));
00070     m_pages.append(instpage);
00071 
00072     // initialize pages
00073     setPrinter(0);
00074 }
KDE Home | KDE Accessibility Home | Description of Access Keys