Commit 28e59740 authored by Ahmad Samir's avatar Ahmad Samir Committed by Dominik Haumann
Browse files

Set the color scheme to Printing for Print Preview

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.55.0

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.

Reviewers: cullmann, #ktexteditor, dhaumann, mwolff

Reviewed By: #ktexteditor, dhaumann, mwolff

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D18163
parent 8c4f803c
......@@ -48,6 +48,7 @@ public:
~KatePrinterPrivate();
bool print(QPrinter *printer);
void setColorScheme(const QString &scheme);
public Q_SLOTS:
void paint(QPrinter *printer);
......@@ -143,6 +144,12 @@ void KatePrinterPrivate::paint(QPrinter *printer)
{
m_painter->paint(printer);
}
void KatePrinterPrivate::setColorScheme(const QString &scheme)
{
m_painter->setColorScheme(scheme);
}
//END KatePrinterPrivate
//BEGIN KatePrinter
......@@ -158,6 +165,7 @@ bool KatePrinter::printPreview(KTextEditor::ViewPrivate *view)
{
QPrinter printer;
KatePrinterPrivate p(view->doc(), view);
p.setColorScheme(QStringLiteral("Printing"));
QPrintPreviewDialog preview(&printer);
QObject::connect(&preview, SIGNAL(paintRequested(QPrinter*)), &p, SLOT(paint(QPrinter*)));
return preview.exec();
......@@ -174,6 +182,7 @@ bool KatePrinter::printPreview(KTextEditor::DocumentPrivate *doc)
{
QPrinter printer;
KatePrinterPrivate p(doc);
p.setColorScheme(QStringLiteral("Printing"));
QPrintPreviewDialog preview(&printer);
QObject::connect(&preview, SIGNAL(paintRequested(QPrinter*)), &p, SLOT(paint(QPrinter*)));
return preview.exec();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment