[Okular-devel] Review Request 111681: TextDocumentGenerator: Use black as default text color

Christoph Feck christoph at maxiom.de
Sat Feb 15 19:31:44 UTC 2014



> On Feb. 15, 2014, 5:39 p.m., Albert Astals Cid wrote:
> > I'm going to hate myself for suggeting this but what about
> > 
> > diff --git a/generators/epub/converter.cpp b/generators/epub/converter.cpp
> > index 394d852..cea74f7 100644
> > --- a/generators/epub/converter.cpp
> > +++ b/generators/epub/converter.cpp
> > @@ -9,6 +9,7 @@
> >  
> >  #include "converter.h"
> >  
> > +#include <QApplication>
> >  #include <QtGui/QAbstractTextDocumentLayout>
> >  #include <QtGui/QTextDocument>
> >  #include <QtGui/QTextFrame>
> > @@ -287,6 +288,11 @@ QTextDocument* Converter::convert( const QString &fileName )
> >        }
> >  
> >        QTextBlock before;
> > +      // HAAAAAAAAACK
> > +      QPalette p = qApp->palette();
> > +      QPalette orig = p;
> > +      p.setColor(QPalette::Link, Qt::blue);
> > +      qApp->setPalette(p);
> >        if(firstPage) {
> >          // preHtml & postHtml make it possible to have a margin around the content of the page
> >          const QString preHtml = QString("<html><head></head><body>"
> > @@ -301,6 +307,8 @@ QTextDocument* Converter::convert( const QString &fileName )
> >          before = _cursor->block();
> >          _cursor->insertHtml(htmlContent);
> >        }
> > +      qApp->setPalette(orig);
> > +      // HAAAAAAAAACK
> >  
> >        QTextCursor csr(mTextDocument);   // a temporary cursor
> >        csr.movePosition(QTextCursor::Start);
> > 
> > ?

Just replace the comments with some reasoning or ranting, maybe even a reference to a QT-BUG. Otherwise, this is probably the only way to make it ever work with Qt 4, so "ship it" from my side.

Is epub the only QTextDocument based format in Okular that supports links?


- Christoph


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/111681/#review49849
-----------------------------------------------------------


On Aug. 20, 2013, 10:40 a.m., Christoph Feck wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/111681/
> -----------------------------------------------------------
> 
> (Updated Aug. 20, 2013, 10:40 a.m.)
> 
> 
> Review request for Okular.
> 
> 
> Bugs: 253583 and 322547
>     http://bugs.kde.org/show_bug.cgi?id=253583
>     http://bugs.kde.org/show_bug.cgi?id=322547
> 
> 
> Repository: okular
> 
> 
> Description
> -------
> 
> As indicated in bug 322547, some documents do not specify a text color, and probably assume the default text color to be black. QTextDocument, however, defaults to using the system text color.
> 
> This patch changes the default text color to Qt::black. It should affect epub, fb2, odt, and plain text generators.
> 
> I think it is better to use this approach instead of changing the paper color to use the system background color (see bug 253583), because
> 
> 1) the document might specify a text color in some places,
> 
> 2) the user is able to change the fg/bg colors anyway using Okular's Accessibility options, and those probably expect black on white.
> 
> 
> Diffs
> -----
> 
>   core/textdocumentgenerator.cpp b260b3f 
> 
> Diff: https://git.reviewboard.kde.org/r/111681/diff/
> 
> 
> Testing
> -------
> 
> I tested the document from bug 322547 comment #3.
> 
> 
> Thanks,
> 
> Christoph Feck
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20140215/7c722321/attachment.html>


More information about the Okular-devel mailing list