Set the color scheme to Printing for Print Preview
ClosedPublic

Authored by ahmadsamir on Jan 10 2019, 6:02 PM.

Details

Summary

Otherwise the print preview dialog somehow gets the text color from the
current default color scheme; also the user can't change the color scheme
either from the print preview dialog or the "print" dialog launched from
the preview dialog.

BUG: 391678
FIXED-IN: 5.56

Test Plan
  • Change the default color scheme in kate to a dark one, e.g. Breeze dark
  • Open the print preview dialog, note that the text color is the one used in the breeze dark scheme, but the background color is still white

Apply the diff, now the print preview dialog should be using the Printing
color scheme as expected.

Diff Detail

Repository
R39 KTextEditor
Branch
print-preview-text-color (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 7668
Build 7686: arc lint + arc unit
ahmadsamir created this revision.Jan 10 2019, 6:02 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptJan 10 2019, 6:02 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
ahmadsamir requested review of this revision.Jan 10 2019, 6:02 PM
mwolff accepted this revision as: mwolff.Jan 15 2019, 2:04 PM
mwolff added a subscriber: mwolff.

lgtm, @cullmann @dhaumann? could the schema name be translated (I hope not)?

This revision is now accepted and ready to land.Jan 15 2019, 2:04 PM
dhaumann requested changes to this revision.Jan 15 2019, 8:05 PM

Looking at the printing pages, I can find the following, see screenshot. Please note the ComboBox where you can select a printing schema. In other words, this should not be hard-coded, I think it should be explicitly set somewhere to what's specified in this combobox. @ahmadsamir Can you have a look again?

This revision now requires changes to proceed.Jan 15 2019, 8:05 PM

@dhaumann: in the screenshot that's "file -> print"; the issue here is with "file -> print preview", where the extra options tabs (including "Layout") aren't added by ktexteditor. :)

A gentle ping.

Is KateRenderer::setPrinterFriendly() only called in print preview mode? I think not.

What is the bahavior currently when you print a page with another schema, and then print a page again? Does it always fallback to Printing without the patch, or does it remember the previous schema?

Is KateRenderer::setPrinterFriendly() only called in print preview mode? I think not.

What is the bahavior currently when you print a page with another schema, and then print a page again? Does it always fallback to Printing without the patch, or does it remember the previous schema?

Print -> Options -> Layout, the schema is always remembered with and without the patch.

But I see your point, even though setting the schema in setPrinterFriendly() wouldn't change the behaviour for the File -> Print dialog anyway, it's probably much safer to just set the schema to Printing only in Print Preview and be done with it.

I'll update the diff shortly.

ahmadsamir updated this revision to Diff 50503.Jan 29 2019, 6:27 PM
ahmadsamir retitled this revision from KateRenderer: when printing initially set the color scheme to Printing to Set the color scheme to Printing when print preview'ing.
ahmadsamir edited the summary of this revision. (Show Details)
ahmadsamir edited the test plan for this revision. (Show Details)
ahmadsamir removed a subscriber: mwolff.

Only set the color scheme to printing when using print preview

mwolff requested changes to this revision.Jan 30 2019, 8:23 PM
mwolff added inline comments.
src/printing/kateprinter.cpp
164

better add a setter before and then call

p.setColorScheme(QStringLiteral("Printing"));

here

180

dito

This revision now requires changes to proceed.Jan 30 2019, 8:23 PM
ahmadsamir updated this revision to Diff 50588.Jan 31 2019, 9:39 AM
ahmadsamir retitled this revision from Set the color scheme to Printing when print preview'ing to Set the color scheme to Printing for Print Preview.

Use a setter

ahmadsamir marked 2 inline comments as done.Jan 31 2019, 9:39 AM
dhaumann accepted this revision.Jan 31 2019, 5:39 PM

Now this looks good to me.

@mwolff: you also agree?

mwolff accepted this revision.Feb 5 2019, 7:30 AM

yes, thanks!

This revision is now accepted and ready to land.Feb 5 2019, 7:30 AM
This revision was automatically updated to reflect the committed changes.
dhaumann edited the summary of this revision. (Show Details)Feb 5 2019, 12:32 PM