kmpropbackend.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "kmpropbackend.h"
00021 #include "kmprinter.h"
00022 #include "kmwizard.h"
00023
00024 #include <qlabel.h>
00025 #include <qlayout.h>
00026 #include <klocale.h>
00027
00028 KMPropBackend::KMPropBackend(QWidget *parent, const char *name)
00029 : KMPropWidget(parent,name)
00030 {
00031 m_uri = new QLabel("",this);
00032 m_type = new QLabel("",this);
00033
00034 QLabel *l1 = new QLabel(i18n("Printer type:"), this);
00035 QLabel *l2 = new QLabel(i18n("URI:"), this);
00036
00037
00038 QGridLayout *main_ = new QGridLayout(this, 3, 2, 10, 7);
00039 main_->setColStretch(0,0);
00040 main_->setColStretch(1,1);
00041 main_->setRowStretch(2,1);
00042 main_->addWidget(l1,0,0);
00043 main_->addWidget(l2,1,0);
00044 main_->addWidget(m_type,0,1);
00045 main_->addWidget(m_uri,1,1);
00046
00047 m_pixmap = "connect_established";
00048 m_title = i18n("Interface");
00049 m_header = i18n("Interface Settings");
00050 }
00051
00052 KMPropBackend::~KMPropBackend()
00053 {
00054 }
00055
00056 void KMPropBackend::setPrinter(KMPrinter *p)
00057 {
00058 if (p && p->isPrinter())
00059 {
00060 m_uri->setText(KURL(p->device()).prettyURL());
00061 QString prot = p->deviceProtocol();
00062 if (prot == "ipp" || prot == "http") m_type->setText(i18n("IPP Printer"));
00063 else if (prot == "usb") m_type->setText(i18n("Local USB Printer"));
00064 else if (prot == "parallel") m_type->setText(i18n("Local Parallel Printer"));
00065 else if (prot == "serial") m_type->setText(i18n("Local Serial Printer"));
00066 else if (prot == "socket") m_type->setText(i18n("Network Printer (socket)"));
00067 else if (prot == "smb") m_type->setText(i18n("SMB printers (Windows)"));
00068 else if (prot == "lpd") m_type->setText(i18n("Remote LPD queue"));
00069 else if (prot == "file") m_type->setText(i18n("File printer"));
00070 else if (prot == "fax") m_type->setText(i18n("Serial Fax/Modem printer"));
00071 else m_type->setText(i18n("Unknown Protocol", "Unknown"));
00072 emit enable(true);
00073 emit enableChange(p->isLocal());
00074 }
00075 else
00076 {
00077 emit enable(false);
00078 m_type->setText("");
00079 m_uri->setText("");
00080 }
00081 }
00082
00083 void KMPropBackend::configureWizard(KMWizard *w)
00084 {
00085 w->configure(KMWizard::Backend,KMWizard::Driver,false);
00086 }
|