20 #include "klpdunixprinterimpl.h"
24 #include <kstandarddirs.h>
25 #include <tdelocale.h>
26 #include <kmacroexpander.h>
28 KLpdUnixPrinterImpl::KLpdUnixPrinterImpl(TQObject *parent,
const char *name,
const TQStringList & )
29 : KPrinterImpl(parent,name)
33 KLpdUnixPrinterImpl::~KLpdUnixPrinterImpl()
37 void KLpdUnixPrinterImpl::initLpPrint(TQString& cmd,
KPrinter *printer)
39 cmd += TQString::fromLatin1(
" -d %1 -n%2").arg(quote(printer->
printerName())).arg(printer->
numCopies());
42 void KLpdUnixPrinterImpl::initLprPrint(TQString& cmd,
KPrinter *printer)
44 cmd += TQString::fromLatin1(
" -P %1 '-#%2'").arg(quote(printer->
printerName())).arg(printer->
numCopies());
48 TQString KLpdUnixPrinterImpl::executable()
50 TQString exe = TDEStandardDirs::findExe(
"lpr");
52 exe = TDEStandardDirs::findExe(
"lp");
56 bool KLpdUnixPrinterImpl::setupCommand(TQString& cmd,
KPrinter *printer)
58 TQString exe = printer->
option(
"kde-printcommand" );
59 if ( exe.isEmpty() || exe ==
"<automatic>" )
65 if (exe.right(3) ==
"lpr")
66 initLprPrint(cmd,printer);
68 initLpPrint(cmd,printer);
72 printer->
setErrorMessage(i18n(
"No valid print executable was found in your path. Check your installation."));
77 TQMap<TQString,TQString> map;
79 map.insert(
"copies", TQString::number( printer->
numCopies() ) );
80 cmd = KMacroExpander::expandMacrosShellQuote( exe, map );
This class is the main interface to access the TDE print framework.
const TQString & option(const TQString &key) const
Starts the add printer wizard.
void setErrorMessage(const TQString &msg)
Sets the last error message.
TQString printerName() const
See TQPrinter::printerName().
int numCopies() const
See TQPrinter::numCopies().