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

tdeprint

  • tdeprint
  • management
kmwdriver.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 "kmwdriver.h"
21#include "kmwizard.h"
22#include "kmprinter.h"
23#include "kmdriverdbwidget.h"
24#include "kmdriverdb.h"
25
26#include <tqlayout.h>
27#include <tdelocale.h>
28
29KMWDriver::KMWDriver(TQWidget *parent, const char *name)
30: KMWizardPage(parent,name)
31{
32 m_ID = KMWizard::Driver;
33 m_title = i18n("Printer Model Selection");
34 m_nextpage = KMWizard::DriverTest;
35
36 m_widget = new KMDriverDbWidget(this);
37
38 TQVBoxLayout *lay1 = new TQVBoxLayout(this, 0, 0);
39 lay1->addWidget(m_widget);
40}
41
42void KMWDriver::initPrinter(KMPrinter *p)
43{
44 m_widget->init();
45 if (p)
46 {
47 TQString autoDetect = p->option( "kde-autodetect" );
48 if ( !autoDetect.isEmpty() )
49 {
50 // use auto-detection info instead: split the string
51 // into make/model pair at the first space character
52 int p = autoDetect.find( ' ' );
53 if ( p != -1 )
54 {
55 TQString manu = autoDetect.left( p ), model = autoDetect.mid( p+1 );
56 KMDBEntryList *l = KMDriverDB::self()->findPnpEntry( manu, model );
57 if ( l && l->count() > 0 )
58 {
59 m_widget->setDriver( l->getFirst()->manufacturer, l->getFirst()->model );
60 return;
61 }
62 }
63 }
64 m_widget->setDriver(p->manufacturer(),p->model());
65 }
66}
67
68void KMWDriver::updatePrinter(KMPrinter *p)
69{
70 if (p)
71 {
72 p->setManufacturer(TQString::null);
73 p->setModel(TQString::null);
74 p->setDbEntry(0);
75 p->setDriverInfo(TQString::null);
76 p->setOption("kde-driver",TQString::null);
77 setNextPage(KMWizard::DriverTest);
78 if (m_widget->isRaw())
79 {
80 p->setDriverInfo(i18n("Raw printer"));
81 p->setOption("kde-driver","raw");
82 }
83 else
84 {
85 p->setManufacturer(m_widget->manufacturer());
86 p->setModel(m_widget->model());
87 if (m_widget->isExternal())
88 {
89 p->setDriverInfo(m_widget->description());
90 p->setOption("kde-driver",m_widget->driverFile());
91 }
92 else
93 {
94 KMDBEntryList *drvs = m_widget->drivers();
95 if (drvs->count() == 1)
96 {
97 p->setDbEntry(drvs->getFirst());
98 p->setDriverInfo(drvs->getFirst()->description);
99 }
100 else
101 setNextPage(KMWizard::DriverSelect);
102 }
103 }
104 }
105}
106
107bool KMWDriver::isValid(TQString& msg)
108{
109 if (m_widget->isRaw() || m_widget->isExternal() || m_widget->drivers())
110 return true;
111 else
112 {
113 msg = i18n("Internal error: unable to locate the driver.");
114 return false;
115 }
116}

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.