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

tdeprint

  • tdeprint
  • cups
kmwipp.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 "kmwipp.h"
21#include "kmwizard.h"
22#include "kmprinter.h"
23
24#include <tqlabel.h>
25#include <tqlineedit.h>
26#include <tdelocale.h>
27#include <tqvalidator.h>
28
29#include <cups/http.h>
30
31KMWIpp::KMWIpp(TQWidget *parent, const char *name)
32: KMWInfoBase(2,parent,name)
33{
34 m_ID = KMWizard::IPP;
35 m_title = i18n("Remote IPP server");
36 m_nextpage = KMWizard::IPPSelect;
37 lineEdit( 1 )->setValidator( new TQIntValidator( this ) );
38
39 setInfo(i18n("<p>Enter the information concerning the remote IPP server "
40 "owning the targeted printer. This wizard will poll the server "
41 "before continuing.</p>"));
42 setLabel(0,i18n("Host:"));
43 setLabel(1,i18n("Port:"));
44 setText( 1, TQString::fromLatin1( "631" ) );
45}
46
47bool KMWIpp::isValid(TQString& msg)
48{
49 // check informations
50 if (text(0).isEmpty())
51 {
52 msg = i18n("Empty server name.");
53 return false;
54 }
55 bool ok(false);
56 int p = text(1).toInt(&ok);
57 if (!ok)
58 {
59 msg = i18n("Incorrect port number.");
60 return false;
61 }
62
63 // check server
64 http_t *HTTP = httpConnect(text(0).latin1(),p);
65 if (HTTP)
66 {
67 httpClose(HTTP);
68 return true;
69 }
70 else
71 {
72 msg = i18n("<nobr>Unable to connect to <b>%1</b> on port <b>%2</b> .</nobr>").arg(text(0)).arg(p);
73 return false;
74 }
75}
76
77void KMWIpp::updatePrinter(KMPrinter *p)
78{
79 KURL url;
80 url.setProtocol("ipp");
81 url.setHost(text(0));
82 url.setPort(text(1).toInt());
83 if (!p->option("kde-login").isEmpty()) url.setUser(p->option("kde-login"));
84 if (!p->option("kde-password").isEmpty()) url.setPass(p->option("kde-password"));
85 p->setDevice(url.url());
86}

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.