From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdeprint/driverview.cpp | 157 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 kdeprint/driverview.cpp (limited to 'kdeprint/driverview.cpp') diff --git a/kdeprint/driverview.cpp b/kdeprint/driverview.cpp new file mode 100644 index 000000000..60fe0b26d --- /dev/null +++ b/kdeprint/driverview.cpp @@ -0,0 +1,157 @@ +/* + * This file is part of the KDE libraries + * Copyright (c) 2001 Michael Goffioul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + **/ + +#include "driverview.h" +#include "droptionview.h" +#include "driveritem.h" +#include "driver.h" + +#include +#include +#include +#include +#include +#include + +DrListView::DrListView(QWidget *parent, const char *name) +: KListView(parent,name) +{ + addColumn(""); + header()->hide(); + setFrameStyle(QFrame::WinPanel|QFrame::Sunken); + setSorting(-1); +} + +//**************************************************************************************************** + +DriverView::DriverView(QWidget *parent, const char *name) +: QWidget(parent,name) +{ + //WhatsThis strings.... (added by pfeifle@kde.org) + QString whatsThisPPDOptionsDriverPage = i18n( " " + " List of Driver Options (from PPD). " + "

The upper pane of this dialog page contains all printjob options as laid " + " down in the printer's description file (PostScript Printer Description == 'PPD')

" + "

Click on any item in the list and watch the lower pane of this dialog page " + " display the available values.

" + "

Set the values as needed. Then use one of the pushbuttons below to proceed:

" + "
    " + "
  • 'Save' your settings if you want to re-use " + " them in your next job(s) too. 'Save' will store your settings permanently until " + " you change them again.
  • ." + "
  • Click 'OK' (without a prior click on 'Save', if you want to use " + " your selected settings just once, for the next print job. 'OK' " + " will forget your current settings when kprinter is closed again, and will start next time " + " with the previously saved defaults.
  • " + "
  • 'Cancel' will not change anything. If you proceed to print after clicking " + " 'Cancel', the job will print with the default settings of this queue. " + "
" + "

Note. The number of available job options depends strongly on the actual " + " driver used for your print queue. 'Raw' queues do not have a driver or a " + " PPD. For raw queues this tab page is not loaded by KDEPrint, and thus is not present " + " in the kprinter dialog.

" + "
" ); + + QString whatsThisOptionSettingsDriverPage = i18n( " " + " List of Possible Values for given Option (from PPD). " + "

The lower pane of this dialog page contains all possible values of the printoption " + " highlighted above, as laid " + " down in the printer's description file (PostScript Printer Description == 'PPD')

" + "

Select the value you want and proceed.

" + "

Then use one of the pushbuttons below to leave this dialog:

" + "
    " + "
  • 'Save' your settings if you want to re-use " + " them in your next job(s) too. 'Save' will store your settings permanently until " + " you change them again.
  • ." + "
  • Click 'OK' if you want to use your selected settings just once, for the " + " next print job. 'OK' " + " will forget your current settings when kprinter is closed again, and will start next time " + " with your previous defaults.
  • " + "
  • 'Cancel' will not change anything. If you proceed to print after clicking " + " 'Cancel', the job will print with the default settings of this queue. " + "
" + "

Note. The number of available job options depends strongly on the actual " + " driver used for your print queue. 'Raw' queues do not have a driver or a " + " PPD. For raw queues this tab page is not loaded by KDEPrint, and thus is not present " + " in the kprinter dialog.

" + "
" ); + + m_driver = 0; + + QSplitter *splitter = new QSplitter(this); + splitter->setOrientation(QSplitter::Vertical); + + QVBoxLayout *vbox = new QVBoxLayout(this, 0, 10); + vbox->addWidget(splitter); + + m_view = new DrListView(splitter); + QWhatsThis::add(m_view, whatsThisPPDOptionsDriverPage); + m_optview = new DrOptionView(splitter); + QWhatsThis::add(m_optview, whatsThisOptionSettingsDriverPage); + + connect(m_view,SIGNAL(selectionChanged(QListViewItem*)),m_optview,SLOT(slotItemSelected(QListViewItem*))); + connect(m_optview,SIGNAL(changed()),SLOT(slotChanged())); +} + +DriverView::~DriverView() +{ +} + +void DriverView::setDriver(DrMain *driver) +{ + m_driver = driver; + if (m_driver) + { + m_view->clear(); + m_driver->createTreeView(m_view); + slotChanged(); + } +} + +void DriverView::slotChanged() +{ + if (m_driver) + { + m_conflict = m_driver->checkConstraints(); + ((DriverItem*)m_view->firstChild())->updateConflict(); + } +} + +void DriverView::setOptions(const QMap& opts) +{ + if (m_driver) + { + m_driver->setOptions(opts); + static_cast( m_view->firstChild() )->updateTextRecursive(); + slotChanged(); + m_optview->slotItemSelected(m_view->currentItem()); + } +} + +void DriverView::getOptions(QMap& opts, bool incldef) +{ + if (m_driver) + m_driver->getOptions(opts,incldef); +} + +void DriverView::setAllowFixed(bool on) +{ + m_optview->setAllowFixed(on); +} +#include "driverview.moc" -- cgit v1.2.1