Bug 205802

Summary: print margins are not remembered / not persistent
Product: [Applications] kate Reporter: haro <habista>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Severity: normal CC: E.microcorys, emilio.recio, linux, shaun.andrew
Priority: HI    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description haro 2009-08-31 17:15:58 UTC
Version:            (using KDE 4.3.0)
OS:                Linux
Installed from:    Debian testing/unstable Packages

In kWrite I can set margins for printed text: top, bottom, right, left.
To do this: file -> print -> properties -> margins.
In earlier versions of kWrite there was a button "ok" to set these margins for the actual print-out, and in addition a button "save" (or: "Speichern", "store"???), to set these margins permanently. This 'save-button' is missing. So I have to set the margins every time I wish to print something.
Comment 1 Martin Senftleben 2009-10-29 05:51:01 UTC
I can confirm this particularly for KMail. Using KDE 4.3.1, Kontact 4.3.2. I have to print emails quite regularly, and every time, for every single printout, I have te set the margins new, otherwise the margins are too narrow. This is quite annoying.
Comment 2 Tallowwood 2011-06-10 08:54:43 UTC
Using Linux openSUSE 11.4 KDE 4.5 / 4.6. I can confirm this issue persists. 
Changing margin settings in KDE Print -> Properties -> margins is not persistent. Having to change 4 specific margin settings for each print job is quite frustrating and a big waste of time. The problem is reproducible in other KDE apps, including Konqueror, Kwrite, Kate and Kmail.

There is no obvious place for users to change default margins elsewhere. Entering specific margin settings with CUPS lpoptions command (~/.cups/lpotions) is not effective - default KDE margin settings continue to apply. I do not know how to enter specific margin settings for Qprinter.

When Kate / Kwrite is installed from openSUSE repos for KDE4 the default is 4.23mm all round. Saves paper but too narrow for my purpose. 
When Kate / Kwrite is installed from openSUSE repos for LXDE the default is 1in (T&B), 1.25in (L&R). More practical for my purpose. 

If this is not a bug, it would be helpful if directions could be provided to enable users to set alternate and persistent default margins.
Comment 3 Dominik Haumann 2011-08-07 12:10:04 UTC
This is a huge issue in the Qt printing system.
Setting the margins with QPrinter::setPageMargins(...) does not have any effect on the QPrintDialog, although it operates on QPrinter.

I've tried to work around the bugs in the QPrinter and QPrintDialog with setPageMargins() and getPageMargins() without any success. It first needs to be fixed in Qt.

Relevant links:
- https://bugs.kde.org/show_bug.cgi?id=256975
- https://bugreports.qt.nokia.com/browse/QTBUG-15351 (most important)
- http://bugs.kde.org/show_bug.cgi?id=180051

Chances that this gets fixed are low, unfortunately.
Comment 4 Dominik Haumann 2011-08-07 12:30:51 UTC
Git commit 1aa12bace62fffbcad357623842a0fc01607b3c0 by Dominik Haumann.
Committed on 07/08/2011 at 14:26.
Pushed by dhaumann into branch 'master'.

attempt to work around Qt printing bugs

NOTE: Saving & loading the margins works around QPrinter/QPrintDialog bugs:
- https://bugreports.qt.nokia.com/browse/QTBUG-15351
- https://bugs.kde.org/show_bug.cgi?id=205802
- https://bugs.kde.org/show_bug.cgi?id=180051
Changing the margins now works. However, when you reopen the print dialog
later, the WRONG margins are displayed. The correct ones are still used.
This is a critical bug in Qt.

The real issue is Qt. And it's a critical one. But since it wasn't fixed for
years, it probably will never get fixed. That's why this workaround is better
than nothing...

CCBUG: 205802
CCBUG: 180051

M  +43   -1    part/utils/kateprinter.cpp
M  +2    -0    part/utils/kateprinter.h

Comment 5 Dominik Haumann 2011-08-07 12:34:57 UTC
Found a duplicate report in kdelibs. So close this. We cannot do more about it anyway.

*** This bug has been marked as a duplicate of bug 198172 ***
Comment 6 Christoph Feck 2011-12-08 11:07:00 UTC
*** Bug 287864 has been marked as a duplicate of this bug. ***
Comment 7 Dominik Haumann 2014-04-29 08:33:56 UTC
For the record: This change-set was removed again in commit 
since this issue is fixed in Qt 5.0. Therefore, in Kate running on Qt5 and KDE Frameworks 5 (Plasma Next), this issue is cleanly resolved.