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

tdeprint

  • tdeprint
  • cups
kmwfax.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 "kmwfax.h"
21#include "kmwizard.h"
22#include "kmprinter.h"
23#include "ipprequest.h"
24#include "cupsinfos.h"
25
26#include <tqlabel.h>
27#include <tqlayout.h>
28#include <tdelistbox.h>
29#include <tdelocale.h>
30#include <kiconloader.h>
31#include <kurl.h>
32
33#include "config.h"
34
35KMWFax::KMWFax(TQWidget *parent, const char *name)
36: KMWizardPage(parent,name)
37{
38 m_ID = KMWizard::Custom+2;
39 m_title = i18n("Fax Serial Device");
40 m_nextpage = KMWizard::Driver;
41
42 TQLabel *lab = new TQLabel(this);
43 lab->setText(i18n("<p>Select the device which your serial Fax/Modem is connected to.</p>"));
44 m_list = new TDEListBox(this);
45
46 TQVBoxLayout *l1 = new TQVBoxLayout(this,0,10);
47 l1->addWidget(lab,0);
48 l1->addWidget(m_list,1);
49
50 // initialize
51 IppRequest req;
52 req.setOperation(CUPS_GET_DEVICES);
53 TQString uri = TQString::fromLatin1("ipp://%1/printers/").arg(CupsInfos::self()->hostaddr());
54 req.addURI(IPP_TAG_OPERATION,"printer-uri",uri);
55 if (req.doRequest("/"))
56 {
57 ipp_attribute_t *attr = req.first();
58 while (attr)
59 {
60#ifdef HAVE_CUPS_1_6
61 if (ippGetName(attr) && strcmp(ippGetName(attr),"device-uri") == 0 && strncmp(ippGetString(attr, 0, NULL),"fax",3) == 0)
62 {
63 m_list->insertItem(SmallIcon("blockdevice"),TQString::fromLatin1(ippGetString(attr, 0, NULL)));
64 }
65 attr = ippNextAttribute(req.request());
66#else // HAVE_CUPS_1_6
67 if (attr->name && strcmp(attr->name,"device-uri") == 0 && strncmp(attr->values[0].string.text,"fax",3) == 0)
68 {
69 m_list->insertItem(SmallIcon("blockdevice"),TQString::fromLatin1(attr->values[0].string.text));
70 }
71 attr = attr->next;
72#endif // HAVE_CUPS_1_6
73 }
74 }
75}
76
77bool KMWFax::isValid(TQString& msg)
78{
79 if (m_list->currentItem() == -1)
80 {
81 msg = i18n("You must select a device.");
82 return false;
83 }
84 return true;
85}
86
87void KMWFax::updatePrinter(KMPrinter *printer)
88{
89 TQString uri = m_list->currentText();
90 printer->setDevice(uri);
91}

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.