kdeprint Library API Documentation

driverview.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 "driverview.h"
00021 #include "droptionview.h"
00022 #include "driveritem.h"
00023 #include "driver.h"
00024 
00025 #include <qlistview.h>
00026 #include <qheader.h>
00027 #include <qlayout.h>
00028 
00029 DrListView::DrListView(QWidget *parent, const char *name)
00030 : KListView(parent,name)
00031 {
00032     addColumn("");
00033     header()->hide();
00034     setFrameStyle(QFrame::WinPanel|QFrame::Sunken);
00035     setSorting(-1);
00036 }
00037 
00038 //****************************************************************************************************
00039 
00040 DriverView::DriverView(QWidget *parent, const char *name)
00041 : QWidget(parent,name)
00042 {
00043     m_driver = 0;
00044 
00045     m_view = new DrListView(this);
00046     m_optview = new DrOptionView(this);
00047 
00048     QVBoxLayout *main_ = new QVBoxLayout(this, 0, 10);
00049     main_->addWidget(m_view,1);
00050     main_->addWidget(m_optview,0);
00051 
00052     connect(m_view,SIGNAL(selectionChanged(QListViewItem*)),m_optview,SLOT(slotItemSelected(QListViewItem*)));
00053     connect(m_optview,SIGNAL(changed()),SLOT(slotChanged()));
00054 }
00055 
00056 DriverView::~DriverView()
00057 {
00058 }
00059 
00060 void DriverView::setDriver(DrMain *driver)
00061 {
00062     m_driver = driver;
00063     if (m_driver)
00064     {
00065         m_view->clear();
00066         m_driver->createTreeView(m_view);
00067         slotChanged();
00068     }
00069 }
00070 
00071 void DriverView::slotChanged()
00072 {
00073     if (m_driver)
00074     {
00075         m_conflict = m_driver->checkConstraints();
00076         ((DriverItem*)m_view->firstChild())->updateConflict();
00077     }
00078 }
00079 
00080 void DriverView::setOptions(const QMap<QString,QString>& opts)
00081 {
00082     if (m_driver)
00083     {
00084         m_driver->setOptions(opts);
00085         static_cast<DriverItem*>( m_view->firstChild() )->updateTextRecursive();
00086         slotChanged();
00087         m_optview->slotItemSelected(m_view->currentItem());
00088     }
00089 }
00090 
00091 void DriverView::getOptions(QMap<QString,QString>& opts, bool incldef)
00092 {
00093     if (m_driver)
00094         m_driver->getOptions(opts,incldef);
00095 }
00096 
00097 void DriverView::setAllowFixed(bool on)
00098 {
00099     m_optview->setAllowFixed(on);
00100 }
00101 #include "driverview.moc"
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Jan 21 09:58:29 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003