kmpropdriver.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 "kmpropdriver.h"
00021 #include "kmprinter.h"
00022 #include "kmwizard.h"
00023 
00024 #include <qlabel.h>
00025 #include <qlayout.h>
00026 #include <klocale.h>
00027 
00028 KMPropDriver::KMPropDriver(QWidget *parent, const char *name)
00029 : KMPropWidget(parent,name)
00030 {
00031     m_manufacturer = new QLabel("",this);
00032     m_model = new QLabel("",this);
00033     m_driverinfo = new QLabel("",this);
00034     m_driverinfo->setTextFormat(Qt::RichText);
00035 
00036     QLabel  *l1 = new QLabel(i18n("Manufacturer:"), this);
00037     QLabel  *l2 = new QLabel(i18n("Printer model:"), this);
00038     QLabel  *l3 = new QLabel(i18n("Driver info:"), this);
00039 
00040     // layout
00041     QGridLayout *main_ = new QGridLayout(this, 4, 2, 10, 7);
00042     main_->setColStretch(0,0);
00043     main_->setColStretch(1,1);
00044     main_->setRowStretch(3,1);
00045     main_->addWidget(l1,0,0);
00046     main_->addWidget(l2,1,0);
00047     main_->addWidget(l3,2,0,Qt::AlignTop|Qt::AlignLeft);
00048     main_->addWidget(m_manufacturer,0,1);
00049     main_->addWidget(m_model,1,1);
00050     main_->addWidget(m_driverinfo,2,1);
00051 
00052     m_pixmap = "gear";
00053     m_title = i18n("Driver");
00054     m_header = i18n("Driver Settings");
00055 }
00056 
00057 KMPropDriver::~KMPropDriver()
00058 {
00059 }
00060 
00061 void KMPropDriver::setPrinter(KMPrinter *p)
00062 {
00063     if (p && p->isPrinter())
00064     {
00065         m_manufacturer->setText(p->manufacturer());
00066         m_model->setText(p->model());
00067         m_driverinfo->setText(p->driverInfo());
00068         emit enable(true);
00069         emit enableChange(p->isLocal());
00070     }
00071     else
00072     {
00073         emit enable(false);
00074         m_manufacturer->setText("");
00075         m_model->setText("");
00076         m_driverinfo->setText("");
00077     }
00078 }
00079 
00080 void KMPropDriver::configureWizard(KMWizard *w)
00081 {
00082     w->configure(KMWizard::Driver,KMWizard::DriverTest,true);
00083 }
KDE Home | KDE Accessibility Home | Description of Access Keys