kdeprintfax: Check box for fax cover sheet

Ray Lischner lisch at tempest-sw.com
Thu Apr 20 19:00:25 CEST 2006


I use kdeprintfax for sending faxes from a variety of programs. 
Sometimes, I already have a cover sheet, and sometimes I don't (which 
means I want the fax software to generate one for me).

The problem with kdeprintfax is that the only way to control whether I 
get a cover sheet is to change the fax program command line.

It turns out adding this feature to kdeprintfax was not terribly 
difficult. I added a check box to the main window, and I added a new 
%cover tag. The biggest change was to support the notion of a Boolean 
tag. If the command line does not use the %cover tag, the check box 
(and therefore Subject and Comment) are disabled. This is for simple 
tools such as efax, which don't give the user the option.

For example, I use HylaFax. The -n switch turns off coverpage 
generation; the default is generate a cover page. Thus, I need the 
%cover tag to yield -n when the Cover Sheet check box is unchecked, and 
an empty string when it is checked. I could not figure out how to do 
that with the existing tag mechanism.

A Boolean tag has the form %name_{iftrue??iffalse}. I added an 
overloaded processTag function, which takes a bool value argument. If 
the value is true, the tag's value is the iftrue string; otherwise, it 
is the iffalse string. The ??iffalse part is optional; the default is 
an empty string.

Thus, the HylaFax cover page tag is %cover_{??-n}. Using the Boolean tag 
feature works well for %res, too. For HylaFax, use %res_{-m??-l}.

The patch to KDE 3.5.2 is only 310 lines long, if anyone is interested.
-- 
Ray Lischner, Author of C++ in a Nutshell
http://cpphelp.com


More information about the kde-print mailing list