• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • management
kmwdriverselect.cpp
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License version 2 as published by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 **/
19
20#include "kmwdriverselect.h"
21#include "kmwizard.h"
22#include "kmprinter.h"
23#include "kmdbentry.h"
24#include "kmdriverdb.h"
25
26#include <tqlabel.h>
27#include <tqlayout.h>
28#include <kpushbutton.h>
29#include <tdelistbox.h>
30#include <tdelocale.h>
31#include <tdemessagebox.h>
32
33KMWDriverSelect::KMWDriverSelect(TQWidget *parent, const char *name)
34: KMWizardPage(parent,name)
35{
36 m_ID = KMWizard::DriverSelect;
37 m_title = i18n("Driver Selection");
38 m_nextpage = KMWizard::DriverTest;
39 m_entries = NULL;
40
41 m_list = new TDEListBox(this);
42 TQLabel *l1 = new TQLabel(this);
43 l1->setText(i18n("<p>Several drivers have been detected for this model. Select the driver "
44 "you want to use. You will have the opportunity to test it as well as to "
45 "change it if necessary.</p>"));
46 m_drivercomment = new KPushButton(i18n("Driver Information"), this);
47 connect(m_drivercomment, TQ_SIGNAL(clicked()), TQ_SLOT(slotDriverComment()));
48
49 TQVBoxLayout *main_ = new TQVBoxLayout(this, 0, 10);
50 main_->addWidget(l1,0);
51 main_->addWidget(m_list,1);
52 TQHBoxLayout *lay0 = new TQHBoxLayout(0, 0, 0);
53 main_->addLayout(lay0,0);
54 lay0->addStretch(1);
55 lay0->addWidget(m_drivercomment);
56}
57
58bool KMWDriverSelect::isValid(TQString& msg)
59{
60 if (m_list->currentItem() == -1)
61 {
62 msg = i18n("You must select a driver.");
63 return false;
64 }
65 return true;
66}
67
68void KMWDriverSelect::initPrinter(KMPrinter *p)
69{
70 m_entries = KMDriverDB::self()->findEntry(p->manufacturer(),p->model());
71 m_list->clear();
72 if (m_entries)
73 {
74 KMDBEntryListIterator it(*m_entries);
75 int recomm(0);
76 for (;it.current();++it)
77 {
78 TQString s(it.current()->description);
79 if (it.current()->recommended)
80 {
81 recomm = m_list->count();
82 s.append(i18n(" [recommended]"));
83 }
84 m_list->insertItem(s);
85 }
86 if (m_entries->count() > 0)
87 m_list->setSelected(recomm, true);
88 }
89}
90
91void KMWDriverSelect::updatePrinter(KMPrinter *p)
92{
93 int index = m_list->currentItem();
94 if (m_entries && index >= 0 && index < (int)(m_entries->count()))
95 {
96 KMDBEntry *entry = m_entries->at(index);
97 p->setDbEntry(entry);
98 p->setDriverInfo(entry->description);
99 }
100 else
101 {
102 p->setDbEntry(0);
103 p->setDriverInfo(TQString::null);
104 }
105}
106
107void KMWDriverSelect::slotDriverComment()
108{
109 int index = m_list->currentItem();
110 if (m_entries && index >=0 && index < (int)(m_entries->count()) && !m_entries->at(index)->drivercomment.isEmpty())
111 KMessageBox::information(this, m_entries->at(index)->drivercomment, TQString::null, TQString::null, KMessageBox::AllowLink);
112 else
113 KMessageBox::error(this, i18n("No information about the selected driver."));
114}
115
116#include "kmwdriverselect.moc"

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.4
This website is maintained by Timothy Pearson.