22 #include "kmprinter.h"
25 #include <tqlineedit.h>
26 #include <tdelocale.h>
27 #include <tqvalidator.h>
29 #include <cups/http.h>
31 KMWIpp::KMWIpp(TQWidget *parent,
const char *name)
32 : KMWInfoBase(2,parent,name)
35 m_title = i18n(
"Remote IPP server");
36 m_nextpage = KMWizard::IPPSelect;
37 lineEdit( 1 )->setValidator(
new TQIntValidator(
this ) );
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" ) );
47 bool KMWIpp::isValid(TQString& msg)
50 if (text(0).isEmpty())
52 msg = i18n(
"Empty server name.");
56 int p = text(1).toInt(&ok);
59 msg = i18n(
"Incorrect port number.");
64 http_t *HTTP = httpConnect(text(0).latin1(),p);
72 msg = i18n(
"<nobr>Unable to connect to <b>%1</b> on port <b>%2</b> .</nobr>").arg(text(0)).arg(p);
77 void KMWIpp::updatePrinter(KMPrinter *p)
80 url.setProtocol(
"ipp");
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());