Comment 25 for bug 905147

Revision history for this message
In , C-w-j-lemmens (c-w-j-lemmens) wrote :

Dear fellow KDE4 users,

I solved most of my problems for now by using some workarounds :

1) For our non-KDE programs (firefox, openoffice and some older stuff) I found a perfect replacement for "kprinter" : gtklp !! Take a look here : it solved more than half of my problems : http://gtklp.sourceforge.net/

2) To force doublesided printing inside KDE4 applications I used this :

* I downloaded the source of qt-4.5.3 and configured and compiled the whole bunch.
* Then I hacked the src/gui/dialog/qprintdialog_unix.cpp and added this :

— qprintdialog_unix.cpp.org 2009-10-19 20:19:20.000000000 +0200
+++ qprintdialog_unix.cpp 2009-11-19 14:22:08.000000000 +0100
@@ -424,6 +424,15 @@

void QPrintDialogPrivate::applyPrinterProperties(QPrinter *p)
{
+ // Force some decent defaults, e.g. for Duplex printing !!!
+ p->setDoubleSidedPrinting(true);
+ p->setColorMode(QPrinter::GrayScale);
+ p->setPageSize(QPrinter::A4);
+
+ fprintf(stderr,
+ "Using QPrintDialogPrivate::applyPrinterProperties() hack by KL !\n");
+
if (p->colorMode() == QPrinter::Color)

This forces everything to be grayscale, A4 and duplex unless the user explicitly chooses something else (this is the cheapest for our department !) The extra fprintf statement is only for me to see that I am indeed using the hacked library and not the original.

* Then I reran "make" in src/gui to recompile just a new libQtGui

* I copied the modified libQtGui.so.4.5.3 and its softlinks to a directory /opt/qt-4.5.3-hack/lib/

* Now I had to make sure that each KDE session uses this new library instead of the original one. I did that by hacking /etc/profile.d/qt4.sh (or qt4.csh if you wish) and added this at the end :

export LD_LIBRARY_PATH=/opt/qt-4.5.3-hack/lib

* If you then login again each user will use the new libQtGui library and thus have changed printing settings. I admit it isn't very elegant and still doesn't remember previous settings but at least we have some decent defaults now.

Hope this helps some of you until the Qt or KDE people come up with something more permanent !

Regards,
KL