Adapt and reapply former fix from
https://cgit.kde.org/kate.git/commit/?id=1aa12bace62fffbcad357623842a0fc01607b3c0
which was removed when migrating to Qt5.
Details
- Reviewers
cullmann - Commits
- R39:2d02e5c684e3: Save and load page margins
Modify page margins in Printer Settings. Click OK and Print.
Without the patch, the changes disappear, with the patch applied the changed
margins are remembered in ~/.config/katerc and survive the restart of kate.
Diff Detail
- Repository
- R39 KTextEditor
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
I think this is a good idea.
Instead of
KSharedConfig::openConfig()
one should use
KTextEditor::EditorPrivate::config()
otherwise this is fine for me.
Since the former patch was originally from me: I agree to accept it, but it has it's drawbacks: if you have multiple printers, having different margins is not possible, since this is not saved per printer.
Btw, I recently wrote a mail to John Layt with the following content. The linked bug may be closed with this change:
Hi John,
quick question to the QPrinter: We still have issues in Kate (and other KDE apps I assume), that the margins of the QPrintDialog are not displayed / remembered correctly.
I once committed a workaround in the KDE 4 times [1], but removed this workaround again for KF5 / Qt5 thinking that this was fixed. But it seems it isn't:
Do you have any quick pointers to this? It seems the QPrinter/QPrintDialog still do not correctly read info from CUPS, neither does it correctly remember print settings, is that correct?
Do you happen to have a good solution to this?
On stackoverflow [2] I can find that others also have this issue - and a solution is to load/save each property of QPrinter. But I am not sure this works well if you have multiple printers.
Any pointers welcome [3].
Best regards
[1] https://cgit.kde.org/kate.git/commit/?id=1aa12bace62fffbcad357623842a0fc01607b3c0
[2] https://stackoverflow.com/a/14979437/2224190
[3] https://xkcd.com/138/
I think @aacid recently (well, some time ago) worked on the Qt printing code and he may at least have an idea of the status of this.
It seems the QPrinter/QPrintDialog still do not correctly read info from CUPS
E_NEEDS_MORE_INFO
neither does it correctly remember print settings
This is by design AFAIK, but maybe a patch would be accepted if people would submit one. I'm still not convinced that it makes sense to be honest, the fact that 3 months ago i printed and A5 page in b&w has nothing to do with todays printing session.
I think adding the printer name makes sense. We could go the full road, see: https://stackoverflow.com/a/14979437/2224190