22 #include "kmprinter.h"
23 #include "ipprequest.h"
24 #include "cupsinfos.h"
28 #include <tdelistbox.h>
29 #include <tdelocale.h>
30 #include <kiconloader.h>
35 KMWFax::KMWFax(TQWidget *parent,
const char *name)
36 : KMWizardPage(parent,name)
38 m_ID = KMWizard::Custom+2;
39 m_title = i18n(
"Fax Serial Device");
40 m_nextpage = KMWizard::Driver;
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);
46 TQVBoxLayout *l1 =
new TQVBoxLayout(
this,0,10);
48 l1->addWidget(m_list,1);
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(
"/"))
57 ipp_attribute_t *attr = req.first();
61 if (ippGetName(attr) && strcmp(ippGetName(attr),
"device-uri") == 0 && strncmp(ippGetString(attr, 0, NULL),
"fax",3) == 0)
63 m_list->insertItem(SmallIcon(
"blockdevice"),TQString::fromLatin1(ippGetString(attr, 0, NULL)));
65 attr = ippNextAttribute(req.request());
67 if (attr->name && strcmp(attr->name,
"device-uri") == 0 && strncmp(attr->values[0].string.text,
"fax",3) == 0)
69 m_list->insertItem(SmallIcon(
"blockdevice"),TQString::fromLatin1(attr->values[0].string.text));
77 bool KMWFax::isValid(TQString& msg)
79 if (m_list->currentItem() == -1)
81 msg = i18n(
"You must select a device.");
87 void KMWFax::updatePrinter(KMPrinter *printer)
89 TQString uri = m_list->currentText();
90 printer->setDevice(uri);