# kdeprint Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmpropbackend.cpp

    00001 /*
    00002  *  This file is part of the KDE libraries
    00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
    00004  *
    00005  *  This library is free software; you can redistribute it and/or
    00006  *  modify it under the terms of the GNU Library General Public
    00007  *  License version 2 as published by the Free Software Foundation.
    00008  *
    00009  *  This library is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  *  Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this library; see the file COPYING.LIB.  If not, write to
    00016  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  *  Boston, MA 02111-1307, USA.
    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     // layout
    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(p->device());
    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 }

This file is part of the documentation for kdeprint Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003