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

tdeprint

krlprprinterimpl.cpp

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <tdeprint@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., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  **/
00019 
00020 #include "krlprprinterimpl.h"
00021 #include "kprinter.h"
00022 #include "kmfactory.h"
00023 #include "kmmanager.h"
00024 #include "kmprinter.h"
00025 
00026 #include <tqfile.h>
00027 #include <kstandarddirs.h>
00028 #include <tdeconfig.h>
00029 #include <tdelocale.h>
00030 
00031 KRlprPrinterImpl::KRlprPrinterImpl(TQObject *parent, const char *name, const TQStringList & /*args*/)
00032 : KPrinterImpl(parent,name)
00033 {
00034 }
00035 
00036 KRlprPrinterImpl::~KRlprPrinterImpl()
00037 {
00038 }
00039 
00040 bool KRlprPrinterImpl::setupCommand(TQString& cmd, KPrinter *printer)
00041 {
00042     // retrieve the KMPrinter object, to get host and queue name
00043     KMPrinter   *rpr = KMFactory::self()->manager()->findPrinter(printer->printerName());
00044     if (!rpr)
00045         return false;
00046 
00047     QString host(rpr->option("host")), queue(rpr->option("queue"));
00048     if (!host.isEmpty() && !queue.isEmpty())
00049     {
00050         QString     exestr = TDEStandardDirs::findExe("rlpr");
00051         if (exestr.isEmpty())
00052         {
00053             printer->setErrorMessage(i18n("The <b>%1</b> executable could not be found in your path. Check your installation.").arg("rlpr"));
00054             return false;
00055         }
00056 
00057         cmd = TQString::fromLatin1("%1 -H %2 -P %3 -\\#%4").arg(exestr).arg(quote(host)).arg(quote(queue)).arg(printer->numCopies());
00058 
00059         // proxy settings
00060         TDEConfig   *conf = KMFactory::self()->printConfig();
00061         conf->setGroup("RLPR");
00062         QString host = conf->readEntry("ProxyHost",TQString::null), port = conf->readEntry("ProxyPort",TQString::null);
00063         if (!host.isEmpty())
00064         {
00065             cmd.append(" -X ").append(quote(host));
00066             if (!port.isEmpty()) cmd.append(" --port=").append(port);
00067         }
00068 
00069         return true;
00070     }
00071     else
00072     {
00073         printer->setErrorMessage(i18n("The printer is incompletely defined. Try to reinstall it."));
00074         return false;
00075     }
00076 }

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.7.1
This website is maintained by Timothy Pearson.