| # kdeprint Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 #include <qwhatsthis.h>
    00029 #include <klocale.h>
    00030
    00031 DrListView::DrListView(QWidget *parent, const char *name)
    00032 : KListView(parent,name)
    00033 {
    00034     addColumn("");
    00035     header()->hide();
    00036     setFrameStyle(QFrame::WinPanel|QFrame::Sunken);
    00037     setSorting(-1);
    00038 }
    00039
    00040 //****************************************************************************************************
    00041
    00042 DriverView::DriverView(QWidget *parent, const char *name)
    00043 : QWidget(parent,name)
    00044 {
    00045     //WhatsThis strings.... (added by pfeifle@kde.org)
    00046     QString whatsThisPPDOptionsDriverPage = i18n( " <qt> "
    00047             " <b>List of Driver Options (from PPD)</b>. "
    00048             " <p>The upper pane of this dialog page contains all printjob options as laid "
    00049             " down in the printer's description file (PostScript Printer Description == 'PPD') </p>"
    00050             " <p>Click on any item in the list and watch the lower pane of this dialog page "
    00051             " display the available values. </p> "
    00052             " <p>Set the values as needed. Then use one of the pushbuttons below to proceed:</p> "
    00053             " <ul> "
    00054             " <li><em>'Save'</em> your settings if you want to re-use "
    00055             " them in your next job(s) too. <em>'Save'</em> will store your settings permanently until "
    00056             " you change them again. </li>."
    00057             " <li>Click <em>'OK'</em> (without a prior click on <em>'Save'</em>, if you want to use "
    00058             " your selected settings just once, for the next print job. <em>'OK'</em> "
    00059             " will forget your current settings when kprinter is closed again, and will start next time "
    00060             " with the previously saved defaults. </li>"
    00061             " <li><em>'Cancel'</em> will not change anything. If you proceed to print after clicking "
    00062             " <em>'Cancel'</em>, the job will print with the default settings of this queue. "
    00063             " </ul>"
    00064             " <p><b>Note.</b> The number of available job options depends strongly on the actual "
    00065             " driver used for your print queue. <em>'Raw'</em> queues do not have a driver or a  "
    00066             " PPD. For raw queues this tab page is not loaded by KDEPrint, and thus is not present "
    00067             " in the kprinter dialog.</p> "
    00068             " </qt>" );
    00069
    00070     QString whatsThisOptionSettingsDriverPage = i18n( " <qt> "
    00071             " <b>List of Possible Values for given Option (from PPD)</b>. "
    00072             " <p>The lower pane of this dialog page contains all possible values of the printoption "
    00073             " highlighted above, as laid "
    00074             " down in the printer's description file (PostScript Printer Description == 'PPD') </p>"
    00075             " <p>Select the value you want and proceed. </p> "
    00076             " <p>Then use one of the pushbuttons below to leave this dialog:</p> "
    00077             " <ul> "
    00078             " <li><em>'Save'</em> your settings if you want to re-use "
    00079             " them in your next job(s) too. <em>'Save'</em> will store your settings permanently until "
    00080             " you change them again. </li>."
    00081             " <li>Click <em>'OK'</em> if you want to use your selected settings just once, for the "
    00082             " next print job. <em>'OK'</em> "
    00083             " will forget your current settings when kprinter is closed again, and will start next time "
    00084             " with your previous defaults. </li>"
    00085             " <li><em>'Cancel'</em> will not change anything. If you proceed to print after clicking "
    00086             " <em>'Cancel'</em>, the job will print with the default settings of this queue. "
    00087             " </ul>"
    00088             " <p><b>Note.</b> The number of available job options depends strongly on the actual "
    00089             " driver used for your print queue. <em>'Raw'</em> queues do not have a driver or a  "
    00090             " PPD. For raw queues this tab page is not loaded by KDEPrint, and thus is not present "
    00091             " in the kprinter dialog.</p> "
    00092             " </qt>" );
    00093
    00094     m_driver = 0;
    00095
    00096     m_view = new DrListView(this);
    00097       QWhatsThis::add(m_view, whatsThisPPDOptionsDriverPage);
    00098     m_optview = new DrOptionView(this);
    00099       QWhatsThis::add(m_optview, whatsThisOptionSettingsDriverPage);
    00100
    00101     QVBoxLayout *main_ = new QVBoxLayout(this, 0, 10);
    00102     main_->addWidget(m_view,1);
    00103     main_->addWidget(m_optview,0);
    00104
    00105     connect(m_view,SIGNAL(selectionChanged(QListViewItem*)),m_optview,SLOT(slotItemSelected(QListViewItem*)));
    00106     connect(m_optview,SIGNAL(changed()),SLOT(slotChanged()));
    00107 }
    00108
    00109 DriverView::~DriverView()
    00110 {
    00111 }
    00112
    00113 void DriverView::setDriver(DrMain *driver)
    00114 {
    00115     m_driver = driver;
    00116     if (m_driver)
    00117     {
    00118         m_view->clear();
    00119         m_driver->createTreeView(m_view);
    00120         slotChanged();
    00121     }
    00122 }
    00123
    00124 void DriverView::slotChanged()
    00125 {
    00126     if (m_driver)
    00127     {
    00128         m_conflict = m_driver->checkConstraints();
    00129         ((DriverItem*)m_view->firstChild())->updateConflict();
    00130     }
    00131 }
    00132
    00133 void DriverView::setOptions(const QMap<QString,QString>& opts)
    00134 {
    00135     if (m_driver)
    00136     {
    00137         m_driver->setOptions(opts);
    00138         static_cast<DriverItem*>( m_view->firstChild() )->updateTextRecursive();
    00139         slotChanged();
    00140         m_optview->slotItemSelected(m_view->currentItem());
    00141     }
    00142 }
    00143
    00144 void DriverView::getOptions(QMap<QString,QString>& opts, bool incldef)
    00145 {
    00146     if (m_driver)
    00147         m_driver->getOptions(opts,incldef);
    00148 }
    00149
    00150 void DriverView::setAllowFixed(bool on)
    00151 {
    00152     m_optview->setAllowFixed(on);
    00153 }
    00154 #include "driverview.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