libkdeprint

John Layt johnlayt at yahoo.com.au
Sat Nov 3 15:26:12 GMT 2007


On Thursday 01 November 2007, Alex Merry wrote:
> Sorted.  Attached are the replacement fileprinter.* files, and the
> okular diff.
>
> The problem was that "-P" and the printer name need to be seperate
> arguments (they are split up by bash).  All the option-creating methods
> now return QStringLists.  Which is why I suggested printing the
> QStringList arguments, because the echo command doesn't show the
> boundaries between arguments.
>
> Additionally, I've removed the shell-quoting bits as there is no shell
> doing any interpreting.  I've also removed a bunch of explicit QString
> constructors where they are not needed (QString(const char *) is an
> implicit constructor).  And I've changed all the "foo != QString()"
> tests to "! foo.isEmpty()", which is more efficient.
>
> Alex

Brilliant!  Working perfectly here too.  I should have read the QProcess docs 
more carefully :-)

I've now added the CUPS auto-detect code taken from KDEPrint, but I have some 
issues with it.  The CUPS/IPP service detection fails with 
QAbstractSocket::ConnectionRefusedError, but that's not fatal as just 
detecting the config file should be good enough for our purposes.  If there's 
nothing obviously wrong in the code I'll just leave that check out.

The bigger problem is that even if CUPS is installed, there's no guarantee 
that the CUPS version of lpr is installed, and thus that it's safe to pass 
through the CUPS specific options using -o.  I've looked at how various 
distros package things and (no surprise) there is no consistant way we can 
tell if it is installed or not via checking a file exists, and no way I can 
see to query lpr itself as to its origins.  Instead, I've put a fallback in 
place, if CUPS is detected but the lpr returns an error code, blindly try 
again but without the CUPS options.

I'll get the last few margins kinks worked out today and we should be good to 
go.

Cheers!

John.

--

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fileprinter.cpp
Type: text/x-c++src
Size: 13177 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071103/a5da19d8/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fileprinter.h
Type: text/x-c++hdr
Size: 6381 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071103/a5da19d8/attachment.h>


More information about the kde-core-devel mailing list