[Kde-print-devel] [Bug 180051] [KDE4] Need a way to have default printer settings

C W J Lemmens c.w.j.lemmens at ewi.tudelft.nl
Fri Nov 20 11:44:53 CET 2009


https://bugs.kde.org/show_bug.cgi?id=180051


C W J Lemmens <c.w.j.lemmens at ewi.tudelft.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |c.w.j.lemmens at ewi.tudelft.n
                   |                            |l




--- Comment #17 from C W J Lemmens <c w j lemmens ewi tudelft nl>  2009-11-20 11:44:47 ---
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

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Kde-print-devel mailing list